resize the virtual disk image?

por | 12 marzo, 2008


This solution is to increase your virtual disk size: 

cd /var/lib/xen/images/vlinux1

#use dd to create a 1 GB file

dd if=/dev/zero of=Tempfile bs=1024 count=1000000

#append this file to virtual image file (in this case is hda)

cat Tmpfile >> hda 

resize2fs -f hda

 ——————  este es como vmware que te da espacio pero no lo utiliza hasta que se grabe ————————


dd if=/dev/zero of=<image file> count=1 seek=200G

Using seek in this way will cause a sparse file to be created and should give
you a virtual disk with an apparent size of around 200GB.  Because it’s
sparse, the extra space will only be allocated from the host disk as the
guest writes to it.  That can make things more space efficient but remember
that space *must* be available for the virtual disk to grow into.

If the host runs out of space for the guest’s disk to grow into then the guest
will experience filesystem corruption and data loss.

If you want to pre-allocate the file rather than making it sparse, then your
second solution with cat >> (having created a large non-sparse file of zeros
using dd to really write the data, instead of using seek) should work, I

Remember that resizing the disk in this way will not work while the guest is
running (and you should *never ever* run any utilities against a FS from
outside the guest whilst it has that FS mounted – that would be guaranteed to
fry your filesystem).  Suspending the guest is not enough, it needs to have
the filesystems unmounted fully or be properly shut down.

You can use the -s flag to ls (e.g. do ls -sl) to view the real disk usage as
well as the logical size.  For a sparse file, the real disk usage may be
lower than the logical size; the logical size may be larger than the disk
actually has room for.