Cron pattern to copy over a USB drive
-
Hi sky_watcher,
You shouldn't have to worry about mounting the USB drive with fstab as Fox suggested - V3 Mango ES units have usbmount installed to facilitate the USB Utilities actions. It will mount the first USB stick plugged in at
/media/usb0
After that, your choices are
- Set Mango to backup directly to the USB drive instead of to the /opt/mango/backup folder. This is in the system settings
- Set up a cron pattern as Fox suggested and add that to a crontab either via
crontab -e
to invoke the script or simply add the script/etc/cron.daily/
(and then you don't need to generate the cron pattern but you have less control). - Set a schedule in Mango and use event handlers to copy / move files as necessary.
-
Thanks Phil!
Wasn't entirely sure on if fstab was applicable but felt it was good enough to mention for how a linux fs works at least.Fox
-
True, it's applicable on any other Linux system - and you provided adequate notice that it's a bad place to make a mistake!
-
@phildunlap Hi Phil! Thanks for your advice.
When I try to give that path to the backup directory I get an error:
-
Did you see over SSH or Webmin if the device is actually mounted there? It could also be a permissions issue, if Mango is running as a non-root user but that mounting point is owned by root. Check with
ls -l /media/
-
@phildunlap On Mango I'm logged in with admin.
The mounting point is owned by root.
-
Try chown'ing that to the 'mango' user like,
sudo chown -R mango:mango /media/usb*
-
@phildunlap I don't have permission to change the owner for /media/usb0/. Could be a problem because the USB is mounted there?
-
I wouldn't think so. Did you sudo? What response did you get from running the command?
-
I edited the command, as there was no reason to give the mango user access to /media/boot/
-
This is the command and the error:
-
It could be caused by the filesystem type not supporting Linux permissions. Perhaps you could reformat the drive to an ext3 or ext4 filesystem?
-
@phildunlap I get same error in mango and the drive is formatted as ext4, is mounted and the mango user has wrights to write on the usb0 folder.
-
Hi guys, just gonna give a suggestion, cd into /media/usb0/
then do the chown againsudo chown mango:mango . -R
then enter the
ls -la
That should give us all info for that directory to start. Skywatcher, assuming you are using putty if you highlight the text, you can then paste into here with code tags.
You should be able to create a file just with
touch file
no sudo required -
Also ensure the mango user has at least read permissions to /media
-
@mattfox said in Cron pattern to copy over a USB drive:
total 24 drwxr-xr-x 3 mango mango 4096 Aug 29 14:54 . drwxr-xr-x 12 root root 4096 Aug 29 11:45 .. drwx------ 2 mango mango 16384 Aug 29 14:54 lost+found root@mangoES3324:/media/usb0$touch file root@mangoES3324:/media/usb0$la -ls total 16 0 -rw-r--r-- 1 root root 0 Aug 29 15:22 file 16 drwx------ 2 mango mango 16384 Aug 29 14:54 lost+found
-
You're logged in as root, you need to be the mango user if you want to test effectively, also please use those code tags, it makes a lot easier to read.
Edit: Thanks!
Ok dir permissions look good. Try doing the touch newfile as mango, if you can do that, there should be no issues with mango creating files. I'll check my server for you soon if wanted to compare configs.Fox
-
mango@mangoES3324:/media/usb0$ls file lost+found mango@mangoES3324:/media/usb0$touch newfile mango@mangoES3324:/media/usb0$ls file lost+found newfile mango@mangoES3324:/media/usb0$ls -la total 24 drwxr-xr-x 3 mango mango 4096 Aug 29 15:43 . drwxr-xr-x 12 root root 4096 Aug 29 11:45 .. -rw-r--r-- 1 root root 0 Aug 29 15:22 file drwx------ 2 mango mango 16384 Aug 29 14:54 lost+found -rw-r--r-- 1 mango mango 0 Aug 29 15:43 newfile
-
Perfect, try doing backups now with mango
-
ok, now worked, I can use that path and my back-up was saved there.
Also I have a question, this feature of writing directly the location of the USB drive into the Backup Directory works only in V3? In V2.8 is it working or not?