You are not logged in.

#1 2009-06-06 12:55:27

poopship21
Member
Registered: 2009-05-13
Posts: 177

resize2fs fails; kvm-qemu; ext4; lvm2 [SOLVED]

the problem:
* a virtual machine (varch3) is created with kvm-qemu where /dev/sda on the guest is logical volume /dev/vg0/varch3 on the host with the following command:
     $ sudo /usr/local/kvm/bin/qemu-system-x86_64 /dev/vg0/varch3 -m 1024 -smp 2 -net nic,macaddr=00:16:3e:73:86:97 -net tap -nographic
* here are the partitions on the guest (primary partitions):
     $ df -h
     Filesystem            Size  Used Avail Use% Mounted on
     /dev/sda3             7.3G  1.4G  5.5G  21% /
     none                  501M     0  501M   0% /dev/shm
     /dev/sda1              38M  9.7M   27M  27% /boot
     /dev/sda4             2.4G  104M  2.2G   5% /home
* /home on varch3 is too small so /dev/vg0/varch3 is extended from 10G to 210G:
      $ sudo lvextend -L +200G /dev/vg0/varch3 /dev/sdc2
      $ sudo lvscan
      ...     
      ACTIVE            '/dev/vg0/varch3' [210.00 GB] contiguous
* it is expected that the guest will see a /dev/sda that is now 210G instead of 10G
* after logging into the guest, i unmounted /dev/sda4 and attempted to increase the size of this primary partition with resize2fs:
     $ sudo e2fsck /dev/sda4
     e2fsck 1.41.5 (23-Apr-2009)
     /dev/sda4: clean, 191/155648 files, 36355/622518 blocks
     $ sudo resize2fs -f /dev/sda4 200G
     resize2fs 1.41.5 (23-Apr-2009)
     Resizing the filesystem on /dev/sda4 to 52428800 (4k) blocks.
     resize2fs: Invalid argument while trying to resize /dev/sda4
* in an attempt to understand this cryptic result i ran cfdisk on /dev/sda4:

                                                                                                                                                           cfdisk (util-linux-ng 2.14.2)

                                                                                                                                                                Disk Drive: /dev/sda
                                                                                                                                                         Size: 225485783040 bytes, 225.4 GB
                                                                                                                                               Heads: 255   Sectors per Track: 63   Cylinders: 27413

                 Name                                               Flags                                             Part Type                                  FS Type                                                              [Label]                                                      Size (MB)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                 sda1                                               Boot, NC                                           Primary                                   Linux ext2                                                                                                                            41.13                                       
                 sda2                                                                                                         Primary                                   Linux swap / Solaris                                                                                                                 271.44
                 sda3                                                                                                         Primary                                   Linux ext3                                                                                                                          7871.60
                 sda4                                                                                                         Primary                                   Linux ext3                                                                                                                          2549.84
                                                                                                                                                                                  Unusable                                                                                                                          214745.62



the questions:
* how is it possible that the space on /dev/sda4 is known AND unusable?
* what do i need to do to get a larger /home on varch3?

TIA

Last edited by poopship21 (2009-08-03 21:15:53)

Offline

#2 2009-08-03 21:11:32

poopship21
Member
Registered: 2009-05-13
Posts: 177

Re: resize2fs fails; kvm-qemu; ext4; lvm2 [SOLVED]

for some reason, the MBR can hold up to four primary partitions and zero extended partitions or up to three primary partitions and an arbitrary number of extended partitions.  i dont know exactly why this is the case but i can accept it and go on with my life.  intuitively, the space which is not part of the existing primary partitions could be made into another partition since cfdisk must be able to see the beginning and ending blocks, and therefore every block in between in order to know the size of the unused space.  i guess that the four-partition maximum is just a convention which reflects the limitations of legacy systems.

Last edited by poopship21 (2009-08-03 21:15:41)

Offline

Board footer

Powered by FluxBB