On 19 Aug 00:55, steve-ALUG@hst.me.uk wrote:
Hi Gurus!
I've been given a Netgear SC101 which I'm intending to use for backups. I found a post somewhere about how to mount it, and I have mounted it, or at least I thought I had until I rebooted and it was no-longer mounted.
The steps I have to take are:
sudo modprobe nbd sudo ut listall sudo ut attach {DRIVE_ID_FROM_LISTALL} /dev/nbd0 sudo mount -t ext4 /mnt/sc101 /dev/nbd0
Line 1 adds a device driver to the kernel line 2 finds the drive's "id". You only need to run this once - the ID doesn't change line 3 "attaches" the drive to the system. line 4 mounts the block device at my chosen mount point.
I've added a line to FSTab to take care of line 4, but the problem is, I seem to need to do line 1 and line 3 after a reboot before I can mount it.
Q1: How can I make a modprobe "stick" to survive a reboot?
add it in /etc/modules
Q2: Where should I execute line 3?
Well, you want it to happen before the fstab comes up, so I'd be tempted to add a udev rule, as I'm assuming that a kernel event arrises after the modprobe that should be trappable to run a command for the attach... Either that or add a upstart job for it, should be simple enough it's only got to exec the attach, after all.
Q3: Should I should manually mount there too, rather than using FSTab?
Leaving it in fstab gives a fairly clear view of what you're expecting, so that's probably as good a place as any to be honest.
I'm attempting to use BackupPC to backup my files. This runs as a service, and requires that drive to be running to start.
Q4: Is there a way to conditionally start a service, dependant on whether the drive is present or not, or should I just let it attempt to auto-start and live with it failing if the drive's not there?
Well, if you wrote an upstart job to do the attach and mount, then you could get the backuppc job to rely on that having been run.
Any help much appreciated!
BTW, the reason I'm attempting to use BackupPC is because it "folds" identical files from multiple PCs into 1, i.e. it doesn't store multiple copies - i.e. it de-duplicates the backup, hopefully allowing me to backup multiple machines without buying loads of disks!
Personally I use dirvish, but that hasn't got quite such a pretty interface to play with, and doesn't squish identical files from multiple machines, but does just hard linking for the particular backup it's doing.
Cheers,