LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-19-2006, 09:49 PM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
Live backup direct on CD/DVD


Hi folks,

About live backup of complete hard drive including OS, data, etc. direct on CD/DVD.

Can I apply tar command plus bunzip creating a compressed tarball, pipe the output direct on mkisofs/growisofs creating ISO image and finally pipe to output to cdrecord/growisofs to burn CD/DVD. If possible please advise how to start.

OR are there other suggestions.

TIA

B.R.
satimis
 
Old 07-19-2006, 11:04 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Take a look at kdar:

http://kdar.sourceforge.net/

I haven't used it myself but it seems to have what you want.
 
Old 07-23-2006, 10:12 PM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by kilgoretrout
Take a look at kdar:

http://kdar.sourceforge.net/

I haven't used it myself but it seems to have what you want.
Hi,

Noted with tks.

satimis
 
Old 07-23-2006, 11:43 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
If you prefer a shell based approach, what you describe should work. I would tar with 'cjf' to provide bzip2 compression along with a new file, then create the ISO and pass it to cdrecord (most likely with a pipe to avoid too many temporary files).
 
Old 07-24-2006, 09:58 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Matir,

Quote:
If you prefer a shell based approach, what you describe should work.
Yes, I prefer shell based solution piping the commands. I have been running compressed tar to backup data for sometimes and burn the compressed tarballs on CD/DVD. It is simple and straightforwards for backup and easy to restore. But I never tested it on backup the whole HD before.

Now I'm considering piping the commands avoiding building too many temporary files. However is there anyway not to use RAM otherwise it needs at least >3G capacity. I have been considering writing a short script running tar compression, burning the tarballs and finaly deleting them after burning. But if I can overcome the RAM problem the solution will be much easier. Backup/Restore can be done without 3rd party software.

Any advice? TIA

B.R.
satimis
 
Old 07-24-2006, 10:09 AM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I would dump the .tar.bz2 to disk, then mkisofs and pipe that straight to cdrecord. This will need only one temporary file and (relatively) little RAM.
 
Old 07-24-2006, 10:21 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you don't want to backup files using kdar, and want to backup an image of the partition, I would recommend backing up to an external drive instead of dvd. Your partition is probably larger than 4.4 GB, so an image wouldn't fit without splitting the file. Remember that the T in TAR stands for tape, so restoring multiple volumes from DVD rather than tape may be a chore. The DAR command is written to work with DISCs.

To backup the image to an external drive, you can use the "dd" command, pipe it through "tar" and pipe the output of tar to "split". If the external drive uses one of the FAT file systems, it has a 2 GB limit, so that is why you may need to use split. Another advantage is that the file sizes will be more reasonable, and you can use par2 to produce parity files to recover files if they later become corrupted or deleted by mistake.

I backed up the contents of files on my home directory this way before a fresh install of SuSE 10.1 on my laptop. I was able to cat the backed up files, and pipe that to tar to recover the files, or even listing the contents. All this without ever producing a temporary file.

If it will help, here is a previous post where I gave the actual commands.
http://www.linuxquestions.org/questi...38#post2308238

---

When I tested the above post on my /boot partition, I tried both the -z and -j options. I was expecting the -j option (bzip2) to compress better then the -x option (gzip), however the filesize of the gzip'ed version was smaller.

Last edited by jschiwal; 07-24-2006 at 10:28 AM. Reason: added gzip vs bzip info.
 
Old 07-24-2006, 10:25 AM   #8
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Matir,

Tks for your advice.

Quote:
I would dump the .tar.bz2 to disk, then mkisofs and pipe that straight to cdrecord.
That is what I'm now doing. I'm curious to learn whether there is some other way round even w/o creating .tar.bz2 on disk.

B.R.
satimis
 
Old 07-24-2006, 11:11 AM   #9
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi jschiwal,

Tks for your advice.

Quote:
If you don't want to backup files using kdar, and want to backup an image of the partition, I would recommend backing up to an external drive instead of dvd.
I'll learn kdar later which is new to me.

an external drive?
Whether HD mounted on an USB enclosure can work for me. I can dump the compress partition image on it. But I haven't figured out how to restore on running rescue disk.

On your posting;
http://www.linuxquestions.org/questi...38#post2308238

Re:
Quote:
You could then use par2 to create parity files just in case one of the files got corrupted.
Please explain in more detail. TIA

Others noted with tks.

B.R.
satimis
 
Old 07-24-2006, 11:30 AM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I'm personally not familiar with par2, but as far as dumping a compressed disk image to another disk, you could do something like this:
Code:
dd if=/dev/hda1 bs=4M | bzip2 -c > /mnt/USBDRIVE/hda1.img.bz2
And restoration via:
Code:
bunzip2 -c </mnt/USBDRIVE/hda1.img.bz2 | dd of=/dev/hda1 bs=4M
 
Old 07-24-2006, 05:12 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The par2 command produces parity files, so if one or two of the split files are bad, you can run "par2repair" and get them back. If producing the parity files, one of the arguments is either the number of parity files to produce or the percentage of redundancy.

I think that if you have the package it will be called par2cmdline.

If you don't have the package, here is the sourceforge project:
http://parchive.sourceforge.net/

If your distro is RPM based, then a search on http://rpm.pbone.net for par2cmdline may find a version for your distro. Since it is a commandline tool, you should be able to use a package for a different distro, provided you don't have any library version conflict issues.
 
Old 07-24-2006, 10:16 PM   #12
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Matir,

Tks for your advice.

Quote:
And restoration via:
Code:
bunzip2 -c </mnt/USBDRIVE/hda1.img.bz2 | dd of=/dev/hda1 bs=4M
What I'm most concerned is whether running rescue CD can detect the USB enclosure. I'll buy an USB enclosure to make this test next time when I visit the computer shop. Its price is quite cheap. I have 6G, 9G, 10G, ATA/33/66, etc. old HDs here.

Tks.

B.R.
satimis
 
Old 07-24-2006, 10:30 PM   #13
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi jschiwal,

Tks for your explanation and URLs.

"yum seach par2cmdline" found this package and I have "par2cmdline.x86_64" installed on my PC. There is no "man par2"

Quote:
The par2 command produces parity files, so if one or two of the split files are bad, you can run "par2repair" and get them back. If producing the parity files, one of the arguments is either the number of parity files to produce or the percentage of redundancy.
Just visted their site;
http://parchive.sourceforge.net/

If not running RAID, would this package help? TIA

B.R.
satimis
 
Old 07-24-2006, 11:01 PM   #14
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by satimis
Hi Matir,

Tks for your advice.


What I'm most concerned is whether running rescue CD can detect the USB enclosure. I'll buy an USB enclosure to make this test next time when I visit the computer shop. Its price is quite cheap. I have 6G, 9G, 10G, ATA/33/66, etc. old HDs here.

Tks.

B.R.
satimis
I don't know about specific rescue cds, but most of them should have no trouble seeing your USB drive.
 
Old 07-25-2006, 02:17 AM   #15
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi jschiwal,

Quote:
When I tested the above post on my /boot partition, I tried both the -z and -j options. I was expecting the -j option (bzip2) to compress better then the -x option (gzip), however the filesize of the gzip'ed version was smaller.
I just tested both;

$ tar jcpf Documents_2060725.tar.bz2 Documents_2060725
$ tar zcpf Documents_20060725.tar.gz Documents_20060725

File size;
$ du -m Documents_20060725.tar.bz2
Code:
713     Documents_20060725.tar.bz2
$ du -m Documents_20060725.tar.gz
Code:
730     Documents_20060725.tar.gz
Not much difference. But to my surprize the compressing time for "Gzipped Tar Archive" was much faster.

B.R.
satimis
 
  


Reply



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
Live backup direct on CD/DVD satimis Linux - Software 2 07-21-2006 10:01 AM
Backup DVD computerdude Linux - Software 1 08-30-2005 09:02 PM
DVD Backup? carlosinfl Linux - Software 1 07-25-2005 01:03 PM
DVD backup gianh Linux - Software 2 10-13-2004 09:05 PM
DVD Backup inline.skater Linux - Software 2 06-28-2004 04:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration