A question about burning USB stick

Amedee Van Gasse amedee-ubuntu at amedee.be
Tue Jan 11 12:05:00 UTC 2011


On Fri, January 7, 2011 13:58, Colin Law wrote:
> Hi
> I have an image that I wish to burn to a USB stick using dd.  When I
> insert the stick it is mounted (it already has valid partitions on it)
> and
> sudo fdisk -l
> shows that it is mounted as sdb.  The command I am going to use to burn it
> is
> sudo dd if=myfile.bin of=/dev/sdb bs=10M
> but it does not seem right to burn it while it is mounted.  However if
> I eject it then it is no longer /dev/sdb and the dd command fails.
>
> So the first question is, is it correct just to go ahead and run dd
> with the stick mounted?
>
> Once the burn is complete then there is a similar question, should I
> 'eject' it before unplugging it?  The reason I ask is that I am
> concerned that the system may be confused about whether it is
> unmounting and ejecting the original image or the one I have
> re-written.

I do this all the time!
I have written a blog post (in Dutch) about it:
http://amedee.be/kleine-full-disk-backup-dd

In short:

* Open 3 terminals
* In terminal 1: 'watch di -h' (di is an improved version of df, you might
have to 'aptitude install di' first)
* terminal 2: 'watch dmesg'
* plug in the usb stick, you will see it appear in di and dmesg
* close all Nautilus windows that may have opened when you plugged in the
stick
* in terminal 3: 'sudo umount /dev/sdb1' (assuming that the stick was
/dev/sdb1, di and dmesg will have told you the exact partition name)
* in terminal 3: 'sudo dd if=myfile.bin of=/dev/sdb bs=10M'
* Here comes the magic: type 'sync && sync && sync'. The sync command
forces all cached data to be written to disk immediately. Once is enough,
but I execute it 3 times in a row, just to be extra paranoid ;)





More information about the ubuntu-users mailing list