virsh – resize partition (smaller, decrease)

virsh - resize partition (smaller, decrease)

#on the vm itself
boot the gparted live image iso and resize your partitions

gparted live – default settings
enter
enter
enter

link: http://gparted.org/download.php
deeplink: http://downloads.sourceforge.net/gparted/gparted-live-0.27.0-1-amd64.iso

decrease the / partition and recreate the swap partition with the new size (512mb – half of the 1024mb ram) that it is behind the new /

virsh - resize partition (smaller, decrease)

virsh - resize partition (smaller, decrease)

#on the vm host (convert it directly in the ram – 10gb image, 16gb ram is ok)

#if you want to do it on the harddrive and not in the ram: qemu-img convert -O raw Monitoring.qcow2 monitoring.raw
mkdir /tmp/tmpfs
mount -t tmpfs none /tmp/tmpfs

qemu-img convert -O raw wlancontroller.qcow2 /tmp/tmpfs/wlancontroller.raw
qemu-img resize /tmp/tmpfs/wlancontroller.raw -1600M

qemu-img convert -O qcow2 /tmp/tmpfs/wlancontroller.raw wlancontroller.qcow2

umount /tmp/tmpfs

#boot the vm

#irgnore the „a start job is running“ – we fix the swap now

#look for the swap partition
lsblk
# sda1 is / and sda2 is swap

root@wlancontroller:~# ls -la /dev/disk/by-uuid/
insgesamt 0
drwxr-xr-x 2 root root 100 Jan 25 21:27 .
drwxr-xr-x 5 root root 100 Jan 25 21:27 ..
lrwxrwxrwx 1 root root 9 Jan 25 21:27 2016-10-20-08-47-11-00 -> ../../sr0
lrwxrwxrwx 1 root root 10 Jan 25 21:27 598dd041-2423-40cd-a2d8-afd360f4fb2e -> ../../sda2
lrwxrwxrwx 1 root root 10 Jan 25 21:27 779e3d7c-5aae-41f4-a802-629bb21872e5 -> ../../sda1

#replace the old swap uuid with the new one

nano /etc/fstab
UUID=598dd041-2423-40cd-a2d8-afd360f4fb2e none swap sw 0 0

reboot

Now the partition decreased from 9,6Gb to 8,4Gb.

  •  
  •  
  •  
  •  

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.