📜 ⬆️ ⬇️

Resizing image files XEN Dom-U

In case you use image files from stacklet.com , everything is quite simple:
Turn off the car. Create an empty file of the desired size:

dd if=/dev/zero of=Tempfile bs=1M count=10010

add this file to the end of the image file, for example:

cat Tempfile >>ubuntu.9-10.x86.img

and resize the file system partition:
')
resize2fs -f ubuntu.9-10.x86.img

We start the car and that's it, we got a new partition size.
But if you yourself created a virtual or paravirtual machine.

And the image file contains several sections, for example:

/dev/sda1 /boot
/dev/sda2 swap
/dev/sda3 /


do this:
we stop the car, we create an empty file of the necessary size

dd if=/dev/zero of=zero.img bs=1M count=5000

add this file to the end of the image file

cat zero.img >>t2.img

then we screw the resulting file into the system and run fdisk

/sbin/losetup /dev/loop1 /vm/t2.img
fdisk /dev/loop1

() delete - delete our partition, in this case / dev / sda3
() add - add the partition / dev / sda3 with the same beginning, but the new size
save changes
disconnecting the image from the system

/sbin/losetup -d /dev/loop1

we start our virtual machine and already in it

resize2fs /dev/sda3

that's all.
A note of a practical nature, I was looking for info in my time, and if everything is without problems in the first variant, then in the second one should be careful not to lose info. Perhaps someone will be useful.

Source: https://habr.com/ru/post/87810/


All Articles