Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a SanDisk Extreme SD card contaning my Homeserver runing on the RaspberryPI. I want to move this sytsem to another 4GB SD card using dd. But unfortunaltely when I make an image via dd it has the size of the entire SanDisk (16GB) althought just ca. 13.5 of them are partitioned. The Server SD consists of 2 partitions one small 50MB and a second 3 GB. I expected that dd makes an image of the size of the sum of the two partitions. Is there a way to make an image that contains just the really used disk space?

share|improve this question
Purely as background information: Dd will not make an image of the size of the sum of the two partitions because it has no idea that there are partitions. It is fed input data, it delivers output data. It does no interpretation at all. – Hennes Dec 22 '12 at 16:25
Does Raspbian come with the dump command? (Dump is used to make filesystem backups) – Hennes Dec 22 '12 at 16:27
No but thats not a problem. For the copy process I use my laptop with an Ubuntu live because of the card reader and the ability to unmount the drive. – ManuelSchneid3r Dec 22 '12 at 16:33
You don't state it anywhere, which makes me think that you may be trying to do this wrongly. You will want to first use fdisk to determine which partition it is that you want to image.. Then use dd to specify only that partition. For instance "dd if=/dev/sd1 of..." rather than "dd if=/dev/sda of..." – David Hoelzer Nov 13 '14 at 2:40
up vote 2 down vote accepted

If the SD card is (for example) sdb, don't ask dd to read sdb, you could ask it to copy just the partitions by specifying (for example) sdb1 or sdb2. You'll have to partition the target device with equal sized partitions first and specify those as the targets.

Unix/GNU-Linux systems have a variety of tools for copying data

  • dd
  • cpio
  • dump
  • tar

It can be worthwhile reading a bit about each of them (e.g. the man pages but I suggest googling for an overview)

Also, dd has a count option so you can tell it to copy the first 4GB only.

share|improve this answer
"You'll have to partition the target device with equal sized partitions first and specify those as the targets." I think this is a bit difficult. I tried copying the 16GB iso to the 4GB SD card with dd and it worked. Until now :D. I guess it worked because the remaining 12 GB had no useful information. – ManuelSchneid3r Dec 22 '12 at 19:36

Yes, and actually is very easy: you can use FSArchiver that, as clearly stated on its home-page: "...FSArchiver can extract an archive to a partition which is smaller that the original one as long as there is enough space to store the data..."

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .