hp-ux的lvm使用

wangkxxe發表於2009-07-01
lvm的使用
a 建立
1 pvcreate -f /dev/rdsk/c2t6d0 生成PV資訊
2 mkdir /dev/vg01
3 mknod /dev/vg01/group c 64 0x010000 建立裝置檔案
4 vgcreate /dev/vg01 /dev/dsk/c2t6d0 建立卷組VG
5 lvcreate -L 17360 vg01 建立邏輯卷lv (18G硬碟)
6 newfs -F vxfs -o largefiles /dev/vg01/rlvol1
7 mkdir /w ; mount /dev/vg01/lvol1 /w
b 刪除VG
1 lvdisplay /dev/vg01/lvol* 確定此VG中包含多少個LV
2 umount /w umount要移除的VG下的LV
3 lvremove /dev/vg01/lvol1 /dev/dsk/c2t6d0 刪除LV
4 strings /etc/lvmtab 確定要移除的VG中只包含一個PV
5 vgreduce /dev/vg01 /dev/dsk/c2t6d0 刪除多餘的PV,vg中加入了c0t3d0,c0t4d0和c0t5d0三個硬碟,
這時候要移除多餘的,剩下最後一個c0t3d0作為VG的載體。
6 vgremove /dev/vg01 刪除VG
4 strings /etc/lvmtab;ll /dev/vg01
c 擴充套件檔案系統
1 bdf
2 lvextend -L 17360 /dev/vg02/lvol1 擴大邏輯捲到17360M
3 umount /dev/vg02/lvol1
4 extendfs -F vxfs /dev/vg01/lvol2 擴大檔案系統
5 mount /dev/vg01/lvol1 /w;bdf

d 移動邏輯卷lv(在不同硬碟)
這類操作很少用,在建立LV的時候,需要時連續的塊空間,操作才會成功。
下面我們已加入一個新硬碟c2t6d0為例子,將lvol1從c2t6d0上移過去。操作如下:
1. #strings /etc/lvmconf/vg00.conf;pvcreate -f /dev/dsk/c2t6d0
2. #vgextend /dev/vg00 /dev/dsk/c2t6d0
3. #pvmove -n /dev/vg00/lvol1 /dev/dsk/c1t6d0 /dev/dsk/c2t6d0
4. #vgcfgbackup vg00;strings /etc/lvmconf/vg00.conf
??如何確認/dev/vg00/lvol1在/dev/dsk/c2t6d0上?
sam--disk&vg--lv--lvol1--Actions-View More Information
pvdisplay /dev/dsk/c1t6d0
e 縮小檔案系統,檔案和資料的要丟失
一般不建議縮小檔案系統,因為這很可能造成一些檔案和資料的丟失,如果非要進行此操作,請先考慮如下方案:
a). 到HP購買onlie-JFS軟體
b). 操作前先進行備份
我們仍然用之前擴大的lvol1來作為例子講解。按照如下步驟進行操作:
1. #fbackup -f /dev/rmt/0m -0vHi /vg01_lvol1
說明:這是先對此檔案系統進行備份
2. #umount /dev/vg01/lvol1
3. # lvreduce -L 1700 /dev/vg01/lvol1 縮小到1700M
4. #newfs -F vxfs -o largefiles /dev/vg01/rlvol1
說明:就是這個操作,讓此檔案系統上的檔案全部丟失,因此,一定要做好備份的動作!
5. #mount -a
6. #frecover -f /dev/rmt/0m
說明:這個恢復的操作可能會失敗,原因在於如果將檔案系統縮得太小,之前備份的檔案大小可能要大於它。因此,在縮小檔案系統之前 ,仔細用bdf命令看看。
7. #vgcfgbackup vg01
lvdisplay /dev/vg00/lvol*
--- Physical volumes ---
PV Name /dev/dsk/c1t6d0
PV Status available
Total PE 4340
Free PE 445
Autoswitch On
PV Name /dev/dsk/c2t6d0
PV Status available
Total PE 4340
Free PE 4340
Autoswitch On
lvremove /dev/vg00/rlvol8 /dev/dsk/c2t6d0
lvdisplay /dev/vg00/lvol*
[email=root@app]root@app[/email]
[~]# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c1t6d0
/dev/dsk/c2t6d0
[email=root@app]root@app[/email]
[~]# vgreduce /dev/vg00 /dev/dsk/c2t6d0
Volume group "/dev/vg00" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
[email=root@app]root@app[/email]
[~]# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c1t6d0
strings /etc/lvmtab
vgreduce /dev/vg00 /dev/dsk/c2t6d0
strings /etc/lvmtab
整盤形式利用
newfs -F vxfs -o largefiles /dev/rdsk/c2t6d0
mount /dev/dsk/c2t6d0 /w
/dev/vg00/lvol7
# vgdisplay -v vg00
PV Name /dev/dsk/c1t0d0s2
PV Name /dev/dsk/c1t1d0
# lvcreate -L 8 -n mylv00 vg00[@more@]hp-ux的lvm使用

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12801008/viewspace-1023685/,如需轉載,請註明出處,否則將追究法律責任。

相關文章