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 revision | ||
tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2012/02/13 11:00] – kohofer | tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2020/10/13 16:46] (current) – [VM disk Expansion LVM with XFS/EXT4] kohofer | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== VM disk Expansion LVM with XFS/EXT4 ======= | ====== VM disk Expansion LVM with XFS/EXT4 ======= | ||
- | |||
- | <note important> | ||
Expand the original disk or add a second vdisk from **Infrastructure Client**.\\ | Expand the original disk or add a second vdisk from **Infrastructure Client**.\\ | ||
- | If you want to perform | + | |
+ | 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 | ||
+ | |||
+ | or | ||
+ | |||
+ | apt-get install scsitools | ||
+ | rescan-scsi-bus | ||
+ | |||
+ | At the end it should list that a new device was found, note down the name/ | ||
+ | |||
+ | echo ' | ||
+ | |||
+ | IMPORTANT: Be sure to replace the 32\:0\:1\:0 with the appropriate | ||
**EXPAND ORIGINAL DISK** | **EXPAND ORIGINAL DISK** | ||
Create an additional partition on the free space, say you increased the existing disc | Create an additional partition on the free space, say you increased the existing disc | ||
+ | |||
from 8GB to 15GB. The partition type is 8e. | from 8GB to 15GB. The partition type is 8e. | ||
- | cfdisk /dev/sda | + | cfdisk / |
+ | |||
+ | |||
+ | **RESIZE ORIGINAL DISK** | ||
+ | |||
+ | Resize the already existing partition, e.g. /dev/sda4 to the newly created free partition. | ||
+ | |||
+ | cfdisk /dev/sda or cfdisk /dev/sdb | ||
+ | |||
+ | Now resize the Physical Volume to the new size | ||
+ | |||
+ | pvresize /dev/sda4 | ||
+ | |||
+ | extend the logical volume | ||
+ | |||
+ | lvextend -l +100%FREE | ||
+ | |||
+ | next resize the file system | ||
+ | |||
+ | resize2fs -p / | ||
+ | |||
+ | |||
+ | If you get a error: | ||
+ | |||
+ | <color # | ||
+ | |||
+ | run this command: | ||
+ | |||
+ | parted -l | ||
+ | |||
+ | and when asked to Fix/Cancel? type **F** | ||
# for example if the new partition is /dev/sda3 | # for example if the new partition is /dev/sda3 | ||
- | # create logical disk /dev/sda3 | + | # create logical disk / |
# make disk visible to linux | # make disk visible to linux | ||
Line 20: | Line 81: | ||
partprobe | partprobe | ||
pvcreate /dev/sda3 | pvcreate /dev/sda3 | ||
- | |||
now you have to extend the volgroup. use '' | now you have to extend the volgroup. use '' | ||
in this example it's **base** | in this example it's **base** | ||
- | lvdisplay | + | lvdisplay |
+ | |||
+ | < | ||
--- Logical volume --- | --- Logical volume --- | ||
LV Name / | LV Name / | ||
Line 81: | Line 143: | ||
Read ahead sectors | Read ahead sectors | ||
Block device | Block device | ||
+ | </ | ||
and we assume the new partition is /dev/sda3 | and we assume the new partition is /dev/sda3 | ||
Line 107: | Line 169: | ||
===== FOR EXT3/4 ===== | ===== FOR EXT3/4 ===== | ||
- | Check that the filesystem is ok | ||
- | |||
- | fsck.ext4 / | ||
- | | ||
Extend filesystem | Extend filesystem | ||
- | lvextend -l +100%FREE /dev/base/data | + | |
+ | |||
+ | | ||
+ | |||
+ | Check that the filesystem is ok, **but only if the FS is unmounted** | ||
+ | |||
+ | fsck.ext4 -f /dev/base | ||
Now resize the filesystem | Now resize the filesystem | ||
- | | + | Debian System: |
+ | |||
+ | | ||
+ | |||
+ | Centos/ | ||
+ | resize4fs -p / | ||
===== For swap ===== | ===== For swap ===== | ||
Line 129: | Line 198: | ||
Check if filesystems are ok, and only then release the snapshot | Check if filesystems are ok, and only then release the snapshot | ||
+ | |||
+ | Fix issue with swap | ||
+ | |||
+ | * swapoff: /dev/dm-1: swapoff failed: Cannot allocate memory | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | < | ||
Line 153: | Line 230: | ||
Hier legen wir jetzt alle unsere logischen Volumes an. Als Namen verwenden wir, etwas fantasielos, | Hier legen wir jetzt alle unsere logischen Volumes an. Als Namen verwenden wir, etwas fantasielos, | ||
- | | + | lvcreate -l +100%FREE -n lvol1 vg01 |
+ | |||
+ | oder wir könne die Größen angeben! (1500M) | ||
+ | |||
+ | lvcreate -L 1500M -n lvol1 vg01 | ||
Filesysteme anlegen | Filesysteme anlegen | ||
Line 165: | Line 246: | ||
Damit die neuen Filesysteme nun bei jedem Systemstart automatisch gemountet werden, müssen wir sie in die Datei /etc/fstab eintragen (siehe 'man fstab' | Damit die neuen Filesysteme nun bei jedem Systemstart automatisch gemountet werden, müssen wir sie in die Datei /etc/fstab eintragen (siehe 'man fstab' | ||
- | / | + | / |
+ | |||
+ | ===== Links ===== | ||
- | http://www.linuxhaven.de/dlhp/HOWTO-test/DE-LVM-HOWTO-2.html | + | [[http://www.thegeekstuff.com/2010/08/how-to-create-lvm/|How To Create LVM Using vgcreate, lvcreate, and lvextend lvm2 Commands]]\\ |
+ | [[https:// | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | [[http:// | ||
+ | [[https:// | ||
+ | http:// | ||
+ | http:// |
/data/www/wiki.inf.unibz.it/data/attic/tech/documentation/procedures/vm/vm_disk_expansion_lvm_xfs.1329127248.txt.gz · Last modified: 2019/01/16 10:03 (external edit)