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?

.



Relevant Pages

  • Re: dd command question
    ... You want a utility like 'tar' or 'cpio' that puts ... tar -cf somefile.tar dir1/dir2 ... To extract from the archives: ... I am fairly sure that when applied to a while disk, or disk pair, that as long as they are the same physical size and construction, a complete bootable image and entire system can be stamped on the new disk. ...
    (comp.os.linux.misc)
  • Re: dd command question
    ... can I create image files based on dir? ... You want a utility like 'tar' or 'cpio' that puts ... tar -cf somefile.tar dir1/dir2 ... To extract from the archives: ...
    (comp.os.linux.misc)
  • RE: mismatch_cnt, random bitflips, silent corruption(?), mdadm/sw raid[156]
    ... been combined into tar files and then encrypted with gpg, ... tar: Unexpected EOF in archive ... gzipped tar archives, but I gzip the individual files, rather than the tarball. ...
    (Linux-Kernel)
  • Re: cvs commit: src/usr.bin/tar Makefile bsdtar.1 bsdtar.c bsdtar.h bsdtar_platform.h matching.c rea
    ... the last official spec for tar. ... extensions even when not absolutely required. ... format won't use SUSv3 extensions just to store atime/ctime ... and some cpio archives. ...
    (freebsd-current)
  • SUMMARY: Resuming tar restore
    ... the option suggested on the tar man page to ... extract archives based no regular expressions is a no-brainer. ... it should work nicely with disk archives. ... command and the restore was interrupted. ...
    (SunManagers)