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

Javier Guerra wrote:
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.
Thanx :)

What does the "conv=notrunc" mean? And does / will it simply append the extra blocks to the existing ones? Or how does it know where to put it?
 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)

This helps quite a lot. Do I understand correctly that there's no point in setting up a LVM on the VM then?

So, to safely resize the current VM's space, I do the following:

xm save vm01
xm destroy vm01

Then I increase the image

dd if=/dev/zero of=/home/vm/vm01.im bs=1M conv=notrunc count=1 seek=30720

after that I need to run partscan? I don't see such a command on the VM, what 
is it part of?

After I install partscan, then how do I use it?

Then, I need to run resize2fs, what is the correct syntax?

This is the current VM's output
root@vps01 [~]# df -H
Filesystem             Size   Used  Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      9.8G   6.6G   2.7G  71% /
/dev/xvda1             104M    20M    79M  21% /boot
tmpfs                  537M      0   537M   0% /dev/shm
/usr/tmpDSK            508M    42M   441M   9% /tmp




--

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other 
technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg


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

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