Re: dd command question




Robert Nichols wrote:
In article <1148659450.760599.234810@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<pechoi@xxxxxxx> wrote:
:Ok, can I create image files based on dir? like files in dir1/dir2 and
:dir1/dir3 to each image. If so, is that possible to dd one after
:another without losing content?

dd just copies an indvidual file or device byte-for-byte. It knows
nothing about directory structures and is the wrong tool for what you
are trying to do. You want a utility like 'tar' or 'cpio' that puts
multiple files into an archive.

To create archive files containing, respectively, everything below
/dir1/dir2 and /dir1/dir3:

cd /
tar -cf somefile.tar dir1/dir2
tar -cf anotherfile.tar dir1/dir3

To list the contents of an archive:

tar -tvf somefile.tar

To extract from the archives:

cd /
tar -xf somefile.tar
tar -xf anotherfile.tar

The tar command (and cpio, for that matter) has enough options to keep
you busy trying things for quite a long time. The tar manpage is
pretty cursory; the info page is more complete.

--
Bob Nichols AT comcast.net I am "RNichols42"
Correct me if I am wrong. tar command will give different file
structure such as inode. I need to make 2 disks identical and prove it
somehow. That's why I was looking into dd (copying byte by byte)
command. Is there any other way to do it?

.