LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 11-21-2008, 04:47 AM   #1
banz
LQ Newbie
 
Registered: Aug 2004
Posts: 15

Rep: Reputation: 0
Using dd and gzip to create hard drive image but image is bigger than hard drive?


What we are trying to accomplish is to migrate 20 windows 2000 machines to new hardware and also to take an image of the machine on the old hardware and the new hardware.

We are using an unbuntu live CD to boot up the machine. The hard drive itself is about 4gb. Using the commands

dd if=/dev/sda | gzip > /mnt/landesk/f$/images/image.gz

This gzip compress it from 4gb to 1.2gb. We then restore this image to the new hardware using

gzip -dc /mnt/landesk/f$/images/image.gz | dd of=/dev/sda

It seems to work but due to the difference in hardware we have to run the windows repair to get it to work. It adds about 300mb to the total size of the disk.

We run df -h and it shows it's only used 4.8gb

bt ~ # df -h
Filesystem Size Used Avail Use% Mounted on
aufs 447M 7.8M 439M 2% /
/dev/sda1 38G 4.8G 33G 13% /mnt/sda1
//landesk2/f$ 1.3T 264G 1006G 21% /mnt/pcd


So now we need to take a new image of the working hardware using the same command
dd if=/dev/sda | gzip > /mnt/landesk/f$/images/image.gz
This time gzip gives us an error saying that the file size has exceeded. So we decided to split the file using

dd if=/dev/sda | gzip -c9 | split -b 2000m - /mnt/landesk/f$/images/image.gz

This completes with

78165360+0 records in
78165360+0 records out
40020664320 bytes (40 GB) copied, 9205.89 s, 4.3 MB/s

The total size of the image is about 11.5gb! Any idea why the size of the image is bigger than the hard drive? There isn't any other partition on the hard drive.
 
Old 11-21-2008, 09:52 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'm missing something - isn't the drive 40G?
Code:
40020664320 bytes (40 GB) copied, 9205.89 s, 4.3 MB/s
What does fdisk -l show?

Did you mean to do
Code:
dd if=/dev/sda1 | gzip -c9 | split -b 2000m - /mnt/landesk/f$/images/image.gz
?

Last edited by billymayday; 11-21-2008 at 09:55 PM.
 
Old 11-22-2008, 03:07 AM   #3
banz
LQ Newbie
 
Registered: Aug 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for your reply billymayday. The drive is 40gb, but only 4.8gb in data. So I thought when you gzip it, it should be less than 4gb in size?

Can't do fdisk -l at the moment as I'm not in at work today.

I used dd if=/dev/sda because it also takes an image of the MBR.

Correct me if I'm wrong, I have a feeling that the size of the image is big is because the drive is not clean? I didn't really wipe the drive before restoring the image on to the hard drive.

After writing 0 to the drive, restoring the image, reimaging the drive again. The size seems to be right again! It's only 1.3gb after gzip.

I'm going to have to do more testing when I get into work in Monday.
 
Old 11-22-2008, 04:25 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'd guess that is right. if the drive was all zeros, and only 4.8G, I think you'd be correct. it probably isn't.
 
1 members found this post helpful.
  


Reply



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
Hard drive image question JAKK Linux - Newbie 3 01-02-2007 09:57 PM
hard drive failing, how can I create an image of my drive? oily_rags SUSE / openSUSE 6 07-07-2005 02:19 PM
Hard Drive Image ...H2H pacer Linux - Software 1 12-14-2004 03:23 PM
Image a hard drive burton Linux - Software 2 04-08-2004 11:15 PM
Hard drive image bkmesenbrink Linux - Newbie 7 06-21-2003 10:45 AM

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

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