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

Re: Tools in Debian to create whole disk image (multiple partitions)?



On 22/07/12 02:05 PM, Andrei POPESCU wrote:
On Du, 22 iul 12, 17:38:58, Sthu Deus wrote:
Good time of the day, Andrei.

You worte:

Any suggestions?
Why don't You copy Your installation w/ "cp -a" and reconfiguring then
grub for the copy - to another disk (USB one?). OR I'm missing
something?
The Raspberry Pi can only boot from an SD card and the partition layout
matters (e.g. /boot needs to be primary, FAT32, bootable and probably
the first partition -- there is no bootloader like grub AFAICT).

# parted -l
Model: SD SD08G (sd/mmc)
Disk /dev/mmcblk0: 7948MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
  1      1049kB  79,7MB  78,6MB  primary  fat32           boot
  2      79,7MB  336MB   256MB   primary  linux-swap(v1)
  3      336MB   7947MB  7612MB  primary  ext4

The ext4 partition only holds about 630 MiB of data (Debian base install
+ SSH server). I want to create an image that I can:

  * reuse myself later (just dd to some SD card)
  * distribute to possibly not very knowledgeable people

Actually, I already have the image (with GNU ddrescue --sparse), but
it's about 5 times bigger than expected, which makes it difficult to
store and/or distribute :(

Hope this explains,
Andrei
So what you really need is a copy of the files on /boot and /. You don't need the swap space and you don't need the empty space in the main partition.

You can use fdisk to copy the partition information and a couple of cp -a or tar's to copy the other files. You could even use dd to copy the boot partition since it is pretty full. This could be put into a restore script where you just need to identify the SD destination card.

However, unless the SD card is the same size, the main partition won't fill the space.



Reply to: