close

將既有的一個 vg , 移到另一個系統將其掛載 ,步驟如下 : 


1. Unmount the file system

首先,確定沒有任何使用者正在對這個 Volume 做任何的存取 , 然後 umount 它 .

# unmount /testvg/data


2. Mark the volume group inactive

將該 VG 進行 inactive , 使其與kernel 脫離

# vgchange -an testvg
vgchange -- volume group "testvg" successfully deactivated
         


3. Export the volume group

為了避免舊系統再繼續存取它, 需將它export 出來 ,並為移除做準備 .

# vgexport testvg
vgexport -- volume group "testvg" successfully exported
         


接著就可以將舊系統關機 ,將硬碟取下裝到新系統 ,或是將 san storage lun 重新指配給新主機 ,

後將新系統開機 .



4. Import the volume group

假設加入新系統後 , 新的 device name 為 /dev/sdb ,

執行 pvscan , 出現以下訊息:
# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/sdb1"  is in EXPORTED VG "design" [996 MB / 996 MB free]
pvscan -- inactive PV "/dev/sdb2"  is in EXPORTED VG "testvg" [996 MB / 244 MB free]
pvscan -- total: 2 [1.95 GB] / in use: 2 [1.95 GB] / in no VG: 0 [0]
         

再來就可以 import 這個  VG , 並掛載入檔案系統 .

假設你用的是 LVM2 , 則執行 :

# vgimport testvg
  Volume group "testvg" successfully imported
         

假設你是要將其 import 到 LVM1 系統 , 則要執行 :

 # vgimport testvg /dev/sdb1 /dev/sdb2
vgimport -- doing automatic backup of volume group "testvg"
vgimport -- volume group "testvg" successfully imported and activated
         


5. Activate the volume group

再來要存取該 VG之前要先 active 它 , 並讓系統紀錄狀態 .

# vgchange -ay testvg
         

6. Mount the file system

最後將其掛載

# mkdir -p /mnt/testdata
# mount /dev/testvg/data  /mnt/data

         
現在這個VG 在新系統就可以正常使用了.

arrow
arrow
    全站熱搜

    puffer 發表在 痞客邦 留言(0) 人氣()