Archive for October, 2011

04
Oct
11

Mounting External HDDs at Startup on OpenSuse

OpenSUSE 11.2

Image via Wikipedia

Although Linux Mint will be my favorite flavor of Linux, I am trying hard to give OpenSuse a chance. Last month, I was telling you about a couple of small annoying things I came across on OpenSuse and how to “correct” them. Since then, I switched back to Mint and back to OpenSuse (since yesterday) and I’m hoping to stick to one particular OS for a while, because frankly, it’s becoming some kind of habit…

Anyway, back to our topic. Now I know what most of you are thinking: “Why the hell do we need instructions on how to mount an external HDD? Since the Dark Ages, you have your standard plug n play on Linux mister! Pop it in and all your files are there!” Well, yes, but as it usually happens, mine was a slightly different case than usual. Yeah I know, I got to do something about it.

I have three external hard disks, which host most of my entertainment. These are permanently hooked on my PC and I want them shared via Samba, so I can access them through a Windows 7 box that acts as my current Media Center. For an explanation on why I am using Windows and not XBMC with Linux, have a look at this post. As you probably guessed, the disks are formatted in NTFS and this is what complicates matters.

In case my disks were formatted in a Linux format, such as ext4, things would be simple enough: I would choose to automount them in KDE (I think Gnome has a similar option) and every time I turned my PC on, they would be mounted in /media folder under folders matching their label. Then, I could set up file sharing as usual and everybody would be happy.

NTFS, does not support the same permissions as extended file system. This means that upon mount, Linux applies “fake” file permissions which you cannot change! If you were using ext4 for example, you could easily chmod the files to suit your needs, but in this case, although chmod will report nothing strange, no actual changes were made. Even so, for most of you this will not be a problem, since you will be the only one using this disk and by default you are the owner, so you can do pretty much everything. In my case, I wanted to be able to allow read/write access not only to myself, but to all members of my group too. So here’s what I did:

Since automount through KDE was not good for me, I had to do it the old fashioned way, by adding entries in fstab. First I created a folder for each of my drives under root and gave them the appropriate permissions:

sudo mkdir /Videos
sudo chown -R rosenred /Videos
sudo chgrp -Rv users /Videos

Now, we need to add the mount commands in fstab. The safest way to go, is with each disk’s uuid, a unique identifier that will remain stable even if drive letters change. So we need to find our what is the uuid of our disk:

sudo /sbin/blkid

In case you followed my advice (or are using a different distro) you don’t need to add the /sbin to the command. Write down the uuid of your disk and then edit /etc/fstab using your favorite editor and add the following line:

/dev/disk/by-uuid/7A7ACDEA7ACDA2ED /Videos       ntfs-3g users,locale=en_US.utf8,uid=rosenred,gid=users 0 0

If you wish to add more than one disks, add more lines to fstab accordingly. Reboot and hopefully everything will work just fine.

I don’t plan on writing a separate post about how to configure Samba, there are a ton of tutorials on the subject, however I have one tip that might save you a lot of money from a broken screen/desk/wall:

If you set everything up and for some reason Windows refuses to see the shared directories, go to YAST and disable AppArmor. I know, makes little sense, but apparently it’s a bug in OpenSuse 11.4 as I found out here.




October 2011
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

inspired mumblings…