-1

I've recently installed a new OwnCloud server, I have 2 encrypted usb hard drives that I will keep swapping over.

I'm looking at ways to script the backup. The hard drives are formatted in NTFS to allow me to read the drives on a windows pc.

I can figure out the script myself, but i'm struggling with the simple things first.

  • With the drive plugged in I can see it's loaded as sdb with two partitions of sdb1 and sdb2
  • How do I check if this is mounted so I can copy the files, also is there a way to automount this?

EDIT: I can manually mount the drive using the following; mount -t ntfs-3g /dev/sdb2 /media/backup

Nathan
  • 165
  • 8

1 Answers1

1

I would not check if it's mounted, I would mount it myself. And, I would mount by uuid, so like /dev/disk/by-uuid/*. You can do ls -l there to see what is what. By using uuid, you will know the block device name is always the same.

The script would be:

  • mount
  • backup
  • unmount
  • Send e-mail that it's done

BTW, if you can mount just like that, how is it encrypted?

BTW2: full atomic backups with owncloud may be tricky. There is an SQL DB to deal with, but just copying the files and dumping the DB may give you an inconsistent backup, because it's not an atomic operation.

Halfgaar
  • 7,921
  • 5
  • 42
  • 81
  • You have to type in a key no the physical keypad on the external hard drive first. I've been following the advice from OwnCloud on how to backup. Also the hard drive will be swapped, does this not mean the uuid will change? – Nathan Aug 15 '17 at 14:18
  • Your script can check for the presence of either uuid. – Halfgaar Aug 15 '17 at 14:29