[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Error Resize Xen File Based



Hi,

On Sun, Jan 9, 2011 at 11:15 PM, Dominggo Smith <dominggosmith@xxxxxxxxx> wrote:
> Ervin, thanks for reply, here are the info:
>
> 1. The Dom-U using LVM (because CentOS by default using LVM)

The post you cited used a flat file to store an ext3 filesystem. If
you use LVM, you need to resize the logical volume first. Here is the
whole process for you - remember to have a backup before you start!

// create the image
[root@myhost ~]# dd if=/dev/zero bs=1M count=100 of=loop2.img
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.258392 s, 406 MB/s

// mount the image file as a loop device
[root@myhost ~]# losetup /dev/loop1 loop2.img
[root@myhost ~]# losetup -a
/dev/loop0: [ca01]:901130 (loop.img)
/dev/loop1: [ca01]:901132 (/root/loop2.img)

// turn the loop device into an LV with ext3
[root@myhost ~]# pvcreate /dev/loop1
  Physical volume "/dev/loop1" successfully created
[root@myhost ~]# vgcreate vg1 /dev/loop1
  Volume group "vg1" successfully created
[root@myhost ~]# lvcreate -n test1 -L +90M vg1
  Rounding up size to full physical extent 92.00 MiB
  Logical volume "test1" created
[root@myhost ~]# mkfs.ext3 /dev/mapper/vg1-test1

// deactivate the LV
[root@myhost ~]# vgchange -an vg1
  0 logical volume(s) in volume group "vg1" now active
[root@myhost ~]# losetup -d /dev/loop1
[root@myhost ~]#

// resizing the loop image
[root@myhost ~]# dd if=/dev/zero bs=30M count=2 >> loop2.img
2+0 records in
2+0 records out
62914560 bytes (63 MB) copied, 0.295842 s, 213 MB/s
[root@myhost ~]# losetup /dev/loop1 loop2.img
[root@myhost ~]# losetup -a
/dev/loop0: [ca01]:901130 (loop.img)
/dev/loop1: [ca01]:901132 (/root/loop2.img)
// the LV is still the same size
[root@myhost ~]# lvscan
  inactive          '/dev/vg1/test1' [92.00 MiB] inherit
[root@myhost ~]# pvresize /dev/loop1
  Physical volume "/dev/loop1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@myhost ~]# pvscan
  PV /dev/loop1   VG vg1   lvm2 [156.00 MiB / 64.00 MiB free]
  Total: 1 [156.00 MiB] / in use: 1 [156.00 MiB] / in no VG: 0 [0   ]
[root@myhost ~]# vgdisplay
  --- Volume group ---
  VG Name               vg1
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               156.00 MiB
  PE Size               4.00 MiB
  Total PE              39
  Alloc PE / Size       23 / 92.00 MiB
  Free  PE / Size       16 / 64.00 MiB
  VG UUID               KbZb6C-la25-w4V9-6dko-iEkF-WSt2-wCMM0Q

[root@myhost ~]# lvextend -L +30M /dev/vg1/test1
  Rounding up size to full physical extent 32.00 MiB
  Extending logical volume test1 to 124.00 MiB
  Logical volume test1 successfully resized

[root@myhost ~]# lvchange -ay /dev/vg1/test1
[root@myhost ~]# e2fsck -f /dev/vg1/test1
e2fsck 1.41.12 (17-May-2010)
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
/dev/vg1/test1: 11/23616 files (0.0% non-contiguous), 8652/94208 blocks
[root@myhost ~]# resize2fs /dev/vg1/test1
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vg1/test1 to 126976 (1k) blocks.
The filesystem on /dev/vg1/test1 is now 126976 blocks long.

[root@myhost ~]# mount /dev/vg1/test1 /mnt/
[root@myhost ~]# df -hP
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            9.9G  1.3G  8.5G  13% /
tmpfs                 299M     0  299M   0% /dev/shm
/dev/mapper/vg1-test1  121M  5.6M  109M   5% /mnt
[root@myhost ~]# umount /dev/vg1/test1
[root@myhost ~]# losetup -d /dev/vg1/test1
[root@myhost ~]#

> 2. I thnik test.img is ext3, how do I know exactly?
I prefer to use this command for it:

# blkid loop2.img -s TYPE -o value
LVM2_member

Hope this helps.

Ervin

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.