Linux – Clone Flash Drive in Linux using DD

clonecopyddlinuxUbuntu

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)

Best Answer

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