Page 1 of 1

cloning live USB stick?

Posted: Tue Jun 21, 2016 9:56 am
by fraxinus_63
I feel I should know the answer to this straightforward question - but I am not sure actually, so I will ask.

I have Linux Mint 17 as a live USB (with persistence) on a 8GB memory stick. It is working like a charm for me and has done so for months. But I'd like to copy this to create a couple more live memory sticks - not only because backup copies would be useful but also to let me experiment a bit with the install without risking losing my valuable live medium :-).

Please, what is the best method of doing this? Thanks in anticipation for any help.

Re: cloning live USB stick?

Posted: Tue Jun 21, 2016 12:49 pm
by Laurent85
You can use clonezilla or ddrescue or simply dd:

Code: Select all

sudo umount /dev/sdc
sudo dd if=/dev/sdc of=flash-drive.img
Just replace /dev/sdc with you flash drive device id.

Re: cloning live USB stick?

Posted: Tue Jun 21, 2016 2:39 pm
by Minterator
Also you can use GParted to copy & paste one flash drive onto another one of equal or larger size.

Re: cloning live USB stick?

Posted: Wed Jun 22, 2016 9:34 am
by fraxinus_63
Thank you. I shall try!

Re: cloning live USB stick?

Posted: Sat Jun 25, 2016 3:12 am
by mintjelly
Laurent85 wrote:You can use clonezilla or ddrescue or simply dd:

Code: Select all

sudo umount /dev/sdc
sudo dd if=/dev/sdc of=flash-drive.img
Just replace /dev/sdc with you flash drive device id.
But this would not make a clone from which to boot. It would place a single file on the destination USB stick.

To clone, which the OP was interested in:

dd if=/dev/sdc of=/dev/sdd >>>this will would clone sdc to sdd

Re: cloning live USB stick?

Posted: Sat Jun 25, 2016 4:53 am
by Laurent85
mintjelly wrote: But this would not make a clone from which to boot. It would place a single file on the destination USB stick.
This command creates a disk image, the disk image file is then located in the working directory, not on the usb stick.

You can then use the disk image as the source to create a couple of clones. From file manager you can use the gui tool, right click the disk image and select in the context menu Open with > Disk Image writer.

Re: cloning live USB stick?

Posted: Mon Jun 27, 2016 8:25 am
by fraxinus_63
Thanks for your advice, everyone. I am trying to clone my live Mint USB stick at /dev/sdc onto an empty stick at /dev/sdd using dd - but I get the following.

Code: Select all

dd if=/dev/sdc of=/dev/sdd
dd: opening `/dev/sdc': Permission denied
If I go

Code: Select all

sudo dd if=/dev/sdc of=/dev/sdd
then the terminal simply hangs - nothing happens.

Sorry to be naive, but what am I missing here?

Re: cloning live USB stick?

Posted: Mon Jun 27, 2016 8:54 am
by MajorMuff
Consider that the terminal may not hang at all, it simply takes a while to clone a device at which point you might not actually see the progress it's making.

Re: cloning live USB stick?

Posted: Mon Jun 27, 2016 9:14 am
by Mute Ant
You can get some minor visual feedback by running the top command in another console and watching your dd working.

You can get some minor audio feedback by putting an AM radio receiver close to the receiving device...sqweee-dit-sqweee-dit-dit-sqweeeee.

You can get a decent speed-and-progress report by inserting a pv between the reading and the writing parts. You may need to install the pv package. The "sudo su" is to let you use your normal login password instead of logging in as root.

Code: Select all

sudo su -c 'dd if=/dev/sdX | pv > /dev/sdY'
I tried this using a self-to-self just out of monkey curiosity. You don't need sudo to read or write /dev/zero...

Code: Select all

dd if=/dev/zero | pv > /dev/zero
7.17GB 0:00:15 [ 502MB/s] [ <=> ]
...ooo that's fast.

Re: cloning live USB stick?

Posted: Mon Jun 27, 2016 10:35 am
by administrollaattori
There is a graphical application for dd also.
https://launchpad.net/gdiskdump

Re: cloning live USB stick?

Posted: Tue Jun 28, 2016 5:15 am
by fraxinus_63
Very many thanks all of you for your advice. I used dd, and have ended up with a flash drive that is superficially a perfect replica of my original but quickly ends up with kernel panic as I try to boot from it.

Code: Select all

drm_kms_helper: panic occurred, switching back to text console.
Is there any way I can try to fix or repair this new flashdrive using GParted or similar? if not, I'll simply try another method ...

Re: cloning live USB stick?

Posted: Tue Jun 28, 2016 5:15 am
by fraxinus_63
MajorMuff wrote:Consider that the terminal may not hang at all, it simply takes a while to clone a device at which point you might not actually see the progress it's making.
Thanks - understood!