Solved

Fedora 5 Backup to usb hard drive

Posted on 2006-10-30
8
156 Views
Last Modified: 2013-12-16
Hello EE.  I have a linux box, providing file services, firewall and proxy.  setup with help from many of you (thanks)
What I want to do is backup the /data partition (samba)  to a usb drive which is permanently attached and then shut down the machine daily at 7pm.  So basically I have a folder on the driver  which is at /media/sea_disk/Backups

I would like the daily backup to only backup what has changed.  And then on saturday do a complete backup to the same location.

And then shut down the machine.  


0
Comment
Question by:aduhwale
  • 4
  • 3
8 Comments
 
LVL 14

Accepted Solution

by:
ygoutham earned 250 total points
ID: 17840408
for the daily backup, you can try rsync

rsync -avz --delete /data/* /media/sea_disk/Backups/

please note that the --delete is only an option if you want the target files to be deleted as well. remove it if you want to retrieve any deleted files that a user might request for (which happens at all time with me :-)

for a weekly backup, just to a

cp -Rp /data/* /media/sea_disk/Backups/  

the weekly backup and daily backup can be run through the crontab.

do a

crontab -e (as root)

01 0 * * * (your rsync command here)

and for weekly backup

01 0 * * 6 (your cp command here)

the weekly would run on mondays at the change of system clock date.   the hour can be any 24 hour format to run at a specified time.

by shutdown the machine are you stating that the machine should be powered off??? or only the usb drive to unmounted???

you can also put the same in a bash script and run it as a script at an appointed hour ending with

'shutdown -h -t 5 "an optional message here"   ' (without the initial and end single quote) at the end of the script to tell the machine to shutdown after finishing the rsync/ cp command.

goutham
0
 
LVL 14

Expert Comment

by:ygoutham
ID: 17840411
sorry the weekly command is to run on saturdays (number 6 in crontab entry is right) but monday is wrong

: - (
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18094972
Hi ygoutham , wasnt ignoring you.  Got side tracked with another project.   I am testing this saturday and will then confirm i am successfull.

Regards

Adewale
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 2

Author Comment

by:aduhwale
ID: 18198503
Thanks   ygoutham.    This worked great.  I only need help figuring out where to put the shut down command.  do i put it on the same line as the cp command.
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18198545
in crontab I mean - how do you I get it to point to a script?
Thanks again.
0
 
LVL 14

Expert Comment

by:ygoutham
ID: 18198587
in crontab you have five fields

01 13 * * * sh /path/to/some/script.sh

the above line means to execute a script called script.sh which is a shell script at 13:01 hours every day.  read more on

man 5 crontab
man crontab

to shutdown a machine

shutdown -h -t 5 now

this means to shutdown the machine in 5 seconds from now and halt the system.  the same command can also go into your crontab.  but shutdown is not given enough rights to be run from crontab.  just check on the first before adding the same.  just look at /etc/sudoer
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18201166
Hey.  Thanks!  
I hadnt actually written a script before.  now i have - albeit a simple one.    I am tinkering with the timings but I am good to go.

Thanks again.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now