tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2009/02/05 15:11] – ccumer | tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2011/08/11 16:13] – kohofer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======VM disk Expansion LVM+XFS======= | + | ====== VM disk Expansion LVM+XFS ======= |
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 | 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 | ||
**THEN TAKE A SNAPSHOT!!!** | **THEN TAKE A SNAPSHOT!!!** | ||
- | then from on the vm either create an additional | + | then from on the vm either create an additional |
- | < | + | |
- | cfdisk /dev/sda | + | cfdisk /dev/sda |
- | ### for example if the new partition is /dev/sda3 | + | # for example if the new partition is /dev/sda3 |
- | pvcreate /dev/sda3 | + | |
- | </code> | + | # create logical disk /dev/sda3 |
+ | |||
+ | # make disk visible to linux | ||
+ | |||
+ | partprobe | ||
+ | | ||
+ | |||
+ | |||
+ | if you are running a newer kernel you can issue this command to male linux re-read the disk geometry: | ||
+ | |||
+ | echo " | ||
+ | |||
+ | |||
+ | or assign the whole new disk to lvm assuming it's /dev/sdb | ||
+ | |||
+ | apt-get install scsitools | ||
+ | rescan-scsi-bus.sh | ||
+ | cfdisk /dev/sdb | ||
- | or assign the whole new disk to lvm | ||
- | < | ||
- | cfdisk /dev/sdb | ||
### for example if the new partition is /dev/sda3 | ### for example if the new partition is /dev/sda3 | ||
- | pvcreate /dev/sdb | ||
- | </ | ||
- | now you have to extend the volgroup. user '' | + | |
- | < | + | now you have to extend the volgroup. use '' |
- | vgextend | + | |
- | </code> | + | lvdisplay |
+ | --- Logical volume --- | ||
+ | LV Name /dev/base/root | ||
+ | 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 | ||
+ | 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 '' | check with '' | ||
- | Now we extend the " | + | pvscan |
- | < | + | Now we extend the " |
- | lvextend -L 11.5G / | + | 11.5 G is the NEW total size of the disk we want to extend! |
- | </code> | + | |
+ | |||
+ | | ||
+ | |||
+ | Extend with 20G | ||
+ | |||
+ | |||
+ | lvextend -L +20G | ||
now we have to grow the filesystem /data | now we have to grow the filesystem /data | ||
- | < | + | |
- | xfs_growfs /data | + | |
- | </code> | + | |
+ | |||
+ | ===== For swap ===== | ||
+ | |||
+ | swapoff / | ||
+ | lvextend -L 3.9G / | ||
+ | mkswap / | ||
+ | swapon / | ||
+ | free | ||
+ | |||
+ | Check if filesystems are ok, and only then release the snapshot | ||
+ | |||
+ | For ext2/ext3 | ||
+ | |||
+ | resize2fs / | ||
+ | |||
+ | ======= 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, | ||
+ | |||
+ | | ||
+ | |||
+ | 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:// | ||
+ |
/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