LinuxQuestions.org
Review your favorite Linux distribution.
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 02-03-2013, 08:31 AM   #1
orsty9001
Member
 
Registered: Mar 2008
Distribution: Slackware, Mint, Raspbian
Posts: 94

Rep: Reputation: 1
Unable to pipe an image from dd into gzip on the fly.


I'm trying this.

Code:
dd if=/dev/sdc bs=2M | \ gzip -9 - > name-of-backup.img.gz
I get this strange error.

Code:
Command 'gzip' is available in '/bin/gzip' command not found
If I take an image of the drive I'm trying to backup without piping it into gzip it works as expected and I'm able to then gzip the image file to compress it. So dd and gzip are there and working. I'm just not sure if my command is incorret or what. I submit to someone with more experiance than myself.
 
Old 02-03-2013, 09:05 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
Why the backslash in front of gzip? The output you're getting indicates that the shell somehow interprets this as a "whereis" command. That's not what I'm getting in a bash shell (it tries to find the " gzip" command instead and fails), but your system may use a different shell/version/configuration.

I don't think the gzip "-" switch is required, as gzip will default to getting data from stdin when no file is specified, but it shouldn't cause any problems either.

In other words,
Code:
dd if=/dev/sdc bs=2M | gzip -9 > name-of-backup.img.gz
ought to work.
 
1 members found this post helpful.
Old 02-03-2013, 06:42 PM   #3
orsty9001
Member
 
Registered: Mar 2008
Distribution: Slackware, Mint, Raspbian
Posts: 94

Original Poster
Rep: Reputation: 1
Thanks that worked a treat.

I was under the impression for some reason a "\" would indicate to the shell that the command is not yet complete and more text will follow. But apparently it just confuses everything and everybody and just flat out doesn't work.
 
Old 02-03-2013, 07:00 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Close but no cigar
Quote:
a "\" would indicate to the shell that the command is not yet complete and more text will follow ...
'... on the next line (!)

It enables you to break long cmds onto multiple lines. Actual length of line is irrelevant (up to a system specified limit).
 
  


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
Using 'dd' and 'gzip' to create a disk image. Restoring image: can't find lvm_root. skiman1979 Linux - Desktop 2 02-25-2012 05:42 AM
upgrade/change on the fly cramfs rootfs image crazy kernel Linux - Embedded & Single-board computer 0 08-10-2010 09:46 AM
how to do a tar extract | create pipe on the fly? jjalocha Linux - General 5 12-29-2007 08:50 PM
Mount a Gzip image zael Programming 1 06-04-2004 03:17 PM

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

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