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 [2010/04/27 12:44] – kohofer | tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2012/02/14 14:15] – [FOR EXT3/4] kohofer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======VM disk Expansion LVM+XFS======= | + | ====== VM disk Expansion LVM with XFS/EXT4 ======= |
- | 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 | + | <note important> |
- | **THEN TAKE A SNAPSHOT!!!** | + | |
- | then from on the vm either create | + | Expand |
+ | If you want to perform a grow w/o reboot you have to add a second disk | ||
+ | |||
+ | **EXPAND ORIGINAL DISK** | ||
+ | |||
+ | Create | ||
+ | from 8GB to 15GB. The partition type is 8e. | ||
cfdisk /dev/sda | cfdisk /dev/sda | ||
Line 17: | Line 22: | ||
- | if you are running a newer kernel you can issue this command to male linux re-read the disk geometry: | + | now you have to extend the volgroup. use '' |
- | + | in this example it' | |
- | 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 | + | |
- | + | ||
- | ### for example if the new partition is /dev/sda3 | + | |
- | + | ||
- | | + | |
- | + | ||
- | now you have to extend the volgroup. use '' | + | |
lvdisplay | lvdisplay | ||
Line 103: | Line 94: | ||
11.5 G is the NEW total size of the disk we want to extend! | 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 11.5G | + | lvextend -l +100%FREE |
Extend with 20G | Extend with 20G | ||
- | |||
- | |||
lvextend -L +20G / | lvextend -L +20G / | ||
Line 114: | Line 103: | ||
| | ||
+ | |||
+ | |||
+ | ===== FOR EXT3/4 ===== | ||
+ | |||
+ | Check that the filesystem is ok | ||
+ | |||
+ | fsck.ext4 / | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | Extend filesystem | ||
+ | |||
+ | lvextend -l +100%FREE / | ||
+ | |||
+ | Now resize the filesystem | ||
+ | |||
+ | resize2fs -p / | ||
===== For swap ===== | ===== For swap ===== | ||
- | swapoff / | + | |
- | lvextend -L 3.9G / | + | lvextend -L 3.9G / |
- | mkswap / | + | mkswap / |
- | swapon / | + | swapon / |
- | free | + | free |
Check if filesystems are ok, and only then release the snapshot | Check if filesystems are ok, and only then release the snapshot | ||
- | For ext2/ext3 | ||
- | | + | ======= 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