LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-23-2008, 02:44 PM   #1
marlaina1
Member
 
Registered: Jun 2001
Location: Houston
Distribution: CentOS 5.3
Posts: 142

Rep: Reputation: 15
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!
 
Old 08-23-2008, 03:02 PM   #2
CrazyToon
LQ Newbie
 
Registered: Jun 2003
Posts: 21

Rep: Reputation: 0
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.
 
Old 08-23-2008, 03:07 PM   #3
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,474

Rep: Reputation: 155Reputation: 155
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
 
Old 08-23-2008, 03:16 PM   #4
garyg007
Member
 
Registered: Aug 2008
Location: north-east ohio
Distribution: Debian-squeeze/stable;
Posts: 279
Blog Entries: 1

Rep: Reputation: 31
Quote:
Originally Posted by jailbait View Post
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.
 
Old 08-23-2008, 03:47 PM   #5
marlaina1
Member
 
Registered: Jun 2001
Location: Houston
Distribution: CentOS 5.3
Posts: 142

Original Poster
Rep: Reputation: 15
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?
 
Old 08-23-2008, 04:08 PM   #6
CrazyToon
LQ Newbie
 
Registered: Jun 2003
Posts: 21

Rep: Reputation: 0
marlaina1, when you extract, use p along with x to preserve permissions.

http://www.lamp-tips.com/man-pages/tar/
 
Old 08-23-2008, 04:15 PM   #7
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,474

Rep: Reputation: 155Reputation: 155
Quote:
Originally Posted by marlaina1 View Post

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
 
Old 08-23-2008, 05:19 PM   #8
marlaina1
Member
 
Registered: Jun 2001
Location: Houston
Distribution: CentOS 5.3
Posts: 142

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
archive, backup, compression


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
backing up files to a remote system using tar over ssh kaplan71 Linux - General 5 08-05-2011 07:40 AM
Backing up my computer with tar JerryMcFarts Linux - General 22 04-11-2006 02:28 AM
backing up help with tar dannyk1 Linux - Newbie 5 08-22-2004 06:25 AM
Backing up with tar rooch84 Linux - Software 2 08-20-2004 02:30 AM
Exclude directories when backing up with 'tar'? wolfpeach Linux - Newbie 2 06-28-2004 10:54 AM


All times are GMT -5. The time now is 12:48 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration