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 .
Can zip do this work ?
On 09/03/2011 08:36 AM, xinyou yan wrote:
I want to make sure one thing . Can I use tar to pack the file created by dd.
Yes.
I found use tar -rf xx.tar yyy.dd can't make the file into the tar file .
The -r switch is to "append" to an existing tar file. If the tar archive doesn't exist it should create the tar file anyway. What error are you getting? What's the size of yyy.dd?
Can zip do this work ?
Yes, you can use "zip' as an archiver (not just as a compressor) but I remember there were some size limitations a while ago (verify that).
HTH, Jorge
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
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
-Chris
2011/9/3 Chris Tyler chris@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
-Chris
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
On Sat, 2011-09-03 at 22:08 +0800, xinyou yan wrote:
2011/9/3 Chris Tyler chris@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 This will recreate a new archive.gz file with the second file added. and so on.
This procesws could be automates by a bash script.
2011/9/4 Aaron Konstam akonstam@sbcglobal.net:
On Sat, 2011-09-03 at 22:08 +0800, xinyou yan wrote:
2011/9/3 Chris Tyler chris@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.
--
Reality always seems harsher in the early morning.
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@sbcglobal.net
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
On Sun, 2011-09-04 at 15:49 +0800, xinyou yan wrote:
2011/9/4 Aaron Konstam akonstam@sbcglobal.net:
On Sat, 2011-09-03 at 22:08 +0800, xinyou yan wrote:
2011/9/3 Chris Tyler chris@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.
I am not sure what the problem is. The following works for me: tar cf archive.tar first tar -rf archive.tar second
Yes it can , But tar czf tar rzf can't work Second :
if I use gzip -c file1 >> yyy.test How can I unpress yyy.test to file1 as file1 I test like it gzip -c test1 > 1.test We can use
gunzip -c 1.test >test1
to achieve my answer . However : gzip -c test1 >> 1.test gzip -c test2 >> 1.test
I just gunzip -c 1.test > test1 (the size of test1 now is the sum test1 and test2 before)
How can i use gunzip to separate the two file ? I wonder >> can remember there are two file ?
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.
Yes I agree Thank you
--
The most hopelessly stupid man is he who is not aware that he is wise.
Aaron Konstam telephone: (210) 656-0355 e-mail: akonstam@sbcglobal.net
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
On 09/04/2011 10:53 AM, xinyou yan wrote:
I am not sure what the problem is. The following works for me: tar cf archive.tar first tar -rf archive.tar second
Yes it can , But tar czf tar rzf can't work Second :
For what its worth tar understands gzip/bzip2 tar files automatically ... you can see this
touch foo1 foo2 tar cjf foo.tbz foo1 foo2 # creates a bzip'd tar file
tar tf foo.tbz # lists contents no 'j' flag needed
Hi Xinyou,
On Sun, Sep 4, 2011 at 4:53 PM, xinyou yan yxy.716@gmail.com wrote:
I am not sure what the problem is. The following works for me: tar cf archive.tar first tar -rf archive.tar second
Yes it can , But tar czf tar rzf can't work Second :
if I use gzip -c file1 >> yyy.test How can I unpress yyy.test to file1 as file1 I test like it gzip -c test1 > 1.test We can use
gunzip -c 1.test >test1
to achieve my answer . However : gzip -c test1 >> 1.test gzip -c test2 >> 1.test
I just gunzip -c 1.test > test1 (the size of test1 now is the sum test1 and test2 before)
How can i use gunzip to separate the two file ? I wonder >> can remember there are two file ?
I think you are mixing up compression and archiving as similar things. They should be done in a particular order:
1. to create: archive -> compress 2. to modify: decompress -> modify archive -> compress 3. restore: decompress -> unarchive
Now (1) and (3) can be done in one step using the -z or -j option to tar, however for (2) you need to decompress first using `gunzip' or `gzip -d' before you can use `tar -r -f <archivefile.tar>' to modify it.
To give you an example:
$ tar -czf backup.tar.gz *.org # backup all .org files $ tar -tzf backup.tar.gz # test if it worked analysis.org coding.org fiddle.org languages.org meetings.org notes.org org-help.org $ gunzip backup.tar.gz # decompress the compressed archive $ tar -rf backup.tar *.org_archive # add .org_archive files $ gzip backup.tar # compress modified archive $ tar -tzf backup.tar.gz # test again analysis.org coding.org fiddle.org languages.org meetings.org notes.org org-help.org analysis.org_archive meetings.org_archive notes.org_archive $ tar -xzf backup.tar.gz '*.org' # restore only .org files $ ls analysis.org backup.tar.gz coding.org fiddle.org languages.org meetings.org notes.org org-help.org
In the future I would recommend try going through the manual page for tar and gzip carefully (`man tar' and `man gzip').
I hope this helps.
2011/9/4 suvayu ali fatkasuvayu+linux@gmail.com:
Hi Xinyou,
On Sun, Sep 4, 2011 at 4:53 PM, xinyou yan yxy.716@gmail.com wrote:
I am not sure what the problem is. The following works for me: tar cf archive.tar first tar -rf archive.tar second
Yes it can , But tar czf tar rzf can't work Second :
if I use gzip -c file1 >> yyy.test How can I unpress yyy.test to file1 as file1 I test like it gzip -c test1 > 1.test We can use
gunzip -c 1.test >test1
to achieve my answer . However : gzip -c test1 >> 1.test gzip -c test2 >> 1.test
I just gunzip -c 1.test > test1 (the size of test1 now is the sum test1 and test2 before)
How can i use gunzip to separate the two file ? I wonder >> can remember there are two file ?
I think you are mixing up compression and archiving as similar things. They should be done in a particular order:
- to create: archive -> compress
- to modify: decompress -> modify archive -> compress
- restore: decompress -> unarchive
Now (1) and (3) can be done in one step using the -z or -j option to tar, however for (2) you need to decompress first using `gunzip' or `gzip -d' before you can use `tar -r -f <archivefile.tar>' to modify it.
To give you an example:
$ tar -czf backup.tar.gz *.org # backup all .org files $ tar -tzf backup.tar.gz # test if it worked analysis.org coding.org fiddle.org languages.org meetings.org notes.org org-help.org $ gunzip backup.tar.gz # decompress the compressed archive $ tar -rf backup.tar *.org_archive # add .org_archive files $ gzip backup.tar # compress modified archive $ tar -tzf backup.tar.gz # test again analysis.org coding.org fiddle.org languages.org meetings.org notes.org org-help.org analysis.org_archive meetings.org_archive notes.org_archive $ tar -xzf backup.tar.gz '*.org' # restore only .org files $ ls analysis.org backup.tar.gz coding.org fiddle.org languages.org meetings.org notes.org org-help.org
In the future I would recommend try going through the manual page for tar and gzip carefully (`man tar' and `man gzip').
I hope this helps.
Yes it is very clear , you suggestion is good . By the way , I said before gzip with >> can be achieved ? gzip -c make the file be compressed to standout , then redirect , Can we decompress it with some method ?
-- Suvayu
Open source is the future. It sets us free.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
On Sun, Sep 4, 2011 at 5:26 PM, xinyou yan yxy.716@gmail.com wrote:
Yes it is very clear , you suggestion is good . By the way , I said before gzip with >> can be achieved ? gzip -c make the file be compressed to standout , then redirect , Can we decompress it with some method ?
1. compress a file by redirecting stdout: $ gzip -c somefile > somefile.gz 2. decompress the compressed file: $ gunzip somefile.gz 3. decompress the compressed file into a new file called somefile: $ cat somefile.gz | gunzip
HTH
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 09/04/2011 08:53 AM, Aaron Konstam wrote:
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.
One thing that can cause problems when creating an archive of disk images is that you can run out of disk space when creating/updating the archive. This is especially true when using the j or z options so that tar compresses the archive. It has to have enough space to uncompress the archive, and the new file, and compress it again.
You should also consider where tar is putting its temporary files. It may not be on the same file system as the archive. I believe tar honers the TMP shell variable.
Mikkel - --
Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup!
Yes , May be it is a problem.
I want to know what method can i decompress the file compressed by gzip to some files .
Can I decompress the compressed file from some position in the file ? The decompress the left one ?
(As the file created by gzip -c xxx >> yy gzip -c xxx1 >> yy)
You should also consider where tar is putting its temporary files. It may not be on the same file system as the archive. I believe tar honers the TMP shell variable.
Mikkel
Do not meddle in the affairs of dragons, for thou art crunchy and taste good with Ketchup! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iEUEARECAAYFAk5jw30ACgkQqbQrVW3JyMQzQACY7OfBMZx6lcV5TIjrRx+tmyOc bQCcDktbKnBJaHYU6++uXXvGWfT3jIA= =XVVU
-----END PGP SIGNATURE-----
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
On 09/03/2011 03:41 PM, Chris Tyler wrote:
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
Better: sudo dd if=/dev/sda2|gzip - > yyy.dd.gz
(does not need any file yyy.dd!)
-Chris