星期日, 十二月 10, 2006

Logical Volumn Manager(LVM) 動態修正磁碟大小

來源 : 鳥哥網站 , LVM-HOWTO
作者 : IBM 林彥明(Alex Lin)











# lvextend -L12G /dev/myvg/homevol
lvextend -- extending logical volume "/dev/myvg/homevol" to 12 GB
lvextend -- doing automatic backup of volume group "myvg"
lvextend -- logical volume "/dev/myvg/homevol" successfully extended

will extend /dev/myvg/homevol to 12 Gigabytes.

# lvextend -L+1G /dev/myvg/homevol
lvextend -- extending logical volume "/dev/myvg/homevol" to 13 GB
lvextend -- doing automatic backup of volume group "myvg"
lvextend -- logical volume "/dev/myvg/homevol" successfully extended

will add another gigabyte to /dev/myvg/homevol.

ext2/ext3

Unless you have patched your kernel with the ext2online patch it is necessary to unmount the file system before resizing it. (It seems that the online resizing patch is rather dangerous, so use at your own risk)

# umount /dev/myvg/homevol/dev/myvg/homevol
# resize2fs /dev/myvg/homevol
# mount /dev/myvg/homevol /home

If you don't have e2fsprogs 1.19 or later, you can download the ext2resize command from ext2resize.sourceforge.net and use that:

# umount /dev/myvg/homevol/dev/myvg/homevol
# ext2resize /dev/myvg/homevol
# mount /dev/myvg/homevol /home

For ext2 there is an easier way. LVM 1 ships with a utility called e2fsadm which does the lvextend and resize2fs for you (it can also do file system shrinking, see the next section).

reiserfs

Reiserfs file systems can be resized when mounted or unmounted as you prefer:

Online:

# resize_reiserfs -f /dev/myvg/homevol

Offline:

# umount /dev/myvg/homevol
# resize_reiserfs /dev/myvg/homevol
# mount -treiserfs /dev/myvg/homevol /home


xfs

XFS file systems must be mounted to be resized and the mount-point is specified rather than the device name.

# xfs_growfs /home


0 意見:

 
template hacks by: [ METAMUSE ]