How do I make an image of my entire USB flash drive?

/dev/sdb is the entire USB disk, and /dev/sdb1 is a partition on the disk. If you want to image the entire disk, you want /dev/sdb.

That said, mounting as read-only isn't going to help you any in this case. You're bypassing the filesystem (which is where the read-only effect is) and working directly with the block device. So if you mix up i and o, you'll trash the disk anyway.

There isn't much benefit to dd here, you might just as well use cat:

sudo cat /dev/sdb > /somelargedisk/rawusbdrive

(Or pv for a nice progress display.)


The best way to back up a whole drive is via dd because you can control buffer size for block devices better than with cat. While the USB drive is not mounted, please run, as root:

  dd if=/dev/sdb bs=16M of=/somelargedisk/rawusbdrive

where /dev/sdb is your USB drive (check which one by using lsblk) and /somelargedisk/rawusbdrive is a path and filename you choose on a disk/partition with lots of space.

You can restore that backup by exchanging if and of arguments to dd.

Please note: dd can easily overwrite all your data beyond repair (with reasonable effort) if you get the parameters wrong!

This was first mentioned in my comment to your other question Best linux recovery tool for deleted files from USB flash drive?

Tags:

Usb