tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2009/02/05 14:36] – created ccumer | tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2013/04/12 10:55] – [Create LVM] KoHofer@unibz.it | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======VM disk Expansion LVM+XFS======== | + | ====== VM disk Expansion LVM with XFS/EXT4 ======= |
+ | <note important> | ||
+ | Expand the original disk or add a second vdisk from **Infrastructure Client**.\\ | ||
+ | If you want to perform a grow w/o reboot you have to add a second disk. | ||
+ | |||
+ | If you are on a kernel newer or equal to 2.6.32 then you can issue the command | ||
+ | |||
+ | < | ||
+ | |||
+ | to get the new size w/o reboot. | ||
+ | |||
+ | |||
+ | In case you cant see the " | ||
+ | |||
+ | echo "- - -" > / | ||
+ | | ||
+ | Do this for all host0,1,2 etc. | ||
+ | |||
+ | |||
+ | or | ||
+ | |||
+ | echo " | ||
+ | |||
+ | whereby after scsi_device you need to find the correct scsi device | ||
+ | |||
+ | |||
+ | |||
+ | **EXPAND ORIGINAL DISK** | ||
+ | |||
+ | Create an additional partition on the free space, say you increased the existing disc | ||
+ | from 8GB to 15GB. The partition type is 8e. | ||
+ | |||
+ | cfdisk /dev/sda | ||
+ | |||
+ | # for example if the new partition is /dev/sda3 | ||
+ | |||
+ | # create logical disk /dev/sda3 of type 8e (Linux LVM) | ||
+ | |||
+ | # make disk visible to linux | ||
+ | |||
+ | partprobe | ||
+ | pvcreate /dev/sda3 | ||
+ | |||
+ | now you have to extend the volgroup. use '' | ||
+ | in this example it's **base** | ||
+ | |||
+ | lvdisplay | ||
+ | --- Logical volume --- | ||
+ | LV Name / | ||
+ | VG Name base | ||
+ | LV UUID 8cL9Qd-ksIn-1Ve2-94ym-gTrW-8jet-91tnah | ||
+ | LV Write Access | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size 5.00 GB | ||
+ | Current LE 1280 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | Block device | ||
+ | |||
+ | --- Logical volume --- | ||
+ | LV Name / | ||
+ | VG Name base | ||
+ | LV UUID mEnEXY-UtOf-P439-MDpg-BlT3-n8hI-Q6KIfm | ||
+ | LV Write Access | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size 1.00 GB | ||
+ | Current LE 256 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | Block device | ||
+ | |||
+ | --- Logical volume --- | ||
+ | LV Name / | ||
+ | VG Name base | ||
+ | LV UUID fm2A23-FPb3-itQa-Fvf2-QQmj-giwI-j8FZAf | ||
+ | LV Write Access | ||
+ | LV Status | ||
+ | # open 2 | ||
+ | LV Size 2.00 GB | ||
+ | Current LE 512 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | Block device | ||
+ | |||
+ | --- Logical volume --- | ||
+ | LV Name / | ||
+ | VG Name base | ||
+ | LV UUID GZKUbb-hZn2-igXN-3dxj-TNz9-1C15-I8u8MR | ||
+ | LV Write Access | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size 1.52 GB | ||
+ | Current LE 389 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | Block device | ||
+ | |||
+ | |||
+ | and we assume the new partition is /dev/sda3 | ||
+ | |||
+ | vgextend base /dev/sda3 | ||
+ | |||
+ | check with '' | ||
+ | |||
+ | pvscan | ||
+ | |||
+ | Now we extend the " | ||
+ | 11.5 G is the NEW total size of the disk we want to extend! | ||
+ | |||
+ | Extend the LV to use all free space | ||
+ | lvextend -l +100%FREE / | ||
+ | |||
+ | Extend with 20G | ||
+ | lvextend -L +20G / | ||
+ | |||
+ | now we have to grow the filesystem /data | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | ===== FOR EXT3/4 ===== | ||
+ | |||
+ | Extend filesystem | ||
+ | |||
+ | vgextend base /dev/sda3 | ||
+ | |||
+ | lvextend -l +100%FREE / | ||
+ | |||
+ | Check that the filesystem is ok, **but only if the FS is unmounted** | ||
+ | |||
+ | fsck.ext4 -f /dev/base | ||
+ | |||
+ | Now resize the filesystem | ||
+ | |||
+ | resize2fs -p / | ||
+ | |||
+ | |||
+ | ===== For swap ===== | ||
+ | |||
+ | swapoff / | ||
+ | lvextend -L 3.9G / | ||
+ | mkswap / | ||
+ | swapon / | ||
+ | free | ||
+ | |||
+ | Check if filesystems are ok, and only then release the snapshot | ||
+ | |||
+ | |||
+ | ======= Create LVM ======= | ||
+ | |||
+ | Find all LVM VG | ||
+ | |||
+ | vgscan | ||
+ | |||
+ | Create Physical Volumes | ||
+ | |||
+ | Der Befehl pvcreate legt den VGDA Block auf dem PV an. Er muss für jedes PV ausgeführt werden, bevor es von LVM verwendet werden kann: | ||
+ | |||
+ | | ||
+ | |||
+ | Volume Groups anlegen | ||
+ | |||
+ | Jetzt legen wir mit ' | ||
+ | |||
+ | | ||
+ | |||
+ | Logische Volumes anlegen. | ||
+ | |||
+ | Hier legen wir jetzt alle unsere logischen Volumes an. Als Namen verwenden wir, etwas fantasielos, | ||
+ | |||
+ | | ||
+ | |||
+ | oder wir könne die Größen angeben! (1500M) | ||
+ | |||
+ | | ||
+ | |||
+ | Filesysteme anlegen | ||
+ | |||
+ | Ab jetzt können die logischen Partitionen, | ||
+ | |||
+ | mkfs.ext4 / | ||
+ | |||
+ | fstab anpassen | ||
+ | |||
+ | Damit die neuen Filesysteme nun bei jedem Systemstart automatisch gemountet werden, müssen wir sie in die Datei /etc/fstab eintragen (siehe 'man fstab' | ||
+ | |||
+ | / | ||
+ | |||
+ | http:// | ||
+ | |||
+ | http:// |
/data/www/wiki.inf.unibz.it/data/pages/tech/documentation/procedures/vm/vm_disk_expansion_lvm_xfs.txt · Last modified: 2020/10/13 16:46 by kohofer