Backup with Removable Drive

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?

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

Is there some way to automate the unmount?

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

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

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.

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

1 Like

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?

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

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

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:

1 Like