当前位置:网站首页>Explanation of dev/mapper

Explanation of dev/mapper

2022-06-25 14:37:00 qq_ forty-two million five hundred and thirty-three thousand tw

Two 、/dev/mapper The explanation of the catalog

    For the convenience of narration , Suppose a server has three hard disks, which are a,b,c, The capacity of each hard disk is 1T. In the installation Linux When , First, establish basic partitions according to the needs of the system and itself , Suppose for the hard disk a It was partitioned , Out 0.1T The space is mounted in /boot Under the table of contents , Other hard disks are not partitioned . System utilization Device mapper The mechanism establishes a volume group (volume group,VG), You can take VG Think of it as a resource pool , Last in VG Create a logical volume above (logical volume,LV). To remove the hard disk a Remaining space of 、 Hard disk b And the hard disk c All joined VG in , Then the hard disk a The remaining space will first be established by the system as a physical volume (physical volume,PV), And the size of the physical volume is 0.9T, Then the hard disk a The rest of the space 、 Hard disk b And the hard disk c With PV Join as VG In this resource pool , Then how much space do you need , You can start from VG How much space is set aside in the ( Of course, the maximum can not exceed VG The capacity of ). Compared with this, the space in the pool is 2.9T, At this point, you can build a 1T The above space comes out , Unlike before, the maximum capacity space can only be 1T.

   /dev/mapper/Volume-lv_root I mean, you have a VG (volume group The volume group ) called Volume, This Volume There's a LV called lv_root. Actually this /dev/mapper/Volume-lv_root File is a connection file , Is connected to /dev/dm-0 Of , You can order ll /dev/mapper/Volume-lv_root To view the .

    In fact, in the system /dev/Volume/lv_root and /dev/mapper/Volume-lv_root as well as /dev/dm-0 It's all one thing , Can be treated as a partition .

    To understand the specific situation of the hard disk , It can be done by fdisk perhaps pvdisplay Command to view .

    If you want to reinstall the system to /dev/sda Next , And during installation, some things do not want to be formatted and want to be transferred to /dev/sdb Next , But this time /dev/sda and /dev/sdb Be put in VG It's in , How to solve this problem ? In this case , Because there is no way to determine which hard disk the data is on , Because these two hard disks are like adding to the pool , By Device mapper management , So the solution is to create another logical volume , Move the data to a new volume , In this way, when you reinstall the system, you can delete only the things in the previous partition , And the things in the new volume don't move , It won't be lost .

/vm_data/openstack/nova/instance/instance-000008a9]$ ll
total 216080
-rw-r--r-- 1 nova nova     28744 Jun 17 14:53 console.log
-rw-r--r-- 1 nova nova 221249536 Jun 23 10:39 disk
lrwxrwxrwx 1 nova nova        52 Jun 17 14:52 disk.local -> /dev/raidVG/eph_d03ab0ae-09b6-43e5-a9e0-2dc4acf4dfd8
-rw-r--r-- 1 nova nova      1790 Jun 17 14:52 libvirt.xml

/dev/mapper/ Contents under the directory

/dev/mapper]$ ll  |grep d03ab0ae
lrwxrwxrwx 1 root root       8 Jun 22 18:14 raidVG-eph_d03ab0ae--09b6--43e5--a9e0--2dc4acf4dfd8 -> ../dm-18
lrwxrwxrwx 1 root root       8 Jun 17 14:52 raidVG-eph_d03ab0ae--09b6--43e5--a9e0--2dc4acf4dfd8--linear -> ../dm-20
lrwxrwxrwx 1 root root       8 Jun 17 14:52 raidVG-eph_d03ab0ae--09b6--43e5--a9e0--2dc4acf4dfd8--meta -> ../dm-19

lvdisplay 

  --- Logical volume ---
  LV Path                /dev/raidVG/eph_d03ab0ae-09b6-43e5-a9e0-2dc4acf4dfd8-meta
  LV Name                eph_d03ab0ae-09b6-43e5-a9e0-2dc4acf4dfd8-meta
  VG Name                raidVG
  LV UUID                HExptR-uUCG-rfdd-RUFz-p9y2-wPuQ-6df7Yo
  LV Write Access        read/write
  LV Creation host, time qd01-cp-compute111007151.qd01.ksyun.com, 2022-06-17 14:52:10 +0800
  LV Status              available
  # open                 1
  LV Size                4.00 MiB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:19

原网站

版权声明
本文为[qq_ forty-two million five hundred and thirty-three thousand tw]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251433361837.html