LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 10-06-2006, 04:38 PM   #1
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Rep: Reputation: 31
Backup Script?


I have been trying to backup my home directory files using tar, from the terminal but keep chasing my tail. The problem is not with the tar command/flags but trying to write to the DVD RW. I'm sure there must be hundreds of simple bash scripts or Perl scripts for something so basic. Any ideas? Thanks in advance, Matthew
 
Old 10-06-2006, 05:47 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Might check this out. http://silvercoders.com/index.php?page=DVD_Backup

Brian
 
Old 10-07-2006, 02:24 AM   #3
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
DVD Backup

Thanks Brian,
I've downloaded the tar ball, I'll play with it later and get back.
Matt.
 
Old 10-07-2006, 11:59 AM   #4
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
DVD Backup

These are the files extracted and placed in /dvd_backup directory:

backup.conf.sample, backup.sh, ChangeLog, Makefile, VERSION

I'm not quite sure of how to proceed. This doesn't look like the typical 3-step dance, not that I've had many of those. The Changelog and VERSION are easy. The sample conf.file has a few #comments that are opaque for me. What directories, files etc. are usually backed up? Will this back up my .jpg files as well as my regular files? I appreciate any help.
Matthew
 
Old 10-07-2006, 01:31 PM   #5
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Never tried it till now but works quite well so far. Very simple. Don't like the idea of password set as plain text in the config but if you are the only one that can see and open the file then should not be a big deal.

If the true point of the files extracted is set to /dvd_backup then you can use the command as follows.
cd into /dvd_backup
mv /dvd_backup/dvd_backup.conf.sample /dvd_backup/dvd_backup.conf ( This lines renames the config file.)
./dvd_backup --config /dvd_backup/dvd_backup.conf --init

Now this will backup the contents from /etc and /home and using growifs command send the data to /dev/cdrom. This based on the default values for the BACKUP_PATHS set in the dvd_backup.conf file. Pretty basic config file overall. Same as applies to other info like the BACKUP_DEVICE and others. Edit the config file to backup what you want and to which device. You can even exclude certain files and extensions of files.

Brian
 
Old 10-08-2006, 09:44 AM   #6
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Brian1
Never tried it till now but works quite well so far. Very simple. Don't like the idea of password set as plain text in the config but if you are the only one that can see and open the file then should not be a big deal.

If the true point of the files extracted is set to /dvd_backup then you can use the command as follows.
cd into /dvd_backup
mv /dvd_backup/dvd_backup.conf.sample /dvd_backup/dvd_backup.conf ( This lines renames the config file.)
./dvd_backup --config /dvd_backup/dvd_backup.conf --init

Now this will backup the contents from /etc and /home and using growifs command send the data to /dev/cdrom. This based on the default values for the BACKUP_PATHS set in the dvd_backup.conf file. Pretty basic config file overall. Same as applies to other info like the BACKUP_DEVICE and others. Edit the config file to backup what you want and to which device. You can even exclude certain files and extensions of files.

Brian
Arrgh! I think I'm so close, yet typing these commands into Unix can eat up hours trying to get it straight.
This is copied from my shell:

mathay@linux:~> ./dvd_backup --config /dvd_backup/dvd_backup.conf --init
bash: ./dvd_backup: is a directory
mathay@linux:~> cd dvd_backup
mathay@linux:~/dvd_backup> ./dvd_backup --config /dvd_backup/dvd_backup.conf --init
bash: ./dvd_backup: No such file or directory
mathay@linux:~/dvd_backup> ls
backup.conf.sample backup-sample backup.sh ChangeLog dvd_backup.conf Makefile VERSION
mathay@linux:~/dvd_backup>
Can you spot my error?
Matthew
 
Old 10-08-2006, 10:14 AM   #7
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,022

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by drmjh
The problem is not with the tar command/flags but trying to write to the DVD RW.
If your DVD drive is, for example, /dev/dvd, here's a way to write all of /home to it (not a tarball, the entire directory structure):
Code:
growisofs -Z /dev/dvd -dvd-compat -r -v /home
If you want just a tarball (that you had previously created)...
Code:
growisofs -Z /dev/dvd -dvd-compat -r -v /home/matthew/mystuff.tar.gz
You can let growisofs determine a burn speed, or you can specify one manually. e.g., add -speed=2 to the command line to set the burn speed. If you want to just see if your command looks good, without actually burning, add -dry-run to the command line.

Note: growisofs is part of the dvd+rw-tools package. You may need to install that first, if the growisofs command is not present on your system. Also, if you need to format a DVD before use, this same package includes a command dwd+rw-format for that purpose. dvd+rw-mediainfo is another command from this package that tells you info about a DVD you have inserted in your drive.

[edit]
Fixed a typo in that second growisofs example above. I originally mistyped a "-X" command line option, that should have been "-Z".
[/edit]

Last edited by haertig; 10-09-2006 at 12:55 AM.
 
Old 10-08-2006, 01:56 PM   #8
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
I see you don't have the script called dvd_backup.sh. Just backup.sh. Need to change the command to this. Why you have adifferent name I am not sure. You may have downloaded and the other one on the page.

./backup --config /dvd_backup/dvd_backup.conf --init

Brian
 
Old 10-08-2006, 02:56 PM   #9
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Brian1
I see you don't have the script called dvd_backup.sh. Just backup.sh. Need to change the command to this. Why you have adifferent name I am not sure. You may have downloaded and the other one on the page.

./backup --config /dvd_backup/dvd_backup.conf --init

Brian
Many thanks Brian. Your suggestion makes sense to me and I'm sure it would work. In the meantime, I tried the growisofs solution and it is extremely easy and fast and preserves the entire directory structure.
Matthew
 
Old 10-08-2006, 03:00 PM   #10
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
Talking

Quote:
Originally Posted by haertig
If your DVD drive is, for example, /dev/dvd, here's a way to write all of /home to it (not a tarball, the entire directory structure):
Code:
growisofs -Z /dev/dvd -dvd-compat -r -v /home
If you want just a tarball (that you had previously created)...
Code:
growisofs -X /dev/dvd -dvd-compat -r -v /home/matthew/mystuff.tar.gz
You can let growisofs determine a burn speed, or you can specify one manually. e.g., add -speed=2 to the command line to set the burn speed. If you want to just see if your command looks good, without actually burning, add -dry-run to the command line.

Note: growisofs is part of the dvd+rw-tools package. You may need to install that first, if the growisofs command is not present on your system. Also, if you need to format a DVD before use, this same package includes a command dwd+rw-format for that purpose. dvd+rw-mediainfo is another command from this package that tells you info about a DVD you have inserted in your drive.
Wow! It actually worked! I spent a couple of hours trying to find out how Suse labels/mounts cd-dvd's. No wonder I get confused. Suse refers to the dvd as hdc and sometimes located in / (media) in other places as
/:media and also as dev/dvd. What I finally had to do was locate where the dvd was mounted. I found a directory called /media, cd'd to there and tried your command :
mathay@linux:/media> dvd+rw-mediainfo /dev/dvd
I got an answer and immediately tried the backup formula and it burned a disk with /home & everything on it.
I want to offer my heartfelt thanks. I know just enough about linux to be dangerous. I've managed to crash and burn once and lost all my data; a 2nd time, a brand new disk developed 'Bad Blocks' and they were located in the Journaling section....I lost all my data again.
I know that everyone has different goals, but would you recommend backing up anything else besides /home?
Finally, I have no particular skills (that I know of) that might be useful to the linux community (I'm reasonably fluent in German but so many Germans are very fluent in English, so that's not in demand) and I dislike 'taking all the time' and not contributing. I tried to donate small money sums several times but can't understand the mechanism/program for doing so and had to bail out. Suggestions?
Matthew
 
Old 10-09-2006, 12:42 AM   #11
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,022

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Yes, my DVD is /dev/hdc also. That's because I have a harddisk know as /dev/hda and a second harddisk known as /dev/hdb. So my next ide device is /dev/hdc, and that is my dvd drive.

On my system, you can see that /dev/hdc can be accessed different ways. /dev/dvd is the same thing. So is /dev/cdrom. And /dev/dvdrw and /dev/cdrw. These are all symlinks to /dev/hdc.
Code:
$ ls -l /dev/hdc
brw-rw---- 1 root cdrom 22, 0 2006-09-17 16:33 /dev/hdc
$ ls -l /dev/dvd*
lrwxrwxrwx 1 root root 3 2006-09-17 16:33 /dev/dvd -> hdc
lrwxrwxrwx 1 root root 3 2006-09-17 16:33 /dev/dvdrw -> hdc
$ ls -l /dev/cd*
lrwxrwxrwx 1 root root 3 2006-09-17 16:33 /dev/cdrom -> hdc
lrwxrwxrwx 1 root root 3 2006-09-17 16:33 /dev/cdrw -> hdc
$
The above are devices. When a CD or DVD is inserted and automatically mounted, my system's default mountpoint is /media/cdrom0. A symlink points /media/cdrom to /media/cdrom0, so I can reference either one. This default mountpoint may vary from distro to distro. Remember, a "device" is mounted to a "mountpoint". /dev contains devices. /media contains mountpoints on my distro (and evidently, on yours as well).
Code:
$ ls -l /media
total 1
lrwxrwxrwx 1 root root    6 2005-10-23 16:42 cdrom -> cdrom0
drwxr-xr-x 2 root root 1024 2005-10-23 16:42 cdrom0
$
 
Old 10-09-2006, 12:51 AM   #12
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,022

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by drmjh
...I dislike 'taking all the time' and not contributing...
You will be surprised how fast you learn, and soon you will be answering many more questions than you ask!
 
Old 10-09-2006, 12:38 PM   #13
drmjh
Member
 
Registered: Mar 2005
Location: North Carolina, USA
Distribution: Ubuntu 12.04LTS
Posts: 258

Original Poster
Rep: Reputation: 31
Once again, I am indebted.
I've been trying to solve this problem on my own for at least 6 Mos. There are many ways to BkUp. But, this one is the slickest and most complete.
Matthew
 
  


Reply


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
Need backup script. gtrawoger Linux - Software 2 07-17-2006 07:31 AM
Backup Script Help Canni Programming 8 06-15-2006 10:19 AM
Need a backup script enygma Linux - General 5 11-04-2004 03:49 PM
help with backup script dennis_89 Linux - Networking 2 06-29-2004 09:47 AM
Backup Script imsajjadali Linux - General 7 01-28-2004 03:30 PM


All times are GMT -5. The time now is 02:08 AM.

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