The backup disk is an NTFS disk (I never got round to changing to ext
Problem was that the backup disk wasn't being automatically mounted fr all users, so when I try to run my backup script as a user it would fail miserably.
I could mount the disk through the X system explorer without problem. But if I booted the machine and hadn't explicitly/manually mounted the backup disk my script would fail. This becomes a problem when trying to access that disk either from a remote ssh connection or through an automated process (eg cron backup).
After a bit of reading I ended up sorting the problem by adding an entry to the /etc/fstab file. This tells the system how to mount the disks.
Using gparted (a partitioning tool in Gnome) I was able to find the references for my disks that the system understood....
/dev/sdb1 - is the 1st partition on the disk labelled sdb, this is my boot partition
/dev/sdb2 - is the 2nd partition on the disk labelled sdb, this is the system + /home partition
/dev/sda1 - is the backup disk. It's before the other disk (sdA vs sdB) I think because the backup disk is on the old style ATA connector, the main disk is SATA.
I added the following line to /etc/fstab:
/dev/sda1 /media/backup ntfs-3g defaults 0 0
- "/dev/sda1" is telling system this line is about that disk partition.
- "/media/backup" is telling the system at what point to mount the partition, meaning users should be able to access the drive by navigating to /media/backup
- "ntfs-3g" is a reference to the software that should read the disk. I think this is like a driver for the filesystem, but don't quote me on that!
So, as root:
$ mkdir /media/backup
That dir gets created as root, meaning users can't write to it. So when I run my backup script as my user it fails. Not ideal.
So with my limited Linux knowledge I have 2 options:
set permissions to write for everyone set the group to one my user is a member of
I went for option 2, setting the group to my user group. In reality the backup drive will only be used by my user.
I should probably change it to a group that all users are a members of to do it properly. No doubt someone that knows more about *nix than I do will tell me of a better way to do things!
All done. Now when I log in I can read from the backup disk that appears to live at /media/backup. More importantly I can run my backup script (rsync).
Some more details here:
Including some info on some of the options available in the last 3 columns I haven't explained (as I used defaults).
19-April-2010 and Motorola Dext
My Motorola Dext fstab entry now reads:
UUID=3732-6131 /media/droid vfat defaults,user 0 0
Where UUID is the ID of the memory card, /media/droid is the mount point in the system, vfat is the filesystem driver. The important bit is the options field of the fstab file which reads 'defaults, user' meaning "use the defaults" (I don't know what they are!) and "user" to tell fstab that all users can mount this drive.
I shall be adding 'user' to the options for the NTFS backup drive in my fstab shortly!