[Discuss] Ubuntu USB Drives appending _ to folder
Nuno Sucena Almeida
nuno at aeminium.org
Wed Jun 20 10:27:19 EDT 2012
On 06/20/2012 09:52 AM, John Abreau wrote:
> Whenever this happens, the old directories will be on the root filesystem.
> I suppose your script could check for that.
>
> mount | grep ' on /media/Nagios_Backup' | cut -d' ' -f3
>
> will return the directory with the prefix "Nagios_Backup" that is actually
> in use as a mount point.
A few additions:
the command 'mountpoint -q' to check the mount mount might be useful
(On ubuntu 12.04 it's on the initscripts package). A lazy umount can
also help (umount -rl).
I would setup a fixed mount point, instead of relying on automount,
using the UUID= or LABEL= on the fstab, see the blkid command.
I have something like the following to backup the whole system to
another raid disk system. You can improve it by using rsnapshot instead.
Regards,
Nuno
fstab, change where needed:
UUID=put_here_the_blkid_uuid_for_the_usb_drive /backup/system ext4
noauto,relatime,errors=remount-ro 0 2
simple script:
#!/usr/bin/env bash
BACKUP=/backup/system
function cleanup {
# lazy umount, remount read-only if fails
umount -rl ${BACKUP}
}
trap "cleanup" exit
echo "* begin $(date)"
mountpoint -q ${BACKUP} || mount ${BACKUP}
rsync -axhhS --stats / ${BACKUP}
rsync -axhhS --stats /boot/ ${BACKUP}/boot/
echo "* end $(date)"
--
http://aeminium.org/nuno/
More information about the Discuss
mailing list