LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-11-2012, 02:05 PM   #1
Coolmax
LQ Newbie
 
Registered: Jul 2009
Location: Poland
Distribution: openSUSE, Debian
Posts: 15

Rep: Reputation: 0
Cloning hdd, usb stick etc.


I know that dd is great tool. I also tried dd_rescue, but none of them meet my needs. What I want is to clone my 4GB stick, but without saving zeros. Now, I have bootable distro on it. It's about 270 MB, so dd'ing 4GB is wasting time and space. Assume that fs is not fragmented - is there any way (option or other tools) to do that or only way is to truncate file? Thanks.
 
Old 07-11-2012, 02:17 PM   #2
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi Coolmax

well, I think you're looking for Clonezilla ?
 
Old 07-11-2012, 03:19 PM   #3
Coolmax
LQ Newbie
 
Registered: Jul 2009
Location: Poland
Distribution: openSUSE, Debian
Posts: 15

Original Poster
Rep: Reputation: 0
Clonezilla is very complex application. I want something small and simple.
 
Old 07-11-2012, 03:56 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,029

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
maybe using count to copy only the amount of blocks you want.

you will probably need to use gparted after each restore to expand the boundary of the partition to use the whole disk.
 
Old 07-11-2012, 05:35 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,406

Rep: Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207
dd will always copy every bit. The only slight way around it is to zip/compress the file. You have to first zero out the free space so that the compression will take huge chunks of disk space and compress it to the max.

Might see G4U. Basically an automated dd with compression.


lithos's suggestion of using clonezilla was a good choice. It is about as easy as it gets. It tends to use a file by file copy so the speed and size is optimum.
 
Old 07-11-2012, 06:00 PM   #6
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable, amd64
Posts: 805

Rep: Reputation: 32
what fs is it? if its FAT you could use something like norton ghost, that works on 'file level'. or just clone MBR and copy files.
and if its 'fully defragmented' meaning free space is contiguous, why don't you try cloning just the first 300Mb. and do fsck on clone afterwards?

I had been looking for dd which can skip zeroes on writing. (assuming new drive is already wiped) but couldn't find it. It should be easy to write one. but there must be some minimum number of continuous zeroes in a block, larger than physical block size (and that can be over 128Kb) otherwise its pointless or even contra-productive..
 
Old 07-12-2012, 07:42 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,406

Rep: Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207
You can't use dd to skip zero's. To sort of bypass that you use a compression program. The zero's still need to be read and still need to be written.

Clonezilla is always a file by file if it one of the file systems supported. Clonezilla supports like 10 types, all common linux and windows is supported. If the file system is not supported then clonezilla reverts to dd.
 
Old 07-13-2012, 02:15 AM   #8
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable, amd64
Posts: 805

Rep: Reputation: 32
not all zeros need to be written if the destination drive is already full of them.
 
Old 07-13-2012, 09:09 AM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,029

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
Quote:
Originally Posted by jefro View Post
You can't use dd to skip zero's. To sort of bypass that you use a compression program. The zero's still need to be read and still need to be written.
if you know that 0's start after 300 mb would something like this work:
Code:
dd if=/dev/sda of=sda.iso bs=1024 count=300
?


also this mite be useful:
http://www.linuxquestions.org/questi...1/#post4462030

Last edited by schneidz; 07-13-2012 at 09:13 AM. Reason: added link.
 
Old 07-13-2012, 12:15 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,406

Rep: Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207Reputation: 2207
All these ideas may or may not work. I have had clones to smaller disks that simply would not work as I couldn't get all the data to be forced below some point. I have tried to fool dd and sometimes it works, sometimes not. Just depends if you can fix the file system after that and the partition information. It comes back usually to bite you.

dd to some compression may take some amount of time I agree even on fast systems. Other ways to clone exist. Most folks would consider a file based copy to save time.

Last edited by jefro; 07-13-2012 at 12:17 PM.
 
Old 07-14-2012, 09:59 AM   #11
Coolmax
LQ Newbie
 
Registered: Jul 2009
Location: Poland
Distribution: openSUSE, Debian
Posts: 15

Original Poster
Rep: Reputation: 0
so, after reading, I think clonezilla will be good choice. Eventually, copy files by hand + save MBR.
 
  


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
dd hdd cloning question bloodyscript Linux - Newbie 4 03-09-2012 12:51 PM
hdd cloning fareedreg Linux - Newbie 8 05-17-2011 09:49 AM
(Advanced) Booting Ubuntu installed on HDD from encrypted USB stick or similar i00 Ubuntu 2 03-27-2011 10:18 AM
[SOLVED] cloning using clonezilla on HDD raju.muppana Linux - Newbie 2 08-02-2010 08:18 AM
Cloning USB stick question Packrat1947 Linux - Newbie 7 12-05-2009 07:11 AM


All times are GMT -5. The time now is 06:59 PM.

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