I have a disk image, it's a "whole" disk image, e.g., contains multiple partitions, and I want to clone just one of them (not the first one..) onto a partition on an external drive with multiple partitions on it (I'm also not cloning it onto the first partition of the disk...)
FDisk'ing the image gives this:
# fdisk -l 2013-02-09-wheezy-raspbian.img Disk 2013-02-09-wheezy-raspbian.img: 1939 MB, 1939865600 bytes 255 heads, 63 sectors/track, 235 cylinders, total 3788800 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00014d34 Device Boot Start End Blocks Id System 2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA) 2013-02-09-wheezy-raspbian.img2 122880 3788799 1832960 83 Linux #
and the block device looks like this:
# fdisk -l /dev/sdc Disk /dev/sdc: 8014 MB, 8014266368 bytes 247 heads, 62 sectors/track, 1022 cylinders, total 15652864 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdc1 2048 131071 64512 e W95 FAT16 (LBA) /dev/sdc2 131072 15652863 7760896 83 Linux #
I want the second partition of the image to replace the second partition of the block device. Don't worry about the trailing corrupted free space, I'll use GParted to clean that up, and I need it for something else anyway.