WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] resize xen disk file

On Thu, Mar 6, 2008 at 4:16 PM, Rudi Ahlers <Rudi@xxxxxxxxxxx> wrote:
> Martin Fernandez wrote:
>  > I resized the file disk using:
>  > dd if=/dev/zero of=*image* bs=1M conv=notrunc count=1 seek=10240
>  Can someone please explain to me what this command does? I also want to

'dd' copies 'count' blocks of size 'bs' from 'if' to 'of', first
advancing (from start) 'seek' blocks.

in this case, it advances to 10G (10240*1M), and writes 1M of zeroes.
if the image file was smaller than that, it would grow.

>  And is it safe to resize an VM image while it's running?

sure.  to the VM it's simply that the block device won't complain for
access to blocks that it wasn't accessing anyway.

example:
- you have a 5G image file, put an ext3 filesystem on it.  mkfs checks
the device size once and does the ondisk structures so that you won't
try to access beyond the end of the device when using the filesystem.

- start VM:
    - checks device size, shows it in /proc/partitions
    - mounts fs, uses it to access, never writes beyond 5G

- in Dom0 you grow it to 10G.  now if you wrote to the device at the
7G point, it could work, but the kernel still beleives it's just 5G,
so it would fail before trying.

- in VM do a partscan.  /proc/partitions is updated, now it shows 10G
and if you wrote to the 7G point it would work; but the filesystem
still is 5G

- in VM do a resizefs, this is the part that really affects upper
layers, but there's lots of experience in doing it well, and these
days most filesystems can do it online. (at least ReiserFS, ext3, XFS)

the only 'scary' thing is updating all layers in the *correct* order.
in this example, the image file directly contains the ext3 fs; but if
you have LVM, there are at least a couple more (PV and LV)

-- 
Javier

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>