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

Re: Copy 2 partitions to .img file



On 06/12/12 15:14, Pertti Kosunen wrote:
On 6.12.2012 15:00, Hélder Pinheiro wrote:
I want to copy the content of both partitions into a .img file, in order
to be able to flash it on another 4GB memory card..
I tried with dd command, but I am only able to copy one partition each
time or the entire 16 GB.

dd if=/dev/sdb of=4GB.img bs=1M count=4k

Copies 4096 times 1 megabyte blocks.


For exact size image(?):

sudo fdisk -l /dev/sdd

Disk /dev/sdd: 7969 MB, 7969177600 bytes
246 heads, 62 sectors/track, 1020 cylinders, total 15564800 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: 0x000a8206

Device Boot Start End Blocks Id System
/dev/sdd1 2048 206847 102400 6 FAT16
/dev/sdd2 206848 13314047 6553600 83 Linux


dd if=[Input Device] of=[Output File] bs=[Sector size] count=[End of
last partition]
dd if=/dev/sdd of=8GB.img bs=512 count=13314047

That should be count=13314048 as the sector number starts at 0, so from sector 0 to sector 13314047 is 13314048 sectors. It will only be an issue if the last sector is used though.

--
Dom


Reply to: