目前客戶遇到的問題是,以前的centos7的操做系統掛了,服務器商提供了一個新的centos7的服務器,而且把以前那塊壞了的服務器的磁盤取出來插到了這個系統上,別問我爲啥還用lvm,不是我說了算呀。html
新系統磁盤sdacentos
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: dos Disk identifier: 0x000280f1 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 976773119 487873536 8e Linux LVM
老系統磁盤sdb服務器
Disk /dev/sdb: 500.1 GB, 500107861504 bytes, 976773167 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00030e98 Device Boot Start End Blocks Id System /dev/sdb1 * 2048 1026047 512000 83 Linux /dev/sdb2 1026048 976773119 487873536 8e Linux LVM
lvm磁盤不能直接經過mount進行掛載ide
[root@localhost conf.d]# mount /dev/sdb2 /mnt mount: unknown filesystem type 'LVM2_member' [root@localhost conf.d]#
http://jingyan.baidu.com/arti...ui
[root@localhost conf.d]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a-- 465.27g 64.00m /dev/sdb2 centos lvm2 a-- 465.27g 64.00m [root@localhost conf.d]# vgscan Reading volume groups from cache. Found volume group "centos" using metadata type lvm2 Found volume group "centos" using metadata type lvm2 [root@localhost conf.d]#
貌似搗鼓半天並不行。centos7
會發現2個的VG都是叫centos的東西,磁盤的數據都分佈在/dev/centos/...,因此若是直接經過掛載/dev/centos/root /mnt會發現其實任然是A盤的數據,並非B盤的,因此必需要將VG換一個名字.spa
使用lvm指令非交互式更換名稱 [root@localhost dev]# lvm vgrename centos vgroupOLD Volume group "centos" successfully renamed to "vgroupOLD" [root@localhost dev]#
改名後,就能夠進行LVM掛載了操作系統
1.啓用vg.net
啓用VG,輸入vgchange -ay VGRHEL
2.這時候在/dev下應該能看到VGRHEL目錄,手動創建/目錄,掛載根目錄的建立目錄下。unix
[root@localhost dev]# mount /dev/vgroupOLD/ home root swap [root@localhost dev]# mount /dev/vgroupOLD/root /mnt [root@localhost dev]#
數據找到了