LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-31-2020, 11:13 AM   #1
theblindhog
LQ Newbie
 
Registered: Mar 2009
Posts: 10

Rep: Reputation: 0
Using DD to clone USB


I've recently had the urge to try Linux again.
The option to run a persistent USB is especially attractive.

I've installed (via MKUSB) and updated, ugraded, added programs, etc
to a 64gb Sandisk.

My next project was to clone this one so as to have same customized setup used on two or three laptops. So far I've been unable to accomplish this, seemingly simple, operation. When the three hour process finishes it says "no space left on device". 945409+0 records in, 945408+0 records out. I even went so far as to pick up another, another brand specific, Sandisk stick, after two failures on PNY drives.

Any suggestions? Better to image ILO clone (which is how I backup Windoze) ?

Regards,
Stan
 
Old 01-31-2020, 12:51 PM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,448

Rep: Reputation: Disabled
I think, when making a persistent pendrive it is better to use the distro tools to put it onto another pendrive, rather than using dd.

Lots of pendrives of the exact same size & make will be different sizes in actual fact, just the way it goes.
 
Old 01-31-2020, 02:49 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,628

Rep: Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052
This live to usb with persistence is a common windows file system and the files are what make up the changes. One file is the original live media and there should be a casper-rw file that has the changes you made. Just copy the casper file.

You are using dd wrong by the way. I assume you are trying to dd back to the same boot drive.

side note
The live to usb tends to be faster than a real install to usb because the image is compressed.
 
Old 02-01-2020, 09:53 AM   #4
theblindhog
LQ Newbie
 
Registered: Mar 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jefro View Post
This live to usb with persistence is a common windows file system and the files are what make up the changes. One file is the original live media and there should be a casper-rw file that has the changes you made. Just copy the casper file.

You are using dd wrong by the way. I assume you are trying to dd back to the same boot drive.

side note
The live to usb tends to be faster than a real install to usb because the image is compressed.

Hmmm, I thought I was doing it correctly. I first booted a live CD, then DD if=/dev/sdb of=/dev/sdc (sdb being the previously made and customized drive I want to clone; sdc the target).

What is the correct way?
 
Old 02-03-2020, 03:47 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,628

Rep: Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052
I think we are still using a tool that has limits. That is the long way around. dd works best if one has exact hardware. Things like bootable flipbit may affect flash drives.

If you had two identical usb flash drive then you should not end up with the space problem.
 
Old 02-04-2020, 08:39 AM   #6
masterclassic
Member
 
Registered: Jun 2007
Distribution: Knoppix
Posts: 172

Rep: Reputation: 40
You could try to use a block size of 1 MiB.
Since 10-15 years it is usual to use 1 MiB segments for the partition alignment, because it is better adapted to the modern hardware, compared to the legacy "cylinder" concept.
You can check the partition details of your source stick to verify that they are MiB-aligned.
 
Old 02-04-2020, 09:24 AM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,531
Blog Entries: 13

Rep: Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822
I'm simple and I fully recommend using dd to make a copy, if you're using dd to make a copy of the system as it is operating, I feel you'll potentially have problems. No guarantees either way.
Code:
$ sudo dd if=<source drive, mouned as data, not operating from> of=<target drive> BS=1024M
That should be fine and not take forever.
 
Old 02-04-2020, 02:44 PM   #8
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 2,708

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
@theblindhog

As @rtmistler said. Don't try and image a mounted file system. Especially one that you are running dd on.

You need a working linux install if you are going to do it from a linux box. Make an iso of the first (unmounted)stick
Code:
dd if=/dev/sdb1 of=MyImage.iso bs=1M
You can then make other sticks from that image. So long as the new stick is large enough for it.

If the new stick is smaller.
If there is any free space on the file system of the iso, then mount the iso loop, use losetup to edit it, or copy the contents of the .iso to another directory. Then make a new iso from that directory.

Nothing wrong with dd at all. But make double sure the from and to. If you write an image from a usb drive to file then there isn't much danger in overwriting something.

If you are wanting to learn about resizing images, partitons, filesytems.

See:
man dd
man mount (loop)
man losetup
man mkisofs
man parted
man resize2fs

https://superuser.com/questions/6108...reated-with-dd
https://superuser.com/questions/1373...e-made-from-dd
https://softwarebakery.com/shrinking-images-on-linux
 
Old 02-04-2020, 03:12 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,628

Rep: Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052Reputation: 3052
If you created the flash drive with mkusb then consider using it to make backups. https://help.ubuntu.com/community/mkusb/persistent
 
Old 02-05-2020, 08:16 AM   #10
theblindhog
LQ Newbie
 
Registered: Mar 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks to all for the feedback; I'll continue to test.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone and boot from clone geelsu Linux - Server 5 12-17-2018 12:03 PM
LXer: Open-spec SBC is a clone of a clone of a clone of a Raspberry Pi 3 LXer Syndicated Linux News 0 04-25-2018 04:56 PM
Linux 64 bit fresh install, created clone on cd, want to use clone on another laptop... apollo1980 Linux - Software 12 10-12-2017 02:59 PM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
bugzilla: to clone, or not to clone? The00Dustin Linux - Newbie 1 05-24-2008 05:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration