LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-15-2004, 12:07 AM   #1
tuxedo-notebook
Member
 
Registered: Oct 2003
Distribution: Gentoo 2.6.12, Mepis 2.6.7, KUbuntu PPC
Posts: 43

Rep: Reputation: 15
Backup Question


I have finally managed to mount my usb 2.0 external hd (vfat), and I want to write a script to backup my entire hard drive (including the windows partition) to it. Does backup files have to be split up for the fat hd? Can I use tar to backup up my entire hd and split the files as necessary? If I do need to split the backup into several files, what options would I use with tar? Thank you!
 
Old 04-15-2004, 12:28 AM   #2
false-hopes
LQ Newbie
 
Registered: Mar 2004
Location: I don't remeber, something about an asylum, something about insane too.
Distribution: Gentoo, Knoppix, Debian
Posts: 20

Rep: Reputation: 0
couldnt you just do a cp /* /mnt/usbhdd
you would lose partitioning and stuff, but it would copy all the files, provided all partitions are mounted. make sure you unmount cd and floppy devices first though, and maybe find out how to exclude the /mnt/usbhdd directory.
 
Old 04-15-2004, 12:31 PM   #3
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
I would make tar files for each partition, naming them after the mount point or something. The date may be useful in the filename. You would want to exclude useless stuff or not You could run it using cron automatically.

Here is a script I use, repeating it as necessary in the same file changing the partition to backup and filename should do it. So instead of just backing up / you could do each partition if you want.

Code:
#!/bin/sh
mount /mnt/backup
cd /
NAME=`date +%m-%d-%y`
tar -c .  --exclude ./mnt --exclude ./proc --exclude ./var/spool/squid --exclude ./tmp --exclude ./var/tmp | gzip -9 > /mnt/backup/www_backup_$NAME.tar.gz 2>/var/log/messages
ls -l /mnt/backup > /tmp/backuptmp
df /mnt/backup >> /tmp/backuptmp
cat /tmp/backuptmp | mail -s "Backup of WWW complete" root
rm /tmp/backuptmp
umount /mnt/backup
So you would get an email like this...


Subject: Backup of WWW complete

total 7134732
drwxr-xr-x 2 root root 4096 Oct 5 03:52 lost+found
-rw-r--r-- 1 root root 1719996342 Aug 1 11:05 www_backup_08-01-03.tar.gz
-rw-r--r-- 1 root root 1856262536 Sep 1 11:07 www_backup_09-01-03.tar.gz
-rw-r--r-- 1 root root 1854443512 Oct 5 06:06 www_backup_10-05-03.tar.gz
-rw-r--r-- 1 root root 1868098754 Nov 1 07:26 www_backup_11-01-03.tar.gz
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda4 9859540 7167544 2191148 77% /mnt/backup






You might also want to set some different file permissions on the file depending on the situation.

Last edited by DavidPhillips; 04-15-2004 at 12:49 PM.
 
Old 04-15-2004, 03:43 PM   #4
WeNdeL
Member
 
Registered: Oct 2002
Location: At my desk...
Distribution: RedHat, Fedora, Ubuntu
Posts: 344

Rep: Reputation: 30
do you know how to mount your windows partition in Linux? If so, just mount it and back em up with tar.

If not, I might advise using dd to simply dump the entire partition to a file.

/me shrugs

As far as using tar goes, just create yourself a script that breaks up the backup job into the acceptable divisions you prefer and run it via cron.

Something like:

tar -zcvf /backup/dir/backup-file.1.tgz /path/to/dir/1
tar -zcvf /backup/dir/backup-file.2.tgz /path/to/dir/2
tar -zcvf /backup/dir/backup-file.3.tgz /path/to/dir/3
tar -zcvf /backup/dir/backup-file.4.tgz /path/to/dir/4

Edit: And as far as using gzip goes, tar has a built-in flag for it.

Last edited by WeNdeL; 04-15-2004 at 03:48 PM.
 
Old 04-16-2004, 01:43 AM   #5
tuxedo-notebook
Member
 
Registered: Oct 2003
Distribution: Gentoo 2.6.12, Mepis 2.6.7, KUbuntu PPC
Posts: 43

Original Poster
Rep: Reputation: 15
Is it ok to have very large files on a vfat partitioned drive? I know that for ntfs they have to be smaller than 2 gb or something. If they do have to be under a certain size, can I have my script split the files? Thank you for all of the help. That script is especially helpful, thank you.
 
Old 04-16-2004, 11:26 AM   #6
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
Your welcome!


If you use the -z then you would not need the pipe, I like pipes. Pipes are cool.

 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
backup question blockme Debian 3 05-28-2004 07:08 PM
Backup question TomH37 Linux - Software 1 05-24-2004 06:32 PM
Backup question gchandler Red Hat 1 05-24-2004 02:55 PM
Backup question Swift&Smart Linux - Software 2 06-18-2003 03:59 PM
Backup question chuck77 Linux - General 1 03-21-2002 02:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:18 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