coverup Posted April 28, 2008 Report Share Posted April 28, 2008 I consider getting a USB harddrive to do overnight backups. It will be used in my office, and they won't buy from ebay, etc, so it has to be a brand name available through retail. I can format it to ext3, etc, that is not a problem. Also, I would like the drive to be turned on automatically at around 4am in the morning, get mounted, have backup files written onto, then get unmounted and powered off. If the drive was powered 24/7, mounting/unmounting would be a matter for a simple cron script. Is it possible to power a USB HDD on demand, and what brand does have this feature? Quote Link to comment Share on other sites More sharing options...
xboxboy Posted April 28, 2008 Report Share Posted April 28, 2008 I know my own Western Digital usb external drive has to be powered from the wall. If you could get a timer to run that then it may work for you. I dont sorry.... I only use mine for backing up my pictures and files and hence only gets turned on once in a while. Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted April 28, 2008 Report Share Posted April 28, 2008 Lacie do hard disks of about 1TB for 100GBP but require external power source. I have a 160GB USB attached - powered from USB socket so does not require external power source. This one is Freecom branded. If it's directly connected to the USB socket and drawing it's power from here it will always be powered on. Of course, you can just issue mount/unmount commands when you want to use it, so the script for the cron job would do this anyhow. You'd have to check power management and see if you can set drive spin down when it's not being used for a certain amount of time to help extend the life of the hard disk without wearing it out unnecessarily. Alternatively, look at the external power source drives - they aren't exactly portable as such, and they (going by my IOMEGA 1TB) will have power down on the drive when it's been idle for a certain amount of time, but the device is powered and connectable via a network to the computer. I don't have the Lacie one, so presume this is USB only and no idea if it has it's own internal power down options. Quote Link to comment Share on other sites More sharing options...
coverup Posted April 28, 2008 Author Report Share Posted April 28, 2008 Thanks for the replies. The drive will be used with desktop, therefore an AC powered option would suit me. Apparently using such drives with linux poses another challenge. From numerous articles on the web, it appears that the power management logic on those drives does spin them down after about 10-15 min of inactivity (that's what I want!), but waking them up from standby may be a problem. The drive can be put back to service by unplugging then reconnecting the USB cable, but this is not a solution since the backup script runs at 4am in the morning, when there is nobody there. The standby option can be disabled, but I want it to be functional to protect the drive from wear and overheating. Can anybody confirm/disprove this, or better recommend a drive which has power management supported by linux, or maybe have linux support mentioned on the box? Quote Link to comment Share on other sites More sharing options...
ianw1974 Posted April 29, 2008 Report Share Posted April 29, 2008 I never had this problem. I'm using an IOMEGA Storcenter which is network-attached though, so it's not USB attached. Access is via Windows Shares or FTP (even better for Linux). I can't comment if the USB device will work the same or differently. Quote Link to comment Share on other sites More sharing options...
coverup Posted April 29, 2008 Author Report Share Posted April 29, 2008 I never had this problem. I'm using an IOMEGA Storcenter which is network-attached though, so it's not USB attached. Access is via Windows Shares or FTP (even better for Linux). I can't comment if the USB device will work the same or differently. Do you have to type in an ftp login/password every time you want to access the drive? Also, does the drive have to have an IP address assigned to it? In that case this solution does not suit me. Quote Link to comment Share on other sites More sharing options...
paul Posted April 29, 2008 Report Share Posted April 29, 2008 I use a USB attached drive .. sun bright 3.5" HDD enclosure .. with a drive in it .. might be 500g ? and a script #!/bin/bash # Make sure only root can run our script if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi # set up some variables .. configurable RDIFF=/usr/bin/rdiff-backup RDIFFSTATS=/usr/bin/rdiff-backup-statistics RDIFFOPTS=" --exclude-sockets" EXCLUDE="/tmp /mnt /dev /proc /cdrom /sys" DEST=/mnt/backup SRC=/ LOGFILE=/tmp/backup.log ERRORLOG=/tmp/backup.errors TIMELOG=/tmp/backup.timeTaken MAILER=/usr/bin/mailx EMAIL=postmaster@loudas.com # how long to keep backups for ex: 5W = 5 weeks WEEKS=5W #note: e2label /dev/sda1 BACKUP LABEL=BACKUP #note: get UUID by executing "blkid /dev/sda1" UUID="1005963f-5adc-4f23-868e-7df30785563f" # is the backup drive already mounted? mount -l |grep $LABEL > /dev/null BKUPMOUNT=$? if [ $BKUPMOUNT == 0 ] then echo "Backup drive is already mounted" > $ERRORLOG echo "I'm bailing out .. something might be wrong" >> $ERRORLOG mount -l | grep $LABEL >> $ERRORLOG cat $ERRORLOG | $MAILER -s "Backup report" $EMAIL exit 1; fi #mount /mnt/backup mount -U $UUID $DEST EXC="" for i in $EXCLUDE do EXC="$EXC --exclude $i" done # clear the log files first echo "" > $LOGFILE echo "" > $ERRORLOG STARTTIME=`date +%R` echo "Cleaning up old backups" >> $LOGFILE $RDIFF --remove-older-than $WEEKS $DEST >> $LOGFILE 2>> $ERRORLOG echo -n "Running backup" >> $LOGFILE echo "" >> $ERRORLOG $RDIFF $RDIFFOPTS $EXC $SRC $DEST >> $LOGFILE 2>> $ERRORLOG echo -n " .......... [ DONE ]" >> $LOGFILE 2>> $ERRORLOG echo "" >> $LOGFILE 2>> $ERRORLOG $RDIFF -l $DEST >> $LOGFILE 2>> $ERRORLOG echo " ------------- " >> $LOGFILE echo " DISK SPACE " >> $LOGFILE df -h | grep -i size >> $LOGFILE 2>> $ERRORLOG df -h | grep $DEST >> $LOGFILE 2>> $ERRORLOG echo "" >> $LOGFILE echo " ------------- " >> $LOGFILE echo " RDIFF STATISTICS " >> $LOGFILE $RDIFFSTATS $DEST >> $LOGFILE echo "" >> $LOGFILE echo " ------------- " >> $LOGFILE echo " ERRORS " >> $LOGFILE cat $ERRORLOG >> $LOGFILE echo " ------------- " >> $LOGFILE echo " TIME TAKEN " >> $LOGFILE #cat $TIMELOG >> $LOGFILE echo "" >> $LOGFILE echo -n "Start time: " >> $LOGFILE echo -n $STARTTIME >> $LOGFILE echo "" >> $LOGFILE echo -n "Finish time: " >> $LOGFILE ENDTIME=`date +%R` echo -n $ENDTIME >> $LOGFILE echo "" >> $LOGFILE cat $LOGFILE | $MAILER -s "Backup report" $EMAIL umount $DEST Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.