Backup with Removable Drive


#1

Hello. When using the NethServer Backup system, is it possible to have it work properly with removing a USB disk? Say for example that it backs up at 4:00 then you remove the drive to take home with you. What would be the best way to accomplish this?

Thanks.

P.S. It’s possible to backup ownCloud directories correct?


(Vasco) #2

Yes, you can remove the drive.
First you need to unmount and then disconnect the drive

The ownCloud data and MySQL database are included in the backup


#3

Is there some way to automate the unmount?


(Jose "Martin" Abeleira. AKA Marto) #4

add a crontab to run umount at certain time, or after backup finishes


(Jose "Martin" Abeleira. AKA Marto) #5

i woudl do it with a cron backup, lets say your disk is /dev/sdb1

df -v | grep /dev/sdb1
if [ $? -eq 0 ]
then
/bin/mount /dev/sdb1 /backup
if [ $? -eq 0 ]
fi


(Jose "Martin" Abeleira. AKA Marto) #6

sorry wasnt finished

i woudl do it with a cron backup, lets say your disk is /dev/sdb1

df -v | grep /dev/sdb1
if [ $? -eq 0 ]
then
/bin/mount /dev/sdb1 /backup
if [ $? -eq 0 ]
then
echo "Backup failed couldn’t mount drive"
exit 99
fi
fi
tar -cvf /backup/mybackup.tar --exclude=/dev --exclude=/tmp --exclude=/proc
/
if [ $? -eq 0 ]
then
echo "Backup finished ok"
umount /dev/sdb1
else
echo "Backup failed"
umount /dev/sbd1
fi

you can always improve it add more controls, parameters, test the tar file
after finishing etc.


(Alessio Fattorini) #7

Backup procedure mount the disk at the beginning and umount it when finished. Don’t worry :wink:


#8

I understand. However in this use case the server is headless and I just want to have the usb drive be inserted and removed with more or less automatic mounting/unmounting (when backup is complete etc.). Can the NethServer backup module accommodate that, or a Bash script the best option?


(Stefano) #9

@Gardia, IMO Alessio already answered to your question…
if not, please be verbose :slight_smile:


(Jose "Martin" Abeleira. AKA Marto) #10

i posted a bash script fro backup which i’m using for my fedora and works
fine. Take a look, if you can’t find it i’ll post it back


#11

Oh!!! Totally misread that, I apologize.

I though @alefattorini was saying that I had to mount/unmount the disk, not that the backup module does that itself. :smiley: