Ask Your Question
1

data backup on usb 500gb portable drive

asked 2013-10-03 19:04:46 -0500

slapper gravatar image

updated 2013-10-03 19:06:53 -0500

I like to use crontabs to execute a copyall command that I created to backup a 50gb directory to 500gb usb portable drive. Monday backs up to monday directory on the portable. Tuesday backs up to Tuesday on the portable. Wenesday .... and so forth.

Each week i take the portable offsite and put on a new one.

My problem is that when I switch drives the directory for the portable changes directoty name.

One portable 500 GB drive .... when I plug in the USB Cable is refers to the directory /run/media/root/14EB-1D97

When I take away the first drive and then add the next portable drive th edirectory will be /run/media/root/16EC-1E87

This makes it impossible to swap usb portables without changing my command in cron.

Any suggestions

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-10-03 21:29:58 -0500

sea gravatar image

updated 2013-10-03 21:32:55 -0500

First of all, make the cron to execute a script, be aware for the script remain the very same rules!

TARGET_DIR=$(/bin/ls -d /run/media/root/[0-9][A-Z]-*|/bin/awk '{print $1}') # This will use the first found entry in /run/media/root matching [0-9][A-Z]-*
/bin/cp $BACKUP_TARBALL $TARGET_DIR/$weekday/  # Or whatever your code is..

Hope this helps

edit flag offensive delete link more
0

answered 2013-10-04 10:01:17 -0500

none gravatar image

updated 2013-10-04 10:02:41 -0500

You could set label on disk (filesystem), and then the path will be: /run/media/root/label/. If this is ext2/3/4, then use: e2label

Ofcourse you must remember to do it for all your drives as a part of disk preparation :)

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-10-03 19:04:46 -0500

Seen: 208 times

Last updated: Oct 04 '13