I have taken a complete image of a hard drive using:
dd if=/dev/sda of=/home/user/harddriveimg bs=4M
It would seem to me, that I should be able to re-size the partitions within it after suitably mounting it.
As I am less than familiar with the command line parted, I tried:
gparted /home/user/harddriveimg
While this loaded the partition table, it couldn't find the partitions themselves, e.g. harddriveimg0.
Is it possible to modify an image file like this, without writing it back to some disk, and if so how? I would be perfectly happy with a solution that uses only terminal commands.
partx
only works with real disks, because it uses the kernel-based partition detection magic whereaskpartx
uses device-mapper, a generic and more powerful mechanism for creating block devices in the kernel.kpartx
does not use the kernel for partition table detection, but it does inform the kernel about them so it requires a partionable device, such as a loop device.