Re: [gentoo-user] HD back up
On Saturday 30 August 2003 10:51 pm, Ernie Schroder wrote: > > Thanks much, that seems to have done the trick! the script is > building a file list now. Providing the backup is successful, I will > post it to the list for archive purposes. the backup was successful. here is my script, I hope others can take advantage of it. It performs a backup via rsync and ssh from the local machine to a dedicated disk on a remote machine. You will need to establish passwordless ssh between the root accounts of both machines in order for it to run unattended as in a cron job. see: http://pigtail.net/LRP/printsrv/keygen.html for a good howto. the script: #== #! /bin/bash # /usr/local/bin/my-rsync ### # Backup Script ### [EMAIL PROTECTED]:/mnt/backup #path to backup disk EXCLUDE=/usr/local/bin/rsync-exclude#list of files and #directories to be excluded echo " Mounting boot partition..." sudo mount /boot -o ro echo echo " Mounting backup disk..." ssh [EMAIL PROTECTED] <
Re: [gentoo-user] HD back up
On Saturday 30 August 2003 10:28 pm, Jussi Sirpoma wrote: > On 31.8.2003 5:09 Ernie Schroder wrote: > > Jussi, > > Thanks for your help. It seems to be working, except for the rsync > > itself. > > Probably due to my own stupidity, the host name of the remote > > machine is Ernie.schroder.com. This may be my problem. when I try > > to run the script, I get: > > > > >Performing backup... > > > > Ernie.schroder.com: Connection refused > > rsync: connection unexpectedly closed (0 bytes read so far) > > rsync error: error in rsync protocol data stream (code 12) at > > io.c(165) > > > > > Is this a syntax error or due to my hostname? > > Suggestions? > > I havn't used rsync that much but check out rsyn's man page and > especially the --rsh parameter. You should propably add someting like > --rsh="ssh" to the rsync command. > > Jussi Sirpoma > > > -- > [EMAIL PROTECTED] mailing list Thanks much, that seems to have done the trick! the script is building a file list now. Providing the backup is successful, I will post it to the list for archive purposes. -- Regards, Ernie 100% Microsoft and Intel free -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On 31.8.2003 5:09 Ernie Schroder wrote: Jussi, Thanks for your help. It seems to be working, except for the rsync itself. Probably due to my own stupidity, the host name of the remote machine is Ernie.schroder.com. This may be my problem. when I try to run the script, I get: Performing backup... Ernie.schroder.com: Connection refused rsync: connection unexpectedly closed (0 bytes read so far) rsync error: error in rsync protocol data stream (code 12) at io.c(165) Is this a syntax error or due to my hostname? Suggestions? I havn't used rsync that much but check out rsyn's man page and especially the --rsh parameter. You should propably add someting like --rsh="ssh" to the rsync command. Jussi Sirpoma -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Saturday 30 August 2003 09:02 pm, Jussi Sirpoma wrote: > On 31.8.2003 2:38 Ernie Schroder wrote: > > ssh [EMAIL PROTECTED] > > sleep 5 > > mount /dev/hdb1 /mnt/backup > > exit > > You should change this to: > > ssh [EMAIL PROTECTED] < sleep 5 > mount /dev/hdb1 /mnt/backup > END > > > ssh [EMAIL PROTECTED] > > sleep 5 > > umount /mnt/backup > > > > echo > > echo " Spinning down backup disk..." > > /sbin/hdparm -y /dev/hdb# spin down disk > > exit > > And this similarly to: > > ssh [EMAIL PROTECTED] < sleep 5 > umount /mnt/backup > > echo > echo " Spinning down backup disk..." > /sbin/hdparm -y /dev/hdb# spin down disk > END > > Regards, > Jussi Sirpoma > > > > -- > [EMAIL PROTECTED] mailing list Jussi, Thanks for your help. It seems to be working, except for the rsync itself. Probably due to my own stupidity, the host name of the remote machine is Ernie.schroder.com. This may be my problem. when I try to run the script, I get: # my-rsync Mounting boot partition... Mounting backup disk... Pseudo-terminal will not be allocated because stdin is not a terminal. Performing backup... Ernie.schroder.com: Connection refused rsync: connection unexpectedly closed (0 bytes read so far) rsync error: error in rsync protocol data stream (code 12) at io.c(165) Unmounting boot and backup partitions... Pseudo-terminal will not be allocated because stdin is not a terminal. Spinning down backup disk... /dev/hdb: issuing standby command Is this a syntax error or due to my hostname? Suggestions? -- Regards, Ernie 100% Microsoft and Intel free -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On 31.8.2003 2:38 Ernie Schroder wrote: ssh [EMAIL PROTECTED] sleep 5 mount /dev/hdb1 /mnt/backup exit You should change this to: ssh [EMAIL PROTECTED] < ssh [EMAIL PROTECTED] sleep 5 umount /mnt/backup echo echo " Spinning down backup disk..." /sbin/hdparm -y /dev/hdb# spin down disk exit And this similarly to: ssh [EMAIL PROTECTED] < echo echo " Spinning down backup disk..." /sbin/hdparm -y /dev/hdb# spin down disk END Regards, Jussi Sirpoma -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Friday 29 August 2003 02:09 pm, Peter Ruskin wrote: > On Friday 29 Aug 2003 18:08, Ernie Schroder wrote: > > On Friday 29 August 2003 06:21 am, Peter Ruskin wrote: > > > Hi Stephen, > > > > > > I obviously didn't make myself clear enough. > > > > > Peter, > > Your script looks like it might do the trick for me. I do have a > > couple of questions though. How would I adapt it for a remote > > backup location? /mnt/backup is a normally unmounted disk on my > > secondary Gentoo box. I have configured passwordless ssh between > > USER with sudo privledges on the machine to be backed up, to > > [EMAIL PROTECTED] The way to ssh in to the remote box, mount > > /mnt/backup and then do the rsync eludes me. I wonder if you might > > steer me in the right direction. > > Sounds like a good idea Ernie. I'm afraid I've never done anything > like that though, so I can't offer any advice. I suppose you could > use NFS, with an fstab entry like: > remotebox:/mnt/backup /mnt/remote/mnt/backup nfs > user,noauto,rw,rsize=8192,wsize=8192,nolock 0 0 > (all one line) > ...and an entry in the remote box's /etc/exports like: > /mnt/backup > 192.168.0.0/255.255.255.0(sync,insecure,no_root_squash,rw) > > Then you wouldn't need to use ssh. (man exports(5)) > > > The second question is about the rsync command in your script. > > What does the --delete option do? Does it delete old backups? > > Forgive me for being a bit dense here, but I'm rather new at > > scripting. > > The script makes a mirror of your system. If you delete any files, > the rsync "--delete" flag deletes those files on the backup next time > it's run; otherwise the backup would continually grow (man rsync). > Downside of this is that you only have the opportunity to recover > accidentally deleted files (one of the main reasons for having a > backup, after all) up to the next backup run. This isn't a problem > for me because I have another backup strategy using tar. I suppose > you could alter the script so that it only does the delete thing once > a week, say. > > if it's Sunday; then > rsync --progress --delete -av --exclude-from=$EXCLUDE / \ >$BACKUP_TO/rsync/ > else > rsync --progress -av --exclude-from=$EXCLUDE / \ >$BACKUP_TO/rsync/ > fi > > Pter I may just have to go that rout but I did try my hand at scripting a remote rsync using Peter's script as a model. The script should mount the local /boot and then ssh into [EMAIL PROTECTED] and mount the backup disk after waiting long enough to open the connection. After exiting the ssh session, it should perform the backup and delete any files that have been deleted from the local box. It excludes files listed in /usr/local/bin/rsync-exclude. After completing the backup, it should unmount /boot, ssh back into [EMAIL PROTECTED] and unmount /mnt/backup, spin the disk down and exit ssh I have made it executable and tried it out. It gets as far as mounting /boot and ssh'ing into [EMAIL PROTECTED] where it stops. Would someone with some scripting knowledge take a look at it and see if you can figure out why it aint working? #== #! /bin/bash # /usr/local/bin/my-rsync ### # Backup Script ### [EMAIL PROTECTED]:/mnt/backup EXCLUDE=/usr/local/bin/rsync-exclude echo " Mounting boot partition..." sudo mount /boot -o ro echo echo " Mounting backup disk..." ssh [EMAIL PROTECTED] sleep 5 mount /dev/hdb1 /mnt/backup exit sleep 4 echo echo " Performing backup..." echo rsync --progress --delete -av --exclude-from=$EXCLUDE / \ $BACKUP_TO/rsync/ echo echo " Unmounting boot and backup partitions..." /bin/umount -l /boot ssh [EMAIL PROTECTED] sleep 5 umount /mnt/backup echo echo " Spinning down backup disk..." /sbin/hdparm -y /dev/hdb# spin down disk exit -- Regards, Ernie 100% Microsoft and Intel free -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Friday 29 Aug 2003 18:08, Ernie Schroder wrote: > On Friday 29 August 2003 06:21 am, Peter Ruskin wrote: > > Hi Stephen, > > > > I obviously didn't make myself clear enough. > Peter, > Your script looks like it might do the trick for me. I do have a > couple of questions though. How would I adapt it for a remote backup > location? /mnt/backup is a normally unmounted disk on my secondary > Gentoo box. I have configured passwordless ssh between USER with sudo > privledges on the machine to be backed up, to [EMAIL PROTECTED] The way > to ssh in to the remote box, mount /mnt/backup and then do the rsync > eludes me. I wonder if you might steer me in the right direction. Sounds like a good idea Ernie. I'm afraid I've never done anything like that though, so I can't offer any advice. I suppose you could use NFS, with an fstab entry like: remotebox:/mnt/backup /mnt/remote/mnt/backup nfs user,noauto,rw,rsize=8192,wsize=8192,nolock 0 0 (all one line) ...and an entry in the remote box's /etc/exports like: /mnt/backup 192.168.0.0/255.255.255.0(sync,insecure,no_root_squash,rw) Then you wouldn't need to use ssh. (man exports(5)) > The second question is about the rsync command in your script. What > does the --delete option do? Does it delete old backups? Forgive me > for being a bit dense here, but I'm rather new at scripting. The script makes a mirror of your system. If you delete any files, the rsync "--delete" flag deletes those files on the backup next time it's run; otherwise the backup would continually grow (man rsync). Downside of this is that you only have the opportunity to recover accidentally deleted files (one of the main reasons for having a backup, after all) up to the next backup run. This isn't a problem for me because I have another backup strategy using tar. I suppose you could alter the script so that it only does the delete thing once a week, say. if it's Sunday; then rsync --progress --delete -av --exclude-from=$EXCLUDE / \ $BACKUP_TO/rsync/ else rsync --progress -av --exclude-from=$EXCLUDE / \ $BACKUP_TO/rsync/ fi Peter -- == Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+ == -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Friday 29 August 2003 06:21 am, Peter Ruskin wrote: > Hi Stephen, > > I obviously didn't make myself clear enough. > > I have one disk dedicated to backups. > > This is the backup script my-rsync, which I put in /usr/local/bin: > # >== #! /bin/bash > # /usr/local/bin/my-rsync > ### > # Backup Script > ### > > BACKUP_TO=/mnt/backup > EXCLUDE=/usr/local/bin/rsync-exclude > > echo " Mounting boot partition..." > mount /boot -o ro > echo > echo " Mounting backup disk..." > mount $BACKUP_TO > sleep 4 > echo > echo " Performing backup..." > echo > rsync --progress --delete -av --exclude-from=$EXCLUDE / \ > $BACKUP_TO/rsync/ > > echo > echo " Unmounting boot and backup partitions..." > > /bin/umount -l /boot > /bin/umount -l $BACKUP_TO > > echo > echo " Spinning down backup disk..." > /sbin/hdparm -y /dev/hdc# spin down disk > # >== > > As root, I did: > chmod a+x /usr/local/bin/my-rsync > ...to make the script executable > > In the script you'll see "EXCLUDE=/usr/local/bin/rsync-exclude". > This means that you list all the files you want to exclude from the > backup in a file you create (I called mine rsync-exclude and put it > in /usr/local/bin). See `man rsync` for more information. > > My /usr/local/bin/rsync-exclude looks like this: > # >== - /tmp/ > - /var/lib/init.d/ > - /mnt/backup/ > - /mnt/cdrom/ > - /mnt/floppy/ > - /proc/ > - /usr/portage/distfiles/ > - /root/.ccache/ > - /home/peter/.ccache/ > # >== > > As Andrew Farmer suggested, you can use /etc/cron.daily to have it > run automatically. Before you do so, run it manually to make sure it > works for you, altering the mountpoint ($BACKUP_TO) and /dev/hdc in > the "spin down disk" part to suit your installation. My /etc/fstab > entry for $BACKUP_TO reads: > /dev/hdc1 /mnt/backup ext3 noauto,noatime,users 0 0 > ...so, like /boot, it's only mounted when needed. > > When you are ready to add the backup script to cron.daily, become > root and do: > cp /usr/local/bin/my-rsync /etc/cron.daily/ > > Hope this helps you. > > Peter Peter, Your script looks like it might do the trick for me. I do have a couple of questions though. How would I adapt it for a remote backup location? /mnt/backup is a normally unmounted disk on my secondary Gentoo box. I have configured passwordless ssh between USER with sudo privledges on the machine to be backed up, to [EMAIL PROTECTED] The way to ssh in to the remote box, mount /mnt/backup and then do the rsync eludes me. I wonder if you might steer me in the right direction. The second question is about the rsync command in your script. What does the --delete option do? Does it delete old backups? Forgive me for being a bit dense here, but I'm rather new at scripting. -- Regards, Ernie 100% Microsoft and Intel free -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Stephen, I obviously didn't make myself clear enough. I have one disk dedicated to backups. This is the backup script my-rsync, which I put in /usr/local/bin: #== #! /bin/bash # /usr/local/bin/my-rsync ### # Backup Script ### BACKUP_TO=/mnt/backup EXCLUDE=/usr/local/bin/rsync-exclude echo " Mounting boot partition..." mount /boot -o ro echo echo " Mounting backup disk..." mount $BACKUP_TO sleep 4 echo echo " Performing backup..." echo rsync --progress --delete -av --exclude-from=$EXCLUDE / \ $BACKUP_TO/rsync/ echo echo " Unmounting boot and backup partitions..." /bin/umount -l /boot /bin/umount -l $BACKUP_TO echo echo " Spinning down backup disk..." /sbin/hdparm -y /dev/hdc# spin down disk #== As root, I did: chmod a+x /usr/local/bin/my-rsync ...to make the script executable In the script you'll see "EXCLUDE=/usr/local/bin/rsync-exclude". This means that you list all the files you want to exclude from the backup in a file you create (I called mine rsync-exclude and put it in /usr/local/bin). See `man rsync` for more information. My /usr/local/bin/rsync-exclude looks like this: #== - /tmp/ - /var/lib/init.d/ - /mnt/backup/ - /mnt/cdrom/ - /mnt/floppy/ - /proc/ - /usr/portage/distfiles/ - /root/.ccache/ - /home/peter/.ccache/ #== As Andrew Farmer suggested, you can use /etc/cron.daily to have it run automatically. Before you do so, run it manually to make sure it works for you, altering the mountpoint ($BACKUP_TO) and /dev/hdc in the "spin down disk" part to suit your installation. My /etc/fstab entry for $BACKUP_TO reads: /dev/hdc1 /mnt/backup ext3 noauto,noatime,users 0 0 ...so, like /boot, it's only mounted when needed. When you are ready to add the backup script to cron.daily, become root and do: cp /usr/local/bin/my-rsync /etc/cron.daily/ Hope this helps you. Peter -- == Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+ == -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Fri, 29 Aug 2003, Stephen Liu wrote: > Date: 29 Aug 2003 11:57:47 +0800 > From: Stephen Liu <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Re: [gentoo-user] HD back up > > Hi Andrew > > On Fri, 2003-08-29 at 11:35, Andrew Gaffney wrote: > - snip - > > > > > > $ locate rsync-exclude > > > could not find this file > > > > Create this file yourself and populate it. > > What will be the standard content of > > "rsync-exclude" > > other than adding following > > MAILTO=root > # do rsync backup nightly > 0 1 * * * /usr/local/bin/my-rsync > > What shall I change "my-rsync" to? > > Thanks in advance. > > B.R. > Stephen > I guess "my-rsync" is just the backupscript you put in /usr/local/bin/ > > > To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. > > -- > [EMAIL PROTECTED] mailing list > > > > -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Andrew On Fri, 2003-08-29 at 11:35, Andrew Gaffney wrote: - snip - > > > > $ locate rsync-exclude > > could not find this file > > Create this file yourself and populate it. What will be the standard content of "rsync-exclude" other than adding following MAILTO=root # do rsync backup nightly 0 1 * * * /usr/local/bin/my-rsync What shall I change "my-rsync" to? Thanks in advance. B.R. Stephen To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Andrew, Thanks for your advice. On Fri, 2003-08-29 at 10:21, Andrew Farmer wrote: > > > > $ cat /etc/crontab > > SHELL=/bin/bash > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > > MAILTO=root > > HOME=/ > > > > # run-parts > > 01 * * * * root run-parts /etc/cron.hourly > > 02 4 * * * root run-parts /etc/cron.daily > > 22 4 * * 0 root run-parts /etc/cron.weekly > > 42 4 1 * * root run-parts /etc/cron.monthly > > > > Shall I retain the above and add > > > > MAILTO= > > # do rsync backup nightly > > 0 1 * * * /usr/local/bin/my-rsync > > > No. Use /etc/cron.daily. > > (Look in the directory; any files set +x will be run daily. Root's > crontab should not be modified, really.) # ls /etc/cron.daily/ 00-logwatch logrotaterpm tetex.cron 0anacron makewhatis.cron slocate.cron tmpwatch # cat /etc/cron.daily/0anacron #!/bin/sh # # anacron's cron script # # This script updates anacron time stamps. It is called through run-parts # either by anacron itself or by cron. # # The script is called "0anacron" to assure that it will be executed # _before_ all other scripts. anacron -u cron.daily I could not discover "any files set +x" Thanks B.Regards Stephen To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Stephen Liu wrote: Hi Pupeno, On Fri, 2003-08-29 at 10:25, Pupeno wrote: Remember to have /usr/local/bin/rsync-exclude with the list of files/directories to exclude. $ ls /usr/local/bin/ cdrwtool mkudffs scalc simpress spadmin tkfax installwatch pktsetup sdraw smath swriter tkscan scalc, simpress, sdraw, smath are symbolic links. "rsync-exclude" is not there $ which rsync /usr/bin/rsync $ locate rsync-exclude could not find this file Create this file yourself and populate it. -- Andrew Gaffney -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Pupeno, On Fri, 2003-08-29 at 10:25, Pupeno wrote: > Remember to have /usr/local/bin/rsync-exclude with the list of > files/directories to exclude. $ ls /usr/local/bin/ cdrwtool mkudffs scalc simpress spadmin tkfax installwatch pktsetup sdraw smath swriter tkscan scalc, simpress, sdraw, smath are symbolic links. "rsync-exclude" is not there $ which rsync /usr/bin/rsync $ locate rsync-exclude could not find this file B.Regards Stephen > El Jueves Agosto 28 2003 22:45, Stephen Liu escribió: > > Hi Peter, > > > > Thanks for your advice. > > > > $ cat /etc/crontab > > SHELL=/bin/bash > > PATH=/sbin:/bin:/usr/sbin:/usr/bin > > MAILTO=root > > HOME=/ > > > > # run-parts > > 01 * * * * root run-parts /etc/cron.hourly > > 02 4 * * * root run-parts /etc/cron.daily > > 22 4 * * 0 root run-parts /etc/cron.weekly > > 42 4 1 * * root run-parts /etc/cron.monthly > > > > > > Shall I retain the above and add > > > > MAILTO= > > # do rsync backup nightly > > 0 1 * * * /usr/local/bin/my-rsync > > > > Kindly advise. Thanks in advance. > > > > B.R. > > Stephen > > > > On Fri, 2003-08-29 at 09:03, Peter Ruskin wrote: > > > On Friday 29 Aug 2003 01:53, Stephen Liu wrote: > > > > Hi Peter, > > > > > > > > Could you please advise how to use your script to start backup. Also > > > > can backup start automatically at scheduled time? > > > > > > > > Thanks in advance. > > > > > > > > B.Regards > > > > Stephen Liu > > > > > > # chmod a+x /usr/local/bin/my-rsync > > > ...then edit root's crontab: > > > # crontab -e > > > and add these lines: > > > > > > MAILTO= > > > # do rsync backup nightly > > > 0 1 * * * /usr/local/bin/my-rsync > > > > > > then it will run at 1 o'clock every morning > > > > > > > On Fri, 2003-08-29 at 06:26, Peter Ruskin wrote: > > > > > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > > > > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > > > > > linux swap, the /boot partition and my main partition), it is an > > > > > > 80 GB HD... I have another 80 GB HD to make back ups... what > > > > > > method of backing up do you recomend me ? Something that is fast > > > > > > to recover being that I have a whole HD to do the back up ? > > > > > > Something that is faster than doing a whole 'copy' every night ? > > > > > > Thank you. > > > > > > > > > > #== > > > > > #! /bin/bash > > > > > # /usr/local/bin/my-rsync > > > > > ### > > > > > # Backup Script > > > > > ### > > > > > > > > > > BACKUP_TO=/mnt/backup > > > > > EXCLUDE=/usr/local/bin/rsync-exclude > > > > > > > > > > echo " Mounting boot partition..." > > > > > mount /boot -o ro > > > > > echo > > > > > echo " Mounting backup disk..." > > > > > mount $BACKUP_TO > > > > > sleep 4 > > > > > echo > > > > > echo " Performing backup..." > > > > > echo > > > > > rsync --progress --delete -av --exclude-from=$EXCLUDE / > > > > > $BACKUP_TO/rsync/ > > > > > > > > > > echo > > > > > echo " Unmounting boot and backup partitions..." > > > > > > > > > > /bin/umount -l /boot > > > > > /bin/umount -l $BACKUP_TO > > > > > > > > > > echo > > > > > echo " Spinning down backup disk..." > > > > > /sbin/hdparm -y /dev/hdc # spin down disk > > > > > #== > > > > > # /usr/local/bin/rsync-exclude: > > > > > - /tmp/ > > > > > - /var/lib/init.d/ > > > > > - /mnt/backup/ > > > > > - /mnt/cdrom/ > > > > > - /mnt/floppy/ > > > > > - /proc/ > > > > > - /usr/portage/distfiles/ > > > > > - /root/.ccache/ > > > > > - /home/peter/.ccache/ > > > > > #== > > > > > > > > > > > > > > > Peter To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Remember to have /usr/local/bin/rsync-exclude with the list of files/directories to exclude. El Jueves Agosto 28 2003 22:45, Stephen Liu escribió: > Hi Peter, > > Thanks for your advice. > > $ cat /etc/crontab > SHELL=/bin/bash > PATH=/sbin:/bin:/usr/sbin:/usr/bin > MAILTO=root > HOME=/ > > # run-parts > 01 * * * * root run-parts /etc/cron.hourly > 02 4 * * * root run-parts /etc/cron.daily > 22 4 * * 0 root run-parts /etc/cron.weekly > 42 4 1 * * root run-parts /etc/cron.monthly > > > Shall I retain the above and add > > MAILTO= > # do rsync backup nightly > 0 1 * * * /usr/local/bin/my-rsync > > Kindly advise. Thanks in advance. > > B.R. > Stephen > > On Fri, 2003-08-29 at 09:03, Peter Ruskin wrote: > > On Friday 29 Aug 2003 01:53, Stephen Liu wrote: > > > Hi Peter, > > > > > > Could you please advise how to use your script to start backup. Also > > > can backup start automatically at scheduled time? > > > > > > Thanks in advance. > > > > > > B.Regards > > > Stephen Liu > > > > # chmod a+x /usr/local/bin/my-rsync > > ...then edit root's crontab: > > # crontab -e > > and add these lines: > > > > MAILTO= > > # do rsync backup nightly > > 0 1 * * * /usr/local/bin/my-rsync > > > > then it will run at 1 o'clock every morning > > > > > On Fri, 2003-08-29 at 06:26, Peter Ruskin wrote: > > > > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > > > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > > > > linux swap, the /boot partition and my main partition), it is an > > > > > 80 GB HD... I have another 80 GB HD to make back ups... what > > > > > method of backing up do you recomend me ? Something that is fast > > > > > to recover being that I have a whole HD to do the back up ? > > > > > Something that is faster than doing a whole 'copy' every night ? > > > > > Thank you. > > > > > > > > #== > > > > #! /bin/bash > > > > # /usr/local/bin/my-rsync > > > > ### > > > > # Backup Script > > > > ### > > > > > > > > BACKUP_TO=/mnt/backup > > > > EXCLUDE=/usr/local/bin/rsync-exclude > > > > > > > > echo " Mounting boot partition..." > > > > mount /boot -o ro > > > > echo > > > > echo " Mounting backup disk..." > > > > mount $BACKUP_TO > > > > sleep 4 > > > > echo > > > > echo " Performing backup..." > > > > echo > > > > rsync --progress --delete -av --exclude-from=$EXCLUDE / > > > > $BACKUP_TO/rsync/ > > > > > > > > echo > > > > echo " Unmounting boot and backup partitions..." > > > > > > > > /bin/umount -l /boot > > > > /bin/umount -l $BACKUP_TO > > > > > > > > echo > > > > echo " Spinning down backup disk..." > > > > /sbin/hdparm -y /dev/hdc# spin down disk > > > > #== > > > > # /usr/local/bin/rsync-exclude: > > > > - /tmp/ > > > > - /var/lib/init.d/ > > > > - /mnt/backup/ > > > > - /mnt/cdrom/ > > > > - /mnt/floppy/ > > > > - /proc/ > > > > - /usr/portage/distfiles/ > > > > - /root/.ccache/ > > > > - /home/peter/.ccache/ > > > > #== > > > > > > > > > > > > Peter > > To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. > > -- > [EMAIL PROTECTED] mailing list - -- Pupeno: [EMAIL PROTECTED] http://www.kde.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/TrmmLr8z5XzmSDQRAnwgAKDAicotX8Swld0u4Yy1DX+M/034tgCfWrWr RB7/TdB/XXbue8AbeePT6wU= =OPpl -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
At 29 August, 2003 Stephen Liu wrote: > Hi Peter, > > Thanks for your advice. > > $ cat /etc/crontab > SHELL=/bin/bash > PATH=/sbin:/bin:/usr/sbin:/usr/bin > MAILTO=root > HOME=/ > > # run-parts > 01 * * * * root run-parts /etc/cron.hourly > 02 4 * * * root run-parts /etc/cron.daily > 22 4 * * 0 root run-parts /etc/cron.weekly > 42 4 1 * * root run-parts /etc/cron.monthly > > > Shall I retain the above and add > > MAILTO= > # do rsync backup nightly > 0 1 * * * /usr/local/bin/my-rsync > > Kindly advise. Thanks in advance. No. Use /etc/cron.daily. (Look in the directory; any files set +x will be run daily. Root's crontab should not be modified, really.) -- Andrew Farmer [EMAIL PROTECTED] pgp0.pgp Description: PGP signature
Re: [gentoo-user] HD back up
Hi Peter, Thanks for your advice. $ cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly Shall I retain the above and add MAILTO= # do rsync backup nightly 0 1 * * * /usr/local/bin/my-rsync Kindly advise. Thanks in advance. B.R. Stephen On Fri, 2003-08-29 at 09:03, Peter Ruskin wrote: > On Friday 29 Aug 2003 01:53, Stephen Liu wrote: > > Hi Peter, > > > > Could you please advise how to use your script to start backup. Also > > can backup start automatically at scheduled time? > > > > Thanks in advance. > > > > B.Regards > > Stephen Liu > > # chmod a+x /usr/local/bin/my-rsync > ...then edit root's crontab: > # crontab -e > and add these lines: > > MAILTO= > # do rsync backup nightly > 0 1 * * * /usr/local/bin/my-rsync > > then it will run at 1 o'clock every morning > > > > > On Fri, 2003-08-29 at 06:26, Peter Ruskin wrote: > > > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > > > linux swap, the /boot partition and my main partition), it is an > > > > 80 GB HD... I have another 80 GB HD to make back ups... what > > > > method of backing up do you recomend me ? Something that is fast > > > > to recover being that I have a whole HD to do the back up ? > > > > Something that is faster than doing a whole 'copy' every night ? > > > > Thank you. > > > > > > #== > > > #! /bin/bash > > > # /usr/local/bin/my-rsync > > > ### > > > # Backup Script > > > ### > > > > > > BACKUP_TO=/mnt/backup > > > EXCLUDE=/usr/local/bin/rsync-exclude > > > > > > echo " Mounting boot partition..." > > > mount /boot -o ro > > > echo > > > echo " Mounting backup disk..." > > > mount $BACKUP_TO > > > sleep 4 > > > echo > > > echo " Performing backup..." > > > echo > > > rsync --progress --delete -av --exclude-from=$EXCLUDE / > > > $BACKUP_TO/rsync/ > > > > > > echo > > > echo " Unmounting boot and backup partitions..." > > > > > > /bin/umount -l /boot > > > /bin/umount -l $BACKUP_TO > > > > > > echo > > > echo " Spinning down backup disk..." > > > /sbin/hdparm -y /dev/hdc # spin down disk > > > #== > > > # /usr/local/bin/rsync-exclude: > > > - /tmp/ > > > - /var/lib/init.d/ > > > - /mnt/backup/ > > > - /mnt/cdrom/ > > > - /mnt/floppy/ > > > - /proc/ > > > - /usr/portage/distfiles/ > > > - /root/.ccache/ > > > - /home/peter/.ccache/ > > > #== > > > > > > > > > Peter To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Friday 29 Aug 2003 01:53, Stephen Liu wrote: > Hi Peter, > > Could you please advise how to use your script to start backup. Also > can backup start automatically at scheduled time? > > Thanks in advance. > > B.Regards > Stephen Liu # chmod a+x /usr/local/bin/my-rsync ...then edit root's crontab: # crontab -e and add these lines: MAILTO= # do rsync backup nightly 0 1 * * * /usr/local/bin/my-rsync then it will run at 1 o'clock every morning > > On Fri, 2003-08-29 at 06:26, Peter Ruskin wrote: > > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > > linux swap, the /boot partition and my main partition), it is an > > > 80 GB HD... I have another 80 GB HD to make back ups... what > > > method of backing up do you recomend me ? Something that is fast > > > to recover being that I have a whole HD to do the back up ? > > > Something that is faster than doing a whole 'copy' every night ? > > > Thank you. > > > > #== > > #! /bin/bash > > # /usr/local/bin/my-rsync > > ### > > # Backup Script > > ### > > > > BACKUP_TO=/mnt/backup > > EXCLUDE=/usr/local/bin/rsync-exclude > > > > echo " Mounting boot partition..." > > mount /boot -o ro > > echo > > echo " Mounting backup disk..." > > mount $BACKUP_TO > > sleep 4 > > echo > > echo " Performing backup..." > > echo > > rsync --progress --delete -av --exclude-from=$EXCLUDE / > > $BACKUP_TO/rsync/ > > > > echo > > echo " Unmounting boot and backup partitions..." > > > > /bin/umount -l /boot > > /bin/umount -l $BACKUP_TO > > > > echo > > echo " Spinning down backup disk..." > > /sbin/hdparm -y /dev/hdc# spin down disk > > #== > > # /usr/local/bin/rsync-exclude: > > - /tmp/ > > - /var/lib/init.d/ > > - /mnt/backup/ > > - /mnt/cdrom/ > > - /mnt/floppy/ > > - /proc/ > > - /usr/portage/distfiles/ > > - /root/.ccache/ > > - /home/peter/.ccache/ > > #== > > > > > > Peter > > To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. > > -- > [EMAIL PROTECTED] mailing list -- == Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+ == -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 El Jueves Agosto 28 2003 21:46, Stephen Liu escribió: > Hi Pupeno, > > Are you connecting the backup hard drive as Master to secondary IDE or > as SLAVE to Primary IDE The HD I'm using is primary master, the back up HD is primary slave. this may not be optimal, but I have a DVD-ROM as secondary master and a CD-RW as secondary slave. Thanks. - -- Pupeno: [EMAIL PROTECTED] http://www.kde.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/TqG8Lr8z5XzmSDQRAtWjAJwLkYgSVVUOOOGTJEr797CkWfMICQCgt3a2 hK7t9QEmLhnoqLj5ziiiMbU= =r/A0 -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Peter, Could you please advise how to use your script to start backup. Also can backup start automatically at scheduled time? Thanks in advance. B.Regards Stephen Liu On Fri, 2003-08-29 at 06:26, Peter Ruskin wrote: > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > linux swap, the /boot partition and my main partition), it is an 80 > > GB HD... I have another 80 GB HD to make back ups... what method of > > backing up do you recomend me ? Something that is fast to recover > > being that I have a whole HD to do the back up ? Something that is > > faster than doing a whole 'copy' every night ? > > Thank you. > > #== > #! /bin/bash > # /usr/local/bin/my-rsync > ### > # Backup Script > ### > > BACKUP_TO=/mnt/backup > EXCLUDE=/usr/local/bin/rsync-exclude > > echo " Mounting boot partition..." > mount /boot -o ro > echo > echo " Mounting backup disk..." > mount $BACKUP_TO > sleep 4 > echo > echo " Performing backup..." > echo > rsync --progress --delete -av --exclude-from=$EXCLUDE / > $BACKUP_TO/rsync/ > > echo > echo " Unmounting boot and backup partitions..." > > /bin/umount -l /boot > /bin/umount -l $BACKUP_TO > > echo > echo " Spinning down backup disk..." > /sbin/hdparm -y /dev/hdc # spin down disk > #== > # /usr/local/bin/rsync-exclude: > - /tmp/ > - /var/lib/init.d/ > - /mnt/backup/ > - /mnt/cdrom/ > - /mnt/floppy/ > - /proc/ > - /usr/portage/distfiles/ > - /root/.ccache/ > - /home/peter/.ccache/ > #== > > Peter To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
Hi Pupeno, Are you connecting the backup hard drive as Master to secondary IDE or as SLAVE to Primary IDE Kindly advise. Thanks in advance. B.Regards Stephen Liu On Fri, 2003-08-29 at 05:06, Pupeno wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hello... I have one HD with a various partitions (10 GB NTFS, the linux swap, > the /boot partition and my main partition), it is an 80 GB HD... I have > another 80 GB HD to make back ups... what method of backing up do you > recomend me ? Something that is fast to recover being that I have a whole HD > to do the back up ? Something that is faster than doing a whole 'copy' every > night ? > Thank you. > - -- > Pupeno: [EMAIL PROTECTED] > http://www.kde.org To Get Your Own iCareHK.com Email Address? Go To www.iCareHK.com. -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What I did, diferent to you... is create exactly the same partitions in the second disk and I mount them with exactly the same hierachy as the root, but in /mnt/backup and the, rsync the whole root to /mnt/backup, so, everything should end up in it's own partition automatically, right ? Thanks. El Jueves Agosto 28 2003 21:10, Peter Ruskin escribió: > On Friday 29 Aug 2003 00:40, Pupeno wrote: > > first of all, thank you... this script was very useful. > > You're welcome. > > > I'm modifying it for my own uses... may I ask why the "sleep 4" after > > the mount ? > > The last line of the script: > /sbin/hdparm -y /dev/hdc > spins the disk down. This disk is only used for backups, so it is spun > down at the end, to reduce power and noise. The sleep is to allow time > for it to spin up again. It may not be needed but it does no harm. > > I run this daily as a cron job. After the first day it's very quick, > and it's the fastest way I've found to restore yesterday's stuff. > > Peter - -- Pupeno: [EMAIL PROTECTED] http://www.kde.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/TprZLr8z5XzmSDQRAkvoAJ4zASiJ30qK6kMTsAzE7ft9Tm3SeACdFFQ3 /P8hp1uxlz98d/kPr6DrVXk= =NFeU -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Friday 29 Aug 2003 00:40, Pupeno wrote: > first of all, thank you... this script was very useful. You're welcome. > I'm modifying it for my own uses... may I ask why the "sleep 4" after > the mount ? The last line of the script: /sbin/hdparm -y /dev/hdc spins the disk down. This disk is only used for backups, so it is spun down at the end, to reduce power and noise. The sleep is to allow time for it to spin up again. It may not be needed but it does no harm. I run this daily as a cron job. After the first day it's very quick, and it's the fastest way I've found to restore yesterday's stuff. Peter -- == Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+ == -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 first of all, thank you... this script was very useful. I'm modifying it for my own uses... may I ask why the "sleep 4" after the mount ? Thanks. El Jueves Agosto 28 2003 19:26, Peter Ruskin escribió: > On Thursday 28 Aug 2003 22:06, Pupeno wrote: > > Hello... I have one HD with a various partitions (10 GB NTFS, the > > linux swap, the /boot partition and my main partition), it is an 80 > > GB HD... I have another 80 GB HD to make back ups... what method of > > backing up do you recomend me ? Something that is fast to recover > > being that I have a whole HD to do the back up ? Something that is > > faster than doing a whole 'copy' every night ? > > Thank you. > > #== > #! /bin/bash > # /usr/local/bin/my-rsync > ### > # Backup Script > ### > > BACKUP_TO=/mnt/backup > EXCLUDE=/usr/local/bin/rsync-exclude > > echo " Mounting boot partition..." > mount /boot -o ro > echo > echo " Mounting backup disk..." > mount $BACKUP_TO > sleep 4 > echo > echo " Performing backup..." > echo > rsync --progress --delete -av --exclude-from=$EXCLUDE / > $BACKUP_TO/rsync/ > > echo > echo " Unmounting boot and backup partitions..." > > /bin/umount -l /boot > /bin/umount -l $BACKUP_TO > > echo > echo " Spinning down backup disk..." > /sbin/hdparm -y /dev/hdc # spin down disk > #== > # /usr/local/bin/rsync-exclude: > - /tmp/ > - /var/lib/init.d/ > - /mnt/backup/ > - /mnt/cdrom/ > - /mnt/floppy/ > - /proc/ > - /usr/portage/distfiles/ > - /root/.ccache/ > - /home/peter/.ccache/ > #== > > Peter - -- Pupeno: [EMAIL PROTECTED] http://www.kde.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/TpL9Lr8z5XzmSDQRAoLbAKCYo2ZhvwTiSOpadDcfM/O5qyqliACfb+i6 1gByDM5fz7WvPNF7tDTHopU= =O2En -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Thursday 28 Aug 2003 22:06, Pupeno wrote: > Hello... I have one HD with a various partitions (10 GB NTFS, the > linux swap, the /boot partition and my main partition), it is an 80 > GB HD... I have another 80 GB HD to make back ups... what method of > backing up do you recomend me ? Something that is fast to recover > being that I have a whole HD to do the back up ? Something that is > faster than doing a whole 'copy' every night ? > Thank you. #== #! /bin/bash # /usr/local/bin/my-rsync ### # Backup Script ### BACKUP_TO=/mnt/backup EXCLUDE=/usr/local/bin/rsync-exclude echo " Mounting boot partition..." mount /boot -o ro echo echo " Mounting backup disk..." mount $BACKUP_TO sleep 4 echo echo " Performing backup..." echo rsync --progress --delete -av --exclude-from=$EXCLUDE / $BACKUP_TO/rsync/ echo echo " Unmounting boot and backup partitions..." /bin/umount -l /boot /bin/umount -l $BACKUP_TO echo echo " Spinning down backup disk..." /sbin/hdparm -y /dev/hdc# spin down disk #== # /usr/local/bin/rsync-exclude: - /tmp/ - /var/lib/init.d/ - /mnt/backup/ - /mnt/cdrom/ - /mnt/floppy/ - /proc/ - /usr/portage/distfiles/ - /root/.ccache/ - /home/peter/.ccache/ #== Peter -- == Gentoo: Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) kernel-2.4.22_pre2-gss i686 AMD Athlon(tm) XP 1600+ == -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
On Aug 28, 2003 [18:06] -0300, Pupeno <[EMAIL PROTECTED]> wrote: > > Hello... I have one HD with a various partitions (10 GB NTFS, the linux swap, > the /boot partition and my main partition), it is an 80 GB HD... I have > another 80 GB HD to make back ups... what method of backing up do you > recomend me ? Something that is fast to recover being that I have a whole HD > to do the back up ? Something that is faster than doing a whole 'copy' every > night ? > Thank you. > - -- > Pupeno: [EMAIL PROTECTED] > http://www.kde.org > > -- > [EMAIL PROTECTED] mailing list > Are you planing on backing up the NTFS as well, cause if so you'll need to do raw data back up (ie. dump the whole partition). The last time I check NTFS didn't have write support under linux. Depending on your linux file systems as well, you might consider using 'dump'. -- Cheers, John-Paul Andrusky <[EMAIL PROTECTED]> GnuPG Key ID: B6959A50 pgp0.pgp Description: PGP signature
Re: [gentoo-user] HD back up
On Thursday 28 August 2003 21:06, Pupeno wrote: > Hello... I have one HD with a various partitions (10 GB NTFS, the linux > swap, the /boot partition and my main partition), it is an 80 GB HD... I > have another 80 GB HD to make back ups... what method of backing up do you > recomend me ? Something that is fast to recover being that I have a whole > HD to do the back up ? Something that is faster than doing a whole 'copy' > every night ? > Thank you. I would do a complete tape-backup and then regularly incremental backups on tape too. Glück Auf Volker -- Conclusions In a straight-up fight, the Empire squashes the Federation like a bug. Even with its numerical advantage removed, the Empire would still squash the Federation like a bug. Accept it. -Michael Wong -- [EMAIL PROTECTED] mailing list
Re: [gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 28 August 2003 22:06, Pupeno wrote: > Hello... I have one HD with a various partitions (10 GB NTFS, the linux > swap, the /boot partition and my main partition), it is an 80 GB HD... I > have another 80 GB HD to make back ups... what method of backing up do you > recomend me ? Something that is fast to recover being that I have a whole > HD to do the back up ? Something that is faster than doing a whole 'copy' > every night ? > Thank you. I'd say your best bet is rsync. Something possibly as simple as 'rsync -xlpogt --delete-after / /mnt/backup'. Never really managed to get my head round rsync properly :o) - -- Mike Williams -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/TnR0InuLMrk7bIwRAtNIAJ9kCszRUkPjI1yQ+kUWepfZS1TsbwCeJDRG 0gEBoE1phmYqQRuaChIf2IQ= =P7xs -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list
[gentoo-user] HD back up
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello... I have one HD with a various partitions (10 GB NTFS, the linux swap, the /boot partition and my main partition), it is an 80 GB HD... I have another 80 GB HD to make back ups... what method of backing up do you recomend me ? Something that is fast to recover being that I have a whole HD to do the back up ? Something that is faster than doing a whole 'copy' every night ? Thank you. - -- Pupeno: [EMAIL PROTECTED] http://www.kde.org -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/Tm7rLr8z5XzmSDQRAg0mAKCPdtdGlPOSrZSG5Djn98n4S0mXaACfeKOE S9ABaQre3gVqf/jPK0eqTHY= =79aI -END PGP SIGNATURE- -- [EMAIL PROTECTED] mailing list