[fedora] dd

Aaron Konstam akonstam at sbcglobal.net
Sun Sep 4 13:53:21 UTC 2011


On Sun, 2011-09-04 at 15:49 +0800, xinyou yan wrote:
> 2011/9/4 Aaron Konstam <akonstam at sbcglobal.net>:
> > On Sat, 2011-09-03 at 22:08 +0800, xinyou yan wrote:
> >> 2011/9/3 Chris Tyler <chris at tylers.info>:
> >> > On Sat, 2011-09-03 at 20:36 +0800, xinyou yan wrote:
> >> >> I want to make sure one thing .
> >> >> Can I use tar to pack the file created by dd.
> >> >> I found use           tar -rf xx.tar yyy.dd
> >> >> can't make the file into the tar file .
> >> >
> >> > It depends on what is in the dd file and what you're trying to do.
> >> >
> >> > I assume that the dd file is a direct copy of a filesystem (for example,
> >> > "dd if=/dev/sda2 of=yyy.dd" assuming that /dev/sda2 is a filesystem
> >> > partition).
> >> >
> >> > If you simply want to reduce the size of the dd file, use gzip:
> >> >  gzip yyy.dd # produces yyy.dd.gz
> >> >
> >>
> >> I want it be compressed by gzip,
> >> and the gzip files to a archive file (such as tar file)
> >> Howerver gzip file can't be add to a tar file  (-r)
> >>
> >> > If you want to create a tar archive of the individual files within the
> >> > dd image, you will have to mount the dd file first using the loopback
> >> > option:
> >> >  mkdir /tmp/yyy
> >> >  mount -o loop yyy.dd /tmp/yyy
> >> >  cd /tmp
> >> >  tar cvf xx.tar yyy
> >>
> >> That's mean tar must taring a regular file or directory .
> >> I wonder .  why must tar  the yyy (directory)
> >>
> >> you mean mount to a directory , and tar the directory ?
> >>
> >>
> >> What I want 's just a archive file that contain some sigle dd files .
> >>
> >> thank you .
> >>
> >> You mail help me understand more
> >>
> > I am not sure what you want to do,, but if you have a gziped tar file
> > and you  want to add another file to it this should work:
> > If your archive is archive.tgz
> > Uncompress archive: gunzip archive.tgz
> > Add a another file : tar -rf archive.tar second_file
> > Compress the archive: gzip archive.tar
> 
> Yes it can achieve my work,
> However , I just can't undestand , tar -rf xx.tar yyy.dd to a regular
> file tar ( can 't  add the size)
> And When i tar -xf xx.tar. It will give a  error message : tar:
> Unexpected EOF in archive
> 
> > This will recreate a new archive.gz file with the second file added.
> By the way ,it will take many times to do it.
> 
> > and so on.
> >
> > This procesws could be automates by a bash script.
I am not sure what the problem is.
The following works for me:
tar cf archive.tar first
tar -rf archive.tar second

This produces a file that when one runs:
tar xf archive.tar 
produces the files first and second in the directory.

And as I said is that the complexity of the process can be reduced by
creating a shell script with the new file name as the argument and
resulting in the archive.



-- 
=======================================================================
The most hopelessly stupid man is he who is not aware that he is wise.
=======================================================================
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam at sbcglobal.net



More information about the users mailing list