Re: best way to backup USB stick (2)
On 04/13/2014 10:16 PM, Hugo Vanwoerkom wrote:
> So I got a script that backs up the USB stick to a file and restores a
> (larger) USB stick from that file all using dd. It is here:
That's small enough that you should have included it in the email, in my
> the relevant parts are the backup:
> dd conv=notrunc,noerror bs=4096 if=$usbDrive | gzip > $backupFilename
> and the restore:
> gzip -dc $backupFilename | dd of=$usbDrive
> Makes perfect copy AFAICT, but it does not boot and the original USB
> stick does. Completes w/o errors.
> Can any dd expert tell me what I am doing wrong?
Actually, the really relevant part is the variable definitions.
You're not backing up and restoring usb drives, you're backing up and
restoring a partition on usb drives. The partition table and bootloader
aren't handled by your script. No bootloader=no booting. :)
I'd suggest getting the whole device (/dev/sde) unless you're planning
to restore to a drive with other partitions you want to preserve.
Another suggestion: Look into ddrescue (package name is gddrescue).
It's more flexible when dealing with drives that have problems.