Hi,
I want to expand /dev/sda5 so that it takes the remaining space in
/dev/sda. But virt-resize does not work. Does anybody know how to make
it work? Thanks.
$ sudo virt-filesystems --long -h --all -a saiph.qcow2
Name Type VFS Label MBR Size Parent
/dev/sda1 filesystem ext2 - - 243M -
/dev/sda2 filesystem unknown - - 1.0K -
/dev/mintaka-vg/root filesystem ext4 - - 7.8G -
/dev/mintaka-vg/root lv - - - 7.8G /dev/mintaka-vg
/dev/mintaka-vg vg - - - 7.8G /dev/sda5
/dev/sda5 pv - - - 7.8G -
/dev/sda1 partition - - 83 243M /dev/sda
/dev/sda2 partition - - 05 1.0K /dev/sda
/dev/sda5 partition - - 8e 7.8G /dev/sda
/dev/sda device - - - 50G -
$ sudo virt-filesystems --long -h --all -a saiph_expand.qcow2
Name Type VFS Label MBR Size Parent
/dev/sda1 filesystem ext2 - - 243M -
/dev/sda2 filesystem unknown - - 1.0K -
/dev/mintaka-vg/root filesystem ext4 - - 7.8G -
/dev/mintaka-vg/root lv - - - 7.8G /dev/mintaka-vg
/dev/mintaka-vg vg - - - 7.8G /dev/sda5
/dev/sda5 pv - - - 7.8G -
/dev/sda1 partition - - 83 243M /dev/sda
/dev/sda2 partition - - 05 1.0K /dev/sda
/dev/sda5 partition - - 8e 7.8G /dev/sda
/dev/sda device - - - 50G -
$ sudo virt-resize -d --expand /dev/sda5 saiph.qcow2 saiph_expand.qcow2
command line: virt-resize -d --expand /dev/sda5 saiph.qcow2 saiph_expand.qcow2
Examining saiph.qcow2 ...
libguestfs: trace: add_drive "saiph.qcow2" "readonly:true"
libguestfs: trace: add_drive = 0
libguestfs: trace: add_drive "saiph_expand.qcow2" "readonly:false"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: launch = 0
libguestfs: trace: lvm_set_filter "/dev/sda"
libguestfs: trace: lvm_set_filter = 0
libguestfs: trace: feature_available "ntfsprogs ntfs3g"
libguestfs: trace: feature_available = 1
libguestfs: trace: feature_available "btrfs"
libguestfs: trace: feature_available = 1
libguestfs: trace: blockdev_getss "/dev/sdb"
libguestfs: trace: blockdev_getss = 512
libguestfs: trace: blockdev_getsize64 "/dev/sda"
libguestfs: trace: blockdev_getsize64 = 53687091200
libguestfs: trace: blockdev_getsize64 "/dev/sdb"
libguestfs: trace: blockdev_getsize64 = 53687091200
libguestfs: trace: part_get_parttype "/dev/sda"
libguestfs: trace: part_get_parttype = "msdos"
saiph.qcow2 size 53687091200 bytes
saiph_expand.qcow2 size 53687091200 bytes
partition table type: msdos
libguestfs: trace: pvs_full
libguestfs: trace: pvs_full = <struct guestfs_lvm_pv_list *>
libguestfs: trace: part_list "/dev/sda"
libguestfs: trace: part_list = <struct guestfs_partition_list *>
libguestfs: trace: part_get_bootable "/dev/sda" 1
libguestfs: trace: part_get_bootable = 1
libguestfs: trace: part_get_mbr_id "/dev/sda" 1
libguestfs: trace: part_get_mbr_id = 131
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext2"
libguestfs: trace: mount_ro "/dev/sda1" "/"
libguestfs: trace: mount_ro = 0
libguestfs: trace: statvfs "/"
libguestfs: trace: statvfs = <struct guestfs_statvfs *>
libguestfs: trace: part_get_bootable "/dev/sda" 2
libguestfs: trace: part_get_bootable = 0
libguestfs: trace: part_get_mbr_id "/dev/sda" 2
libguestfs: trace: part_get_mbr_id = 5
libguestfs: trace: lvs
libguestfs: trace: lvs = ["/dev/mintaka-vg/root"]
libguestfs: trace: vfs_type "/dev/mintaka-vg/root"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: mount_ro "/dev/mintaka-vg/root" "/"
libguestfs: trace: mount_ro = 0
libguestfs: trace: statvfs "/"
libguestfs: trace: statvfs = <struct guestfs_statvfs *>
2 partitions found
/dev/sda1:
partition data: 1 1048576-255852543 (254803968 bytes)
bootable: true
partition ID: 0x83
content: filesystem ext2 (246755328 bytes)
/dev/sda2:
partition data: 2 256900096-8588886015 (8331985920 bytes)
bootable: false
partition ID: 0x5
content: extended partition
1 logical volumes found
/dev/mintaka-vg/root:
content: filesystem ext4 (8130584576 bytes)
calculate surplus: outsize=53687091200 required=8586789888
overhead=2326528 surplus=45097974784
libguestfs: trace: canonical_device_name "/dev/sda5"
libguestfs: trace: canonical_device_name = "/dev/sda5"
surplus before --expand or --shrink: 45097974784
virt-resize: error: /dev/sda5: partition not found in the source disk
image (this error came from '--expand' option on the command line).
Try running this command: virt-filesystems --partitions --long -a
saiph.qcow2
If reporting bugs, run virt-resize with the '-d' option and include the
complete output.
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0
--
Regards,
Peng