[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: best way to backup USB stick (2)



PaulNM wrote:
On 04/13/2014 10:16 PM, Hugo Vanwoerkom wrote:
Hi,

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:

http://paste.debian.net/93598


That's small enough that you should have included it in the email, in my
opinion.

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.

Specifically: usbDrive=/dev/sde1

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.

Hugo



Another suggestion: Look into ddrescue (package name is gddrescue).
It's more flexible when dealing with drives that have problems.


Thanks.

Hugo


Reply to: