LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 06-18-2010, 10:01 AM   #1
brianpbarnes
Member
 
Registered: Dec 2005
Posts: 143

Rep: Reputation: 15
Gunzip truncates dd.gz file to zero size .dd file? Trailing garbage ignored?


Hi,
I am using DD to backup entire system partitions and now I am trying to restore one. The resulting disk image from my buggy process has zero bytes. D'oh!

I wrote a Perl script to write zeros to unused space on the partition and then piped the dd output to gzip to reduce the size. Here's part of the log file:
Cmd "cd /mnt/sda2.u904.sys; /bin/dd if=/dev/zero of=zero.file bs=1000000 count=26951" -> 4.683 minutes.
Cmd "ls -l /mnt/sda2.u904.sys/zero.file; df | grep /mnt/sda2.u904.sys" -> -rw-r--r-- 1 root root 26951000000 2010-06-17 18:46 /mnt/sda2.u904.sys/zero.file
/dev/sda2 41286828 37829520 1360028 97% /mnt/sda2.u904.sys

So, it looks like I have successfully loaded the partition up to 97% full by zeroing free space. Then I just remove the file.

Here's the part which I suspect is buggy:
Cmd "/bin/dd if=/dev/sda2 conv=sync,noerror bs=64K | gzip --to-stdout > /tera/trex.sda2.u904.sys.20100617.dd.gz" -> 21.800 minutes.
Size of image "/tera/trex.sda2.u904.sys.20100617.dd.gz" = 7.891 E9 B.
Total elapsed time = 26.52 minutes.

26 minutes to read and compress 11 gigs of system data down to 8. Sounds reasonable.

Here's the bad part trying to restore an old .dd.gz file:
-rw-r--r-- 1 brianp vboxusers 6.3G 2010-05-04 10:06 /r5/trex.sda2.20100504.dd.gz
brianp@trex:/tera$ cp /r5/trex.sda2.20100504.dd.gz /tera/bak
brianp@trex:/tera$ gunzip bak/trex.sda2.20100504.dd.gz

gzip: bak/trex.sda2.20100504.dd.gz: decompression OK, trailing garbage ignored
brianp@trex:/tera$ cd bak
brianp@trex:/tera/bak$ ll *504*
-rw-r--r-- 1 brianp vboxusers 0 2010-05-04 10:06 trex.sda2.20100504.dd

It apparently thinks the image was trailing garbage and ignores it. It deletes the original file and replaces it with a zero byte .dd file.

I have the original copy of the image in a dd.gz file. It's 6.3 GB so it may still contain the data.

How do I get the original image back without destroying it again?

Thank you,

BrianP
 
Old 06-29-2010, 05:09 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
IIGC the "decompression OK, trailing garbage ignored" diagnostic error message could mean gzip had problems with zero padding. What does 'gunzip -vl /tera/bak/trex.sda2.20100504.dd.gz' return? And 'gunzip -vt /tera/bak/trex.sda2.20100504.dd.gz'? (To keep the original use "-c" or "--stdout" with gunzip.) Does 'gunzip --verbose --decompress --to-stdout /tera/bak/trex.sda2.20100504.dd.gz > /tera/bak/trex.sda2.20100504.dd' leave you with at least a partial image? Else would you be able to use any other compressed archiving method?
 
  


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
[SOLVED] gunzip: [file] has more than one entry -- unchanged checkmate3001 Linux - Software 7 09-06-2023 07:22 AM
How to Gunzip a File and then execute tar it in one command networkingnub Programming 2 01-15-2010 03:56 PM
[SOLVED] LPSTAT -- truncates file name... :( DennisC31 AIX 0 01-12-2009 09:48 AM
tar errors: "trailing garbage igored, child returned status 2 etc.) davidstvz Linux - Newbie 9 08-23-2008 10:11 AM
How to install a .gz file after using gunzip lel800 Linux - Newbie 6 10-10-2003 08:16 PM

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

All times are GMT -5. The time now is 11:20 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