cloning live USB stick?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
fraxinus_63
Level 4
Level 4
Posts: 219
Joined: Fri Jan 01, 2010 2:25 pm

cloning live USB stick?

Post by fraxinus_63 » Tue Jun 21, 2016 9:56 am

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.

Laurent85
Level 15
Level 15
Posts: 5753
Joined: Tue May 26, 2015 10:11 am

Re: cloning live USB stick?

Post by Laurent85 » Tue Jun 21, 2016 12:49 pm

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.
Image

User avatar
Minterator
Level 5
Level 5
Posts: 596
Joined: Thu Jan 10, 2013 8:29 am

Re: cloning live USB stick?

Post by Minterator » Tue Jun 21, 2016 2:39 pm

Also you can use GParted to copy & paste one flash drive onto another one of equal or larger size.
Mint 17.3 MATE, kernel 4.11.12

fraxinus_63
Level 4
Level 4
Posts: 219
Joined: Fri Jan 01, 2010 2:25 pm

Re: cloning live USB stick?

Post by fraxinus_63 » Wed Jun 22, 2016 9:34 am

Thank you. I shall try!

mintjelly
Level 1
Level 1
Posts: 7
Joined: Fri Dec 18, 2015 6:01 am

Re: cloning live USB stick?

Post by mintjelly » Sat Jun 25, 2016 3:12 am

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

Laurent85
Level 15
Level 15
Posts: 5753
Joined: Tue May 26, 2015 10:11 am

Re: cloning live USB stick?

Post by Laurent85 » Sat Jun 25, 2016 4:53 am

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.
Image

fraxinus_63
Level 4
Level 4
Posts: 219
Joined: Fri Jan 01, 2010 2:25 pm

Re: cloning live USB stick?

Post by fraxinus_63 » Mon Jun 27, 2016 8:25 am

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?

User avatar
MajorMuff
Level 3
Level 3
Posts: 170
Joined: Thu Jun 23, 2016 4:41 am
Location: the Netherlands

Re: cloning live USB stick?

Post by MajorMuff » Mon Jun 27, 2016 8:54 am

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.
If it screams it isn't food yet.

Mute Ant
Level 13
Level 13
Posts: 4953
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: cloning live USB stick?

Post by Mute Ant » Mon Jun 27, 2016 9:14 am

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.
To lose one Death Star is unfortunate, to lose two is sheer carelessness.

User avatar
administrollaattori
Level 15
Level 15
Posts: 5676
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: cloning live USB stick?

Post by administrollaattori » Mon Jun 27, 2016 10:35 am

There is a graphical application for dd also.
https://launchpad.net/gdiskdump

fraxinus_63
Level 4
Level 4
Posts: 219
Joined: Fri Jan 01, 2010 2:25 pm

Re: cloning live USB stick?

Post by fraxinus_63 » Tue Jun 28, 2016 5:15 am

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 ...

fraxinus_63
Level 4
Level 4
Posts: 219
Joined: Fri Jan 01, 2010 2:25 pm

Re: cloning live USB stick?

Post by fraxinus_63 » Tue Jun 28, 2016 5:15 am

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!

Post Reply

Return to “Installation & Boot”