0

I have a USB stick who's contents (including partition table) I want to duplicate onto another, larger USB stick. Right now, I have to dd the entirety of a 16 GB stick onto a 128 GB stick and then extend the final partition on the 128 GB stick.

Let's call the original stick /dev/sdba and the new stick /dev/sdbb.

# Read image off old stick
dd bs=4M if=/dev/sda of=some.img conv=fsync

# Compress
gzip some.img

# Very slow transfer of some.img over the network

# Decompress
gzip --decompress some.img.gz

# Write image onto new, larger stick
dd bs=4M if=some.img of=/dev/sdb conv=fsync

# Extend partitions, following prompts of gparted
gparted
p
Fix
p

How do I avoid having to copy all the dead space of the original USB stick?

tarabyte
  • 274
  • 1
  • 4
  • 14
  • 2
    Does this answer your question? ["Re-size" the .img for smaller SD-card. How to SHRINK a bootable SD card image](https://askubuntu.com/questions/1174487/re-size-the-img-for-smaller-sd-card-how-to-shrink-a-bootable-sd-card-image) – mook765 Apr 08 '20 at 17:12
  • [Clonezilla](https://clonezilla.org) is a cloning tool, that is smart enough to copy only the used blocks in file systems and skip free blocks. It will also skip the content of swap partitions and unallocated space Clonezilla can be used both to clone from one drive to another drive and to create compressed images (a directory with a set of files. where the big files are compressed). – sudodus Apr 08 '20 at 19:35

0 Answers0