- 論壇徽章:
- 0
|
lvm的使用
a 建立
1 pvcreate -f /dev/rdsk/c2t6d0 生成PV信息
2 mkdir /dev/vg01
3 mknod /dev/vg01/group c 64 0x010000 建立設(shè)備文件
4 vgcreate /dev/vg01 /dev/dsk/c2t6d0 創(chuàng)建卷組VG
5 lvcreate -L 17360 vg01 創(chuàng)建邏輯卷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 擴(kuò)展文件系統(tǒng)
1 bdf
2 lvextend -L 17360 /dev/vg02/lvol1 擴(kuò)大邏輯卷到17360M
3 umount /dev/vg02/lvol1
4 extendfs -F vxfs /dev/vg01/lvol2 擴(kuò)大文件系統(tǒng)
5 mount /dev/vg01/lvol1 /w;bdf
d 移動邏輯卷lv(在不同硬盤)
這類操作很少用,在建立LV的時候,需要時連續(xù)的塊空間,操作才會成功。
下面我們已加入一個新硬盤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
??如何確認(rèn)/dev/vg00/lvol1在/dev/dsk/c2t6d0上?
sam--disk&vg--lv--lvol1--Actions-View More Information
pvdisplay /dev/dsk/c1t6d0
e 縮小文件系統(tǒng),文件和數(shù)據(jù)的要丟失
一般不建議縮小文件系統(tǒng),因?yàn)檫@很可能造成一些文件和數(shù)據(jù)的丟失,如果非要進(jìn)行此操作,請先考慮如下方案:
a). 到HP購買onlie-JFS軟件
b). 操作前先進(jìn)行備份
我們?nèi)匀挥弥皵U(kuò)大的lvol1來作為例子講解。按照如下步驟進(jìn)行操作:
1. #fbackup -f /dev/rmt/0m -0vHi /vg01_lvol1
說明:這是先對此文件系統(tǒng)進(jìn)行備份
2. #umount /dev/vg01/lvol1
3. # lvreduce -L 1700 /dev/vg01/lvol1 縮小到1700M
4. #newfs -F vxfs -o largefiles /dev/vg01/rlvol1
說明:就是這個操作,讓此文件系統(tǒng)上的文件全部丟失,因此,一定要做好備份的動作!
5. #mount -a
6. #frecover -f /dev/rmt/0m
說明:這個恢復(fù)的操作可能會失敗,原因在于如果將文件系統(tǒng)縮得太小,之前備份的文件大小可能要大于它。因此,在縮小文件系統(tǒng)之前 ,仔細(xì)用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
本文來自ChinaUnix博客,如果查看原文請點(diǎn):http://blog.chinaunix.net/u/14639/showart_1134880.html |
|