LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 03-28-2006, 04:03 AM   #106
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Post Make and Recombine Split Files with dd


Quote:
Originally Posted by nerdful1
Is there anyone out there?
repeat:So can you answer my question I asked at 5:34pm 2 days ago? how to use DD to recombine files split using dd and pipe to split. Not using cat. I am not looking for shortcuts. I want to learn all the proper dd stuff. thanks
clip from the past:So can you answer my question I asked at 5:34pm today? how to use DD to recombine files split using dd and pipe to split. Not using cat. I am not looking for shortcuts. I want to learn all the proper dd stuff. thanks
For real dd warriors, you can make split files and recombine them using dd.

You have a 30 GB partition and want to make (3) 10 GB files.

dd if=/dev/sourcepartition ibs=4k count=2.5M | gzip | of=/home/sam/file1.gz

dd if=/dev/sourcepartition ibs=4k count=2.5M skip=2.5M | gzip | of=/home/sam/file2.gz

dd if=/dev/sourcepartition ibs=4k count=2.5M skip=5M | gzip | of=/home/sam/file3.gz

Put them back into a partition:

dd if=/home/sam/file1.gz ibs=4k | gunzip | of=/dev/sourcepartition

dd if=/home/sam/file2.gz ibs=4k | gunzip | of=/dev/sourcepartition seek=2.5M

dd if=/home/sam/file3.gz ibs=4k | gunzip | of=/dev/sourcepartition seek=5M


This would not be a productive use of time. I wouldn't answer right away because this post is unimportant. Tar can do the same thing by itself, so why use dd? Jinkels is right. You can't use dd for everything.

Last edited by AwesomeMachine; 04-13-2006 at 03:16 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-28-2006, 11:46 AM   #107
nerdful1
LQ Newbie
 
Registered: Jun 2005
Location: greater Portland Maine
Posts: 14

Rep: Reputation: 0
thank you very much. It may not be efficient, but now I think I have a concept of the process.
If I have any more dd problems piping, I'll drop the pipe stuff and go manual as seems to be recommended to me. Sorry If I bothered anyone, but I am learning a lot.
 
Old 04-12-2006, 12:10 PM   #108
bugmenot60
Member
 
Registered: Mar 2006
Posts: 47

Rep: Reputation: 15
Quote:
Originally Posted by AwesomeMachine
dd if=/dev/sdb2 ibs=4096 | tar zc | of=/home/sam/partition.image.tar.gz conv=noerror
I tried the above command on my Linux box with Fedora Core 5,
and it didn't work.

The error I got was "tar: Cowardly refusing to create an empty archive."

Could somebody clue me in on what I am doing wrong?

I tried changing the "tar zc" to "tar -zc" and it still didn't work.

Thank you.
 
Old 04-12-2006, 05:17 PM   #109
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I think there is an error in the way tar is called.

tar MUST have a file spec of the files to archive. Stdin or stdout are only used for the archive file. You cannot use stdin as input for tar as a stream to archive. This means that you can write:
Code:
tar -zcf myarchive.tar *.c
to tar all your .c files into myarchive.tar, or alternatively:
Code:
tar -zc *.c
to get the tar file dumped on stdout.

However,
Code:
cat *.c | tar -zcf myarchive.tar
is not supposed to work as far as I know.

Which means that the example given by Awesome doesn't work. Awesome, could I be correct?

Besides, it is a waste of time to try and use dd in this way.

jlinkels
 
Old 04-12-2006, 07:22 PM   #110
bugmenot60
Member
 
Registered: Mar 2006
Posts: 47

Rep: Reputation: 15
Quote:
Originally Posted by jlinkels
Besides, it is a waste of time to try and use dd in this way.

jlinkels
What do you suggest then?

Fedora Core 5 doesn't have partimage installed by default.
 
Old 04-12-2006, 08:33 PM   #111
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
It depends what you want to achieve, because that is not completely clear to me.

If you want to make an image of your disk or of each partition, use dd. And forget about the tar.

If you want to make a backup of your disk, use tar.

If you insist of multi-volume, download and use star. This is a sort of extended tar, and very versatile and powerful. It can do multivolumes.

In the latter two cases, forget about dd.

Is FC so rigid that you cannot install parted if you really need that?

To Awesome: if you have the idea that your thread is hijacked, I cannot deny that it looks like that. Sorry, it is not my intention. If you think it is annoying, please ask a mod to split the thread.

jlinkels

Last edited by jlinkels; 04-12-2006 at 08:36 PM.
 
Old 04-13-2006, 12:45 PM   #112
bugmenot60
Member
 
Registered: Mar 2006
Posts: 47

Rep: Reputation: 15
I have a 10 gig partition with Windows in it, and I want to make an image of
that Windows partition without the image itself taking 10 gigs. I usually use
partimage on a Knoppix live CD to image the partition and compressed, it is
only a couple gigs.

If I use dd, then the image file will be 10 gigs and I am trying to avoid that.

I think Awesome's post uses "tar" just for compressing. Thanks for any help/
insight you can provide.

P.S. The reason why I need the image of the Windows partition is b/c I have
to keep restoring the damn thing due to Wind0ze's inherent instabilities and
problems.
 
Old 04-13-2006, 02:01 PM   #113
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I have not tested it extensively, but I would say:

dd if=/dev/sdb2 ibs=4096 | bzip2 -v > image.bz2

and the other way around:

bzip2 -v -c image.bz2 | dd of=/dev/sdb2

Be careful with the latter command, it wipes out your sdb2 partition. And I am not 100% certain that this is the right command as I did NOT test it for obvious reasons.

Further nice features of bzip2 in the man page.

jlinkels
 
Old 04-13-2006, 03:17 PM   #114
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
See my revised post

Quote:
Originally Posted by jlinkels
I think there is an error in the way tar is called.

tar MUST have a file spec of the files to archive. Stdin or stdout are only used for the archive file. You cannot use stdin as input for tar as a stream to archive. This means that you can write:
Code:
tar -zcf myarchive.tar *.c
to tar all your .c files into myarchive.tar, or alternatively:
Code:
tar -zc *.c
to get the tar file dumped on stdout.

However,
Code:
cat *.c | tar -zcf myarchive.tar
is not supposed to work as far as I know.

Which means that the example given by Awesome doesn't work. Awesome, could I be correct?

Besides, it is a waste of time to try and use dd in this way.

jlinkels
The tar command does not work between pipes, but gzip does. See revised post.
 
Old 04-13-2006, 08:10 PM   #115
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Awesome,

That is gonna work either. At the moment the output from dd hits the pipe, it is going into gzip. Gzip expects a gzip output file (or maybe another pipe), but it will not understand
... gzip | of=somefile.

I think you could pipe gzip output into another instance of dd like:
... gzip | dd of=somefile
(but what would be the use of that?)

or alternatively you could redirect gzip's output directpy to a file:
... gzip > somefile

jlinkels
 
Old 04-18-2006, 10:10 PM   #116
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I tried it. It works. I assumed tar would do the same thing, but tar won't work between pipes.
 
Old 04-19-2006, 02:37 AM   #117
kncharyulu
LQ Newbie
 
Registered: Apr 2006
Posts: 1

Rep: Reputation: 0
Very Good Article!!!!!!!!!
 
Old 04-25-2006, 02:46 AM   #118
gubak
Member
 
Registered: Jul 2004
Posts: 332

Rep: Reputation: 30
Linux clone problem

I cloned my linux HDD with dd command yesterday, but I have some problems.
My linux HDD has the following partitions:
Device Boot Start End Blocks ID System
/dev/hda1 * 1 13 10439 83 Linux
/dev/hda2 14 9954 79851082+ 83 Linux
/dev/hda3 9955 10011 457852+ 82 Linux swap

First I shuted down my linux os and connected a HDD with the same parameters as my linux HDD. After that I switched on the system. The new HDD became /dev/hdc. After that I type the command:
dd if=/dev/hda of=/dev/hdc
and a couple of hours later I get the message that copying is successfully completed (or something similar). After that my second HDD (/dev/hdc) had completely the same partitions as my primary HDD:

Device Boot Start End Blocks ID System
/dev/hdc1 * 1 13 10439 83 Linux
/dev/hdc2 14 9954 79851082+ 83 Linux
/dev/hdc3 9955 10011 457852+ 82 Linux swap

So I thinked that if I disconnected my primary (Linux) HDD, and I started machine with secondary HDD it would work, but unfortunately not. If I start machine with clone HDD, I get the command "Kernel panic".
Why?

Last edited by gubak; 10-04-2006 at 12:09 AM.
 
Old 04-27-2006, 02:03 AM   #119
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
There are so many possible reasons for this.

Quote:
Originally Posted by gubak
I cloned my linux HDD with dd command yesterday, but I have some problems.
My linux HDD has the following partitions:
Device Boot Start End Blocks ID System
/dev/hda1 * 1 13 10439 83 Linux
/dev/hda2 14 9954 79851082+ 83 Linux
/dev/hda3 9955 10011 457852+ 82 Linux swap

First I shuted down my linux os and connected a HDD with the same parameters as my linux HDD. After that I switched on the system. The new HDD became /dev/hdc. After that I type the command:
dd if=/dev/hda of=/dev/hdc
and a couple of hours later I get the message that copying is successfully completed (or something similar). After that my second HDD (/dev/hdc) had completely the same partitions as my primary HDD:

Device Boot Start End Blocks ID System
/dev/hdc1 * 1 13 10439 83 Linux
/dev/hdc2 14 9954 79851082+ 83 Linux
/dev/hdc3 9955 10011 457852+ 82 Linux swap

So I thinked that if I disconnected my primary (Linux) HDD, and I started machine with secondary HDD it would work, but unfortunately not. If I start machine with clone HDD, I get the command "Kernel panic".
Why?
I really can't say, from the tiny amount of information you have given, why this wouldn't work. I could give a whole bunch of different reasons, which would all fit the data given, but this would lead to confusion for other people reading the thread. What would be much better is for you to ask the question in a way that a definitive answer could be given. I do what you described all the time. I never have had a problem. The first thing I would look at is the partition table in the MBR. If the disks are different sizes, the geometry of the second disk is probably off. This would make the boot loader jump to the wrong place on the drive to find the kernel.
 
Old 04-30-2006, 11:14 AM   #120
harys
Member
 
Registered: Feb 2006
Posts: 33

Rep: Reputation: 15
dd and dvd film

hi, could you please tell me if it is possible to use dd with gnomebaker to burn a dvd film. if possible how do i process ? thanks. harys
 
  


Reply

Tags
backup, best, clonezilla, cloning, command, data, dd, disk, drive, duplicate, erase, explanation, formatting, ghost, hard, image, iso, memory, ping, popular, recover, recovery, rescue, search, security, stick, upgrade, usb, wipe



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
Learn The DD command AwesomeMachine Linux - Newbie 17 08-17-2006 04:22 AM
The best way to learn? iz3r Programming 7 02-06-2005 11:00 PM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 03:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 01:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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