User Tools

Site Tools


tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2012/02/14 14:15] – [FOR EXT3/4] kohofertech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2014/04/15 10:17] – [FOR EXT3/4] kohofer
Line 4: Line 4:
  
 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 a grow w/o reboot you have to add a second disk+<del>If you want to perform a grow w/o reboot you have to add a second disk.</del> 
 + 
 +If you are on a kernel newer or equal to 2.6.32 then you can issue the command 
 + 
 +<code>echo "1" > /sys/block/sdX/device/rescan</code> 
 + 
 +to get the new size w/o reboot. 
 + 
 + 
 +In case you cant see the "disk" do this: 
 + 
 +  echo "- - -" > /sys/class/scsi_host/host0/scan 
 +   
 +Do this for all host0,1,2 etc. 
 + 
 + 
 +or 
 + 
 +  echo "1" > /sys/class/scsi_device/2\:0\:0\:0/device/rescan 
 + 
 +whereby after scsi_device you need to find the correct scsi device 
 + 
  
 **EXPAND ORIGINAL DISK** **EXPAND ORIGINAL DISK**
Line 12: Line 34:
  
   cfdisk /dev/sda   cfdisk /dev/sda
 +
 # 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 /dev/sda3 of type 8e (Linux LVM)
  
 # make disk visible to linux # make disk visible to linux
Line 20: Line 43:
   partprobe   partprobe
   pvcreate /dev/sda3   pvcreate /dev/sda3
- 
  
 now you have to extend the volgroup. use ''lvdisplay'' to see which is the name of the group,\\ now you have to extend the volgroup. use ''lvdisplay'' to see which is the name of the group,\\
Line 107: Line 129:
 ===== FOR EXT3/4 ===== ===== FOR EXT3/4 =====
  
-Check that the filesystem is ok+Extend filesystem  to use all free space
  
-  fsck.ext4 /dev/root/root +  vgextend base /dev/sda3
-   +
- +
  
 +  lvextend -l +100%FREE /dev/base/root
  
-Extend filesystem  to use all free space+Check that the filesystem is ok, **but only if the FS is unmounted**
  
-  lvextend -l +100%FREE /dev/root/root+  fsck.ext4 -/dev/base
  
 Now resize the filesystem Now resize the filesystem
  
-  resize2fs -p /dev/root/root +  resize2fs -p /dev/base/root # for ext2 on rpm systems and deb systems 
 +  resize4fs -p /dev/base/root # for ext4 on rpm systems only!
  
 ===== For swap ===== ===== For swap =====
Line 156: Line 177:
 Hier legen wir jetzt alle unsere logischen Volumes an. Als Namen verwenden wir, etwas fantasielos, lvol1, lvol2 und lvol3. Dabei bedienen wir uns mit dem Plattenplatz auf Volume Group vg01, der einzigen Volume Group in diesem Beispiel. Es ist offensichtlich, dass wir hier nicht mehr Plattenplatz "verteilen" können, als wir bei vgcreate in die Volume Group "hineingesteckt" haben, und zwar in Form der beiden Partitionen hda3 und hdb2. (lvcreate -L<Grösse> -n <LogicalVolumeName> <Volume Group>). Hier legen wir jetzt alle unsere logischen Volumes an. Als Namen verwenden wir, etwas fantasielos, lvol1, lvol2 und lvol3. Dabei bedienen wir uns mit dem Plattenplatz auf Volume Group vg01, der einzigen Volume Group in diesem Beispiel. Es ist offensichtlich, dass wir hier nicht mehr Plattenplatz "verteilen" können, als wir bei vgcreate in die Volume Group "hineingesteckt" haben, und zwar in Form der beiden Partitionen hda3 und hdb2. (lvcreate -L<Grösse> -n <LogicalVolumeName> <Volume Group>).
  
-   lvcreate -L 1500M -n lvol1 vg01 +   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 168: Line 193:
 Damit die neuen Filesysteme nun bei jedem Systemstart automatisch gemountet werden, müssen wir sie in die Datei /etc/fstab eintragen (siehe 'man fstab'). In unserem Scenario sehen die zusätzlichen Einträge wie folgt aus: Damit die neuen Filesysteme nun bei jedem Systemstart automatisch gemountet werden, müssen wir sie in die Datei /etc/fstab eintragen (siehe 'man fstab'). In unserem Scenario sehen die zusätzlichen Einträge wie folgt aus:
  
-   /dev/vg01/lvol1 /usr ext2 defaults 1 2+   /dev/vg01/lvol1 /usr ext4 defaults 1 2
  
 http://www.linuxhaven.de/dlhp/HOWTO-test/DE-LVM-HOWTO-2.html http://www.linuxhaven.de/dlhp/HOWTO-test/DE-LVM-HOWTO-2.html
  
 +http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/
/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