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
tech:documentation:procedures:vm:vm_disk_expansion_lvm_xfs [2014/03/14 14:25] – [FOR EXT3/4] kohofertech: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>CREATE SNAPSHOT</note> 
  
 Expand the original disk or add a second vdisk from **Infrastructure Client**.\\ Expand the original disk or add a second vdisk from **Infrastructure Client**.\\
-<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 If you are on a kernel newer or equal to 2.6.32 then you can issue the command
Line 26: Line 23:
 whereby after scsi_device you need to find the correct scsi device 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/number!
 +
 +  echo '1' > /sys/class/scsi_disk/32\:0\:1\:0/device/rescan
 +
 +IMPORTANT: Be sure to replace the 32\:0\:1\:0 with the appropriate disk for your purposes. 
  
  
Line 31: Line 38:
  
 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 /dev/sda or cfdisk /dev/sdb 
 + 
 + 
 +**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  /dev/data-www-vg/lvol-datawww 
 + 
 +next resize the file system 
 + 
 +  resize2fs -p /dev/data-www-vg/lvol-datawww 
 + 
 + 
 +If you get a error: 
 + 
 +<color #ed1c24>GPT PMBR size mismatch (2362232011 != 2516582399) will be corrected by w(rite).</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
Line 47: Line 85:
 in this example it's **base** in this example it's **base**
  
-  lvdisplay +  lvdisplay 
 + 
 +<code>
   --- Logical volume ---   --- Logical volume ---
   LV Name                /dev/base/root   LV Name                /dev/base/root
Line 103: Line 143:
   Read ahead sectors     0   Read ahead sectors     0
   Block device           254:3   Block device           254:3
 +</code>
  
 and we assume the new partition is /dev/sda3 and we assume the new partition is /dev/sda3
Line 141: Line 181:
 Now resize the filesystem Now resize the filesystem
  
-  resize2fs -p /dev/base/root # for ext2 on rpm systems +Debian System:
-  resize2fs -p /dev/base/root # for ext4 on rpm systems+
  
 +  resize2fs -p /dev/base/root
 +
 +Centos/Fedora System:
 +
 +  resize4fs -p /dev/base/root
  
 ===== For swap ===== ===== For swap =====
Line 154: 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://unix.stackexchange.com/questions/321675/unable-to-swapoff-but-enough-physical-memory-is-available/472012|Swapoff Cannot Allocate Memory]]
 +
 +<del>[[https://leizhilong.github.io/blog/2018-11-12-case-study-swapoff-cannot-allocate-memory/|Swapoff Cannot Allocate Memory]]</del>
  
  
Line 196: Line 248:
    /dev/vg01/lvol1 /usr ext4 defaults 1 2    /dev/vg01/lvol1 /usr ext4 defaults 1 2
  
-http://www.linuxhaven.de/dlhp/HOWTO-test/DE-LVM-HOWTO-2.html+===== Links ===== 
 + 
 + 
 +[[http://www.thegeekstuff.com/2010/08/how-to-create-lvm/|How To Create LVM Using vgcreate, lvcreate, and lvextend lvm2 Commands]]\\ 
 +[[https://unix.stackexchange.com/questions/47380/where-does-lvm-store-data|Where does LVM store data?]]\\ 
 +[[http://www.howtoforge.com/linux_lvm|A Beginner's Guide To LVM]]\\ 
 +[[http://wiki.gentoo.org/wiki/LVM#LV_.28Logical_Volume.29|LVM]] VERY GOOD SOURCE!\\ 
 +[[http://www.funtoo.org/LVM_Fun#Physical_volumes_creation|LVM Fun]] VERY GOOD SOURCE!\\ 
 +[[http://serverfault.com/questions/223361/how-to-recover-logical-volume-deleted-with-lvremove|How to recover logical volume deleted with lvremove]]\\ 
 +[[http://www.novell.com/support/kb/doc.php?id=3803380|LVM Volume Group Shows "unknown device"]] 
 + 
 +[[https://www.tutorialspoint.com/unix_commands/pvresize.htm|pvresize - Unix, Linux Command]]
  
 +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/ http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/
/data/www/wiki.inf.unibz.it/data/attic/tech/documentation/procedures/vm/vm_disk_expansion_lvm_xfs.1394803556.txt.gz · Last modified: 2019/01/16 10:03 (external edit)