Hello Mailing List!
A quick question. Has anyone gotten a resize (in my case grown) a Xen DomU disk image?
Here is the procedure I have followed:
1. Install a DomU using virt-install Customize xvda to be all one partition ext3 2. On Dom0: dd if=/dev/zero bs=1G count=1 >> <my_disk_image> ll -h (Image is now 1GB larger) xm create <DomU> On DomU: df -h (Size has not changed) shutdown -h now On Dom0: e2fsck -f <my_disk_image> (Errors Bad Magic...) resize2fs -f <my_disk_image> (Errors Bad Magic...) xm create <DomU> On DomU: df -h (Still reports old size)
I am assuming that because resize2fs didn't run that the DomU doesn't know about the additional space.
Thanks in advance!
On Dec 19, 2007 7:26 PM, Matthew Lind mlind@nhctc.edu wrote:
Hello Mailing List!
A quick question. Has anyone gotten a resize (in my case grown) a Xen DomU disk image?
Here is the procedure I have followed:
- Install a DomU using virt-install Customize xvda to be all one partition ext3
- On Dom0: dd if=/dev/zero bs=1G count=1 >> <my_disk_image> ll -h (Image is now 1GB larger) xm create <DomU> On DomU: df -h (Size has not changed) shutdown -h now On Dom0:
e2fsck works only on device, but yuo can creat a loop device using losetup
someting like
losetup -f <my_disk_image>
now you can mount, e2fsck or resize /dev/loop0
e2fsck -f <my_disk_image> (Errors Bad Magic...) resize2fs -f <my_disk_image> (Errors Bad Magic...)
then delete the loop device
losetup -d /dev/loop0
regards
xm create <DomU> On DomU: df -h (Still reports old size)
I am assuming that because resize2fs didn't run that the DomU doesn't know about the additional space.
Thanks in advance! _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Alain Spineux wrote:
On Dec 19, 2007 7:26 PM, Matthew Lind mlind@nhctc.edu wrote:
Hello Mailing List!
A quick question. Has anyone gotten a resize (in my case grown) a Xen DomU disk image?
Here is the procedure I have followed:
- Install a DomU using virt-install Customize xvda to be all one partition ext3
- On Dom0: dd if=/dev/zero bs=1G count=1 >> <my_disk_image> ll -h (Image is now 1GB larger) xm create <DomU> On DomU: df -h (Size has not changed) shutdown -h now On Dom0:
e2fsck works only on device, but yuo can creat a loop device using losetup
someting like
losetup -f <my_disk_image>
now you can mount, e2fsck or resize /dev/loop0
It appears as though the disk image was partitioned within the domU (the OP is speaking of xvda and not xvda1), so I don't think that is going to work either. I think you need to use "xm block-attach". Something like:
modprobe xenblk xm block-attach 0 'file:/path/to/image/file' xvda w
This will create two new device files /dev/xvda (the hole disk) and /dev/xvda1 (the only partition on this disk).
You can now use any partition editor you want to expand the first partition on /dev/xvda.
For example: (s)fdisk to expand the partition, "e2fsck -f /dev/xvda1" to check for errors (required to run resize2fs), then "resize2fs /dev/xvda1" to resize to fill the expanded partition.
When you are done, use "xm block-detach" to release the virtual disk.
The xm man page is very helpful for accessing domU disk images on dom0.
Cheers, Michael
On Dec 19, 2007 8:51 PM, Michael D. Kralka michael.kralka@kvs.com wrote:
Alain Spineux wrote:
On Dec 19, 2007 7:26 PM, Matthew Lind mlind@nhctc.edu wrote:
Hello Mailing List!
A quick question. Has anyone gotten a resize (in my case grown) a Xen DomU disk image?
Here is the procedure I have followed:
- Install a DomU using virt-install Customize xvda to be all one partition ext3
- On Dom0: dd if=/dev/zero bs=1G count=1 >> <my_disk_image> ll -h (Image is now 1GB larger) xm create <DomU> On DomU: df -h (Size has not changed) shutdown -h now On Dom0:
e2fsck works only on device, but yuo can creat a loop device using losetup
someting like
losetup -f <my_disk_image>
now you can mount, e2fsck or resize /dev/loop0
It appears as though the disk image was partitioned within the domU (the
Then some sample, still using losetup :-)
[root@dell360 ~]# losetup -f /data/fc6-eg-disk0.img [root@dell360 ~]# kpartx -l /dev/loop0 loop0p1 : 0 208782 /dev/loop0 63 loop0p2 : 0 16032870 /dev/loop0 208845 loop0p3 : 0 530145 /dev/loop0 16241715 [root@dell360 ~]# kpartx -av /dev/loop0 add map loop0p1 : 0 208782 linear /dev/loop0 63 add map loop0p2 : 0 16032870 linear /dev/loop0 208845 add map loop0p3 : 0 530145 linear /dev/loop0 16241715 [root@dell360 ~]# e2fsck -f /dev/mapper/loop0p1 e2fsck 1.39 (29-May-2006) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /boot: 47/26104 files (17.0% non-contiguous), 24433/104388 blocks [root@dell360 ~]# kpartx -d /dev/loop0 [root@dell360 ~]# losetup -d /dev/loop0
OP is speaking of xvda and not xvda1), so I don't think that is going to work either. I think you need to use "xm block-attach". Something like:
modprobe xenblk xm block-attach 0 'file:/path/to/image/file' xvda w
This will create two new device files /dev/xvda (the hole disk) and /dev/xvda1 (the only partition on this disk).
You can now use any partition editor you want to expand the first partition on /dev/xvda.
For example: (s)fdisk to expand the partition, "e2fsck -f /dev/xvda1" to check for errors (required to run resize2fs), then "resize2fs /dev/xvda1" to resize to fill the expanded partition.
When you are done, use "xm block-detach" to release the virtual disk.
The xm man page is very helpful for accessing domU disk images on dom0.
Cheers, Michael
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Thanks!
That work beautifully! (xm block-attach/detach)
I guess I should commit more of the man pages to memory!
Thanks again!
Thanks for the reply. However, when I performed a:
losetup -fv <my_disk_image>
I still received the following error: e2fsck 1.39 (29-May-2006) Couldn't find ext2 superblock, trying backup blocks... e2fsck: Bad magic number in super-block while trying to open /dev/loop0
The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 filesystem (and not swap or ufs or something else), then the superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>
And here is the output from resize2fs: resize2fs 1.39 (29-May-2006) resize2fs: Bad magic number in super-block while trying to open /dev/loop0 Couldn't find valid filesystem superblock.
Thanks again!