LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backing-up with tar (https://www.linuxquestions.org/questions/linux-newbie-8/backing-up-with-tar-664881/)

marlaina1 08-23-2008 02:44 PM

backing-up with tar
 
CentOS 4.5

I noticed when I backed-up some of my home dir to cd's the permissions were not right so was advised to archive (tar) them first. I have used the tar command before only when installing non-rpm programs. And I have read the man page for tar.

But I still am not understanding how to tar a directory in my home directory and get it on the cd, nor do I know how to get it from the cd back into my home directory.

Thanks for help!

CrazyToon 08-23-2008 03:02 PM

You can use: tar cf filename.tar dirname

if you want compression, which you probably should if you have a lot of data, use: tar zcf filename.tar.gz dirname OR tar jcf filename.tar.bz2 dirname

first command will create a gzipped file, second will do bzip2 compression.

Good luck.

jailbait 08-23-2008 03:07 PM

In order to write any file to a CD you must first create an iso99660 file system on your hard drive using the mkisofs command. Then you use the cdrecord command to write the iso9660 file system to your CD-RW. See:

man mkisofs

man cdrecord

There are GUI front ends for burning CDs. If you want to use a GUI then try GnomeBaker:

http://www.ubuntugeek.com/how-to-bur...ntu-linux.html

Once you have created a backup CD you can retrieve the files by mounting the CD and copying the files from CD to hard drive using the cp command or a file manager GUI. If the files on CD are tar files then you can also retrieve them with tar.

If you have enough space on the CD for the files without having to compress them then I recommend that you not use tar. Use mkisofs and cdrecord (or a GUI) to create a copy of the directory tree you are backing up. That way you can browse the directory tree on the CD and do partial restores.

-------------------------
Steve Stites

garyg007 08-23-2008 03:16 PM

Quote:

Originally Posted by jailbait (Post 3257307)
In order to write any file to a CD you must first create an iso99660 file system on your hard drive using the mkisofs command. Then you use the cdrecord command to write the iso9660 file system to your CD-RW. See:

man mkisofs

man cdrecord

There are GUI front ends for burning CDs. If you want to use a GUI then try GnomeBaker:

http://www.ubuntugeek.com/how-to-bur...ntu-linux.html

Once you have created a backup CD you can retrieve the files by mounting the CD and copying the files from CD to hard drive using the cp command or a file manager GUI. If the files on CD are tar files then you can also retrieve them with tar.

If you have enough space on the CD for the files without having to compress them then I recommend that you not use tar. Use mkisofs and cdrecord (or a GUI) to create a copy of the directory tree you are backing up. That way you can browse the directory tree on the CD and do partial restores.

-------------------------
Steve Stites

not true --- you do NOT have to create an iso9660 file system.

marlaina1 08-23-2008 03:47 PM

Thank you! I use the nautilis -> places -> cd creator and once I tar the directories I will try to just use that to put them on cd.

So to back up say my jokes directory

tar cf jokes.tar jokes

Is that right? Then put jokes.tar on a cd

Then after it is put back on a new system in my home dir

tar -x jokes jokes.tar

Am I close?

CrazyToon 08-23-2008 04:08 PM

marlaina1, when you extract, use p along with x to preserve permissions.

http://www.lamp-tips.com/man-pages/tar/

jailbait 08-23-2008 04:15 PM

Quote:

Originally Posted by marlaina1 (Post 3257344)

Thank you! I use the nautilis -> places -> cd creator and once I tar the directories I will try to just use that to put them on cd.

So to back up say my jokes directory

tar cf jokes.tar jokes

Is that right? Then put jokes.tar on a cd

Then after it is put back on a new system in my home dir

tar -x jokes jokes.tar

Am I close?

Right, cd creator will create an iso9660 file system, copy your tar files to the iso9660 file system and then write it to CD.

-------------------
Steve Stites

marlaina1 08-23-2008 05:19 PM

Thank you all! And I see about the iso situation that I might need in the future if I can't find an easy cd creator application. And for the permission preservation instruction. I really DID read the man page before posting but was pretty much lost in space.


All times are GMT -5. The time now is 06:22 AM.