Mounting & Authenticating Hard Drives Automatically at Boot

I am trying to get my OpenSUSE 13.1 installation to mount all my physical drives at startup, without asking me to type in my password before those drives are accessible. For example, if I start Clementine, it looks for my music collection on one of the drives that must be authenticated prior to access. Unless I have already tried to access this drive and put in my password, Clementine shows that there is no music collection and I have to start the indexing process all over again.

So, I was thinking that if the drives are in the fstab file, then I won’t have to authenticate via password when the system boots and the files on those drives will be immediately accessible. (Someone please tell me if this is not correct.) I have five physical drives in my system, but only three of these drives show up in my fstab file.


# cat /etc/fstab
/dev/disk/by-id/ata-ST3500320AS_9QM4ESW9-part2 swap                 swap       defaults              0 0
/dev/disk/by-id/ata-Corsair_Force_GT_14217902000100380074-part1 /                    ext4       noatime,defaults              1 1
/dev/disk/by-id/ata-Corsair_Force_GT_14217902000100380074-part2 /home                ext4       noatime,defaults              1 2
/dev/disk/by-id/ata-WDC_WD10EAVS-00D7B1_WD-WCAU45740635-part1 /run/media/mxc/WDExternal ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8,nofail 0 0

I have tried to add the other drives using the partition manager, but it will not add them to the fstab file. The drives in question are formatted NTFS and are used also in Windows 7. I am thinking that because the labels I gave those drives under Win7 have spaces and non-alphanumeric characters in them (e.g. “WD Blue HDD (1TB)”) that the partitioner is having problems with them. Again, this is just a guess on my part…really not sure why they can’t be added to fstab, and if they were, if they would allow me to access their contents without entering my password.

Here is some more detail on the file systems:


# df -T
Filesystem     Type     1K-blocks      Used Available Use% Mounted on
/dev/sdb1      ext4      40185208   8667716  29453108  23% /
devtmpfs       devtmpfs   4072916         8   4072908   1% /dev
tmpfs          tmpfs      4087324        84   4087240   1% /dev/shm
tmpfs          tmpfs      4087324      4744   4082580   1% /run
tmpfs          tmpfs      4087324         0   4087324   0% /sys/fs/cgroup
tmpfs          tmpfs      4087324      4744   4082580   1% /var/run
tmpfs          tmpfs      4087324      4744   4082580   1% /var/lock
/dev/sdb2      ext4      74931352   4457964  66644040   7% /home
/dev/sde1      fuseblk  976760000 440134184 536625816  46% /run/media/mxc/WDExternal
/dev/sdd1      fuseblk  976759804 113126368 863633436  12% /run/media/mxc/WD Blue HDD (1TB)
/dev/sdc1      fuseblk  484476924  57184308 427292616  12% /run/media/mxc/Seagate HDD (500GB)
/dev/sda2      fuseblk  244093948  41209420 202884528  17% /run/media/mxc/Samsung 840 Evo SSD

As you can see, three of the drives/partitions have labels with spaces and parentheses, which I think are causing the problems. So my question is, if my assumptions above are correct, what is the best way to go about renaming these drives, adding them to fstab, and making sure they auto-mount at startup without having to type in my password?

On 2014-07-15 03:26, mxcrowe wrote:

> Code:
> --------------------
> /dev/disk/by-id/ata-WDC_WD10EAVS-00D7B1_WD-WCAU45740635-part1 /run/media/mxc/WDExternal ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8,nofail 0 0
>
> --------------------

Never put entries to /run/media in fstab. Use entries to /mnt or some
other place that is not a ram-disk. Not /media, either.

Just edit the file yourself, like this:


>   /dev/disk/by-id/ata-WDC_WD10EAVS-00D7B1_WD-WCAU45740635-part1 /mnt/WDExternal ntfs-3g    defaults,nofail   0 0

You can also add “noauto” if you wish. May boot faster, but then you
have to mount the partition manually.

Be sure to create empty directory “/mnt/WDExternal” yourself.

I have tried to add the other drives using the partition manager, but it
will not add them to the fstab file. The drives in question are
formatted NTFS and are used also in Windows 7. I am thinking that
because the labels I gave those drives under Win7 have spaces and
non-alphanumeric characters in them (e.g. “WD Blue HDD (1TB)”) that the
partitioner is having problems with them.

It might, yes. But then you can use id, or uuid. Just add appropriate
entries:


>   /dev/disk/by-uuid/FINDTHEUUUID_writeithere /windows/C   ntfs-3g    defaults,nofail   0 0

This will list the uuids for you:


ls - /dev/disk/by-uuid/

and the labels


ls - /dev/disk/by-uuid/

or this other command:


> lsblk --output NAME,FSTYPE,LABEL,UUID,PARTLABEL,PARTUUID,MOUNTPOINT,SIZE /dev/sdb

To use labels with spaces, maybe you have to escape them. I’ve never
used labels with spaces.

To modify the labels, being Windows partitions, better use Windows.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Thanks Carlos,
I tested your recommendations using the WDExternal drive, which has no spaces and was already working with the settings as they were. The drive was added to fstab by the partition manager, though perhaps I should have used some other settings or entries so that it didn’t add it as /run/media/mxc…but it all seemed rather automatic to me. In any case, I did the manual edit to fstab for that drive and created a directory in /mnt and rebooted - all seems to work smoothly. I will now try tracing down the UUIDs and manually add the other drives to fstab and create appropriate directories, after modifying the labels in Windows.
-MXC

On 2014-07-15 05:36, mxcrowe wrote:
>
> Thanks Carlos,

Welcome.

> should have used some other settings or entries so that it didn’t add it
> as /run/media/mxc…but it all seemed rather automatic to me.

The problem is that /run/media is volatile.

> In any
> case, I did the manual edit to fstab for that drive and created a
> directory in /mnt and rebooted - all seems to work smoothly. I will now
> try tracing down the UUIDs and manually add the other drives to fstab
> and create appropriate directories, after modifying the labels in
> Windows.

Well, I hope it works :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)