Server Fault is a question and answer site for system and network administrators. 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
dd if=/dev/sda of=/dev/sdb

I want to create a clone a bootable USB stick.

lets say sda is 2GB sdb is 32GB.

The above line will create a replica but the usable size will be 2GB. How can I use the remaining 30GB? (resize partition or modify the command so that it will maximize the usable space)

share|improve this question
up vote 4 down vote accepted

UPDATE: When you copy the drive instead of the partition, the partition-table gets overwritten and it might not be possible to make the partion bigger afterwards because the partition-table says that the disksize is only 2GB. On the other hand, if you copy only the data of the partition, the bootloader will break. You might want to have a different filesystem (e.g. ext3 instead of fat32), then dd won't work and you have to use cp.

ArchLinux wiki has an excellent tutorial for this.

Now you have to reinstall grub2 bootloader to your disks mbr (not the partition): tutorial

If you're still having problems, this might help: link

share|improve this answer

If you're using dd to make and apply your disk image, you will then need to use a partition management tool like gparted to expand the partition after it has been applied to the larger destination disk.

share|improve this answer
thats what I thought but I was hoping for a linux trick that would do both in 1 step. Thanks – Cocoa Dev Apr 19 '12 at 19:30
dd doesn't know anything about filesystems and partitions. You'll need a tool that knows something about those things to manipulate them. – cjc Apr 19 '12 at 19:33
@CocoaDev IF you write zeros to empty space before cloning with dd, you can then compress the dd file rather nicely. – Wesley Apr 19 '12 at 19:33
You could use gparted to close the disk and resize, and skip the dd step. – Zoredache Apr 19 '12 at 19:46
If you want to do this all from a script, you can - but you'll need to know what filesystem is on sda. Then you can use the right tool - extresize, ntfsresize, etc. – NathanG Apr 19 '12 at 19:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.