Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
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.
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.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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
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?
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.