LinuxQuestions.org
Visit Jeremy's Blog.
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 12-02-2016, 10:22 AM   #1
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,065
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
Cloning SSD vs HDD with DD


A while ago, I had bought a laptop that came with Windows 8, and a 500GB HDD. I immediately used dd to backup the drive, and compressed the image with gunzip. The resulting file is around 31GB.

I later bought a laptop that came with Windows 10, and a 256GB SSD. Again, I immediately cloned the drive using dd and gunzip. The resulting file is 230GB.

I haven't run Windows at all prior to backing up the drives. I would assume other than the OS and preinstalled software, the rest of the storage should be free (all zeros). I was expecting the SSD image to compress down to about the same size as the HDD image.

Maybe I will have to mount the SSD image and fill it with zeros and try to compress it again?
 
Old 12-02-2016, 10:32 AM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,893

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339
I suggest that you use rsync for the backups instead of dd.

---------------------
Steve Stites
 
Old 12-02-2016, 10:40 AM   #3
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,065

Original Poster
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
I cloned the entire disk, so if for some reason I need to restore it, it would be easier to restore the entire image, rather than find an install disc, product key, etc...
 
Old 12-02-2016, 11:14 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,238
Blog Entries: 4

Rep: Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263
Microsoft is (understandably) quite thorough in their license testing, so you'd best not lose that product-key. Ever ...
 
1 members found this post helpful.
Old 12-02-2016, 11:24 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,990

Rep: Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406
I assume that you cloned the entire drive that may have also included a recovery partition.

It is sometimes possible to create a DVD or more to return it.

Won't hurt to zero out the free space and see what happens. Try some other compression also but doubt you'll get real far.
 
Old 12-03-2016, 09:08 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,555

Rep: Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088Reputation: 2088
Note that zeroing the free space makes all those blocks appear to be "in use" to the drive's firmware. They will have to be re-blanked the next time they are written. Using dd to save and restore entire partitions is similarly a bad idea with an SSD. It depletes the the supply of free blocks.

Last edited by rknichols; 12-03-2016 at 09:10 AM.
 
Old 12-07-2016, 09:35 AM   #7
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,065

Original Poster
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
Right now the image of the SSD is stored on an HDD. I might mount it from there, zero out the free space and recompress. Maybe I'll just delete it since it's unlikely I'll need it for anything anytime soon.

(I did have to temporarily install windows on my other laptop just to update the bios, and wasted half a day trying to figure out why the installer wasn't cooperating.)
 
Old 12-07-2016, 09:50 AM   #8
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,854

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Have you tried using Clonezilla?

http://clonezilla.org/

Only used blocks are saved/restored resulting in a smaller image file. You can run it off their live-cd. Probably, the best cloning/imaging tool around.
 
Old 12-07-2016, 10:18 AM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,990

Rep: Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406
If you have a dd image of some drive, you can mount it by a number of ways to try to manipulate it and then return it to a file state.
 
Old 12-07-2016, 05:04 PM   #10
biosboy4
Member
 
Registered: Aug 2015
Distribution: *DEB, Centos, NXOS
Posts: 242

Rep: Reputation: 38
+1 for Clonezilla!
 
Old 12-15-2016, 11:00 PM   #11
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 664

Rep: Reputation: 190Reputation: 190
I'm not sure how you could have compressed 500GB to 31GB from your hdd as dd copies disks bit by bit, it does not care whether that space is "used" or not. For example, say you are currently using your 500GB hdd and want to move your install to your new 256GB ssd. Even if you are only using <256GB on your hdd, you can't dd your hdd to your ssd because it's trying to copy the entire 500GB.

Rsync is much better suited for backups.
 
Old 12-16-2016, 07:28 AM   #12
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 4,212

Rep: Reputation: Disabled
When you use dd you are copying every single block of that disk, used or not.

MS Windows used to let you make a back up installation dvd from a 'Genuine Windows' installation, & would only restore to that same disk because it had the disk ID in it.

MicroSoft are not a nice company!

You will need your licence numbers, minimal, to install to a different hard drive, if they let you.
I would suggest you just remove the 'Windows' drive & store it away, if you think you may want to use it again, (in the same machine).

Last edited by fatmac; 12-16-2016 at 07:29 AM.
 
Old 12-16-2016, 05:11 PM   #13
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,065

Original Poster
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Originally Posted by The EzekielProject View Post
I'm not sure how you could have compressed 500GB to 31GB from your hdd as dd copies disks bit by bit, it does not care whether that space is "used" or not. For example, say you are currently using your 500GB hdd and want to move your install to your new 256GB ssd. Even if you are only using <256GB on your hdd, you can't dd your hdd to your ssd because it's trying to copy the entire 500GB.

Rsync is much better suited for backups.
I'm aware I would need to restore it to the same size or larger drive, and of the same type due to SSDs and HDDs having different sector alignment.

I used dd to back up the drive, then used gunzip to compress. My understanding is that the un-used space should be highly compressable. And that seems to be the case for the HDD.
Code:
$ zcat Lenovo_Yoga2-11.img.gz | wc -c
500107862016

$ du -b Lenovo_Yoga2-11.img.gz
32691222915 Lenovo_Yoga2-11.img.gz

But not the case for the SSD backup.
Code:
$ zcat Lenovo_TP-Yoga-14.img.gz | wc -c
256060514304

du -b Lenovo_TP-Yoga-14.img.gz
247301586217 Lenovo_TP-Yoga-14.img.gz

Last edited by replica9000; 12-16-2016 at 10:16 PM.
 
Old 12-16-2016, 08:08 PM   #14
jefro
Moderator
 
Registered: Mar 2008
Posts: 20,990

Rep: Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406Reputation: 3406
Mount the image and zero out free space the same way you would a mechanical hard drive.
 
  


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
Install Linux in Toshiba u940 series with 32gb ssd and 750gb hdd I would like to have boot code in ssd only cvkchary Linux - Laptop and Netbook 4 08-31-2016 04:26 PM
Cloning HDD install to SSD Condemn Slackware 1 02-14-2014 07:58 AM
[SOLVED] SSD cloning quick question lpallard Linux - Hardware 13 02-22-2011 06:22 PM
cloning mixed Linux - Win xp on new SSD for laptop trentfox Linux - Hardware 3 02-09-2010 07:46 PM
[SOLVED] Using both SSD/HDD for partitioning or is it better to just get external HDD? Switch7 Linux - Hardware 16 10-26-2009 12:23 PM

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

All times are GMT -5. The time now is 04:52 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
Open Source Consulting | Domain Registration