Second Hard Drive issue

Alan Dacey (grokit) grokit at ajinfosearch.com
Mon May 16 15:35:57 UTC 2016


Seems that all the good advice and the not so clear advice was a bit confusing so I am writing this as a short fstab manual. (A TL:DR version is change the last number in your entry to a 2)
So you have an internal hard drive and you want to have it automatically mount. Let’s think about where you want to mount it for a bit. In your case you use it to hold your web pages. Why don’t you make a folder under your ~/Documents folder? By default /media is owned by root and is so far removed from where you spend your time saving files that I see little sense in manually making folders and mounting disks there. Let the system do that with your thumb drives and such. The only reason that you should ever use fstab to mount something there is if your computer has multiple users that use different logins and they all need access to the disk. If it is just you using the computer then use a folder under your home folder. You know, keep all your stuff at home.
Making an entry to mount a drive in the /etc/fstab file follows a certain format (duh!). The first part is the disk name, the second part is the mount point, third the file system type, fourth the options, the fifth part is always a zero (never looked up what it really is), and sixth part is the auto-fsck switch. I will walk through them and explain how to make an fstab entry for both ext and ntfs drives.
This is an example of an ext4 formatted disk entry:
UUID=a99999aa-a9a9-9999-99a9-999a9999999a /home/userme/.LinkMounts/LinkedMedia/TV ext4 nouser,relatime,atime,auto,rw,dev,exec,suid 0 2
The first part “UUID=...” is the unique UUID of the disk which you get by using the ‘sudo blkid’ command. You can also use the disk label as Felix wrote but the UUID will never change until you re-format the drive so that is what I like to use. NEVER use the /dev/sd.. name since this can change between reboots and will eventually break your mounting.
The second part is the mount point “/home/userme/...” As you can see I actually mount this disk at an uncommon location but my disk setup is more complicated than most with 9 drives and more partitions. You can use any folder you want as long as it exists and you use the entire path name. So in your case, /home/?????/Documents/Webpages is a folder that makes sense to save your webpages in but you can do whatever you want with your machine.
The third part is the file system that the disk is formatted as “ext4”. You would obviously use ext2.
The fourth part is the options I use “nouser,relatime,atime,auto,rw,dev,exec,suid” You don’t need all this but auto is important and may be all you need. I don’t remember what all those options do but I do remember looking them up for an ext4 drive and using them for a reason. Anyway I’ve never had a problem with all that so I keep them.
The fifth part is a zero and always has been.
The sixth part “2” is the file system check switch. This tells the computer when to check your disk for errors. If you put a zero there the machine will never, ever check your disk for errors. Fsck will never automatically run. A number greater that 0 will be checked after whatever many reboots and this is what you want to keep your data and your disk healthy. If you look at your original fstab you will see that the swap partition has a 0 at the end and the root partition has a 1 at the end. Swap will never be checked, root will be checked first. A good rule is to always use a 2 for any disk you put in your /etc/fstab file.
When making an entry for an NTFS formatted drive, or a Windows hard drive, the file system part for anything Windows 7 and newer should be “ntfs-3g” and the options should be “rw,umask=0,uid=1000,gid=1000” where the ‘1000’ is your user id number which you can find under the ‘Account Details’ in your System Settings. So a complete fstab entry looks like this:
UUID=9999999999999999 /home/alan/.LinkMounts/Distros/Windows7 ntfs-3g rw,umask=0,uid=1000,gid=1000 0 0
Notice how there is a zero at the end for the fsck switch? Let windows deal with that when you boot into it. The reason that you need to use uid (user id) and gid (group id) is because ntfs doesn’t know about ownership like linux does and sets the file system to read only by default so you need to explicitly tell the computer who owns the drive.

Hope this helps.
Alan


On Friday, May 13, 2016 11:19:54 AM Billie Walsh wrote:
> OK, some googling and a leap of faith and maybe Stefan gave me the hint.
> 
> I googled "fstab" and found an Ubuntu page that explains things fairly 
> simply. The leap of faith was in attempting to edit it. I normally don't 
> diddle around in the nuts and bolts of the system. I don't know what I'm 
> doing but I can sometimes copy and paste with some good results.
> 
> I learned that the funny number was the uuid of the drive. Simple enough 
> once you know what it is. The "path" to that drive and my files is/was 
> media/bilie0w/"uuid"/Billie0W/. All my files are under the "Billie0W" 
> directory(?) so I set the mount point as "Billie0W". It returned a file 
> system of "ext2" so I added that and made the other options 0 and 0.
> 
> The new line in fstab now reads:
> 
> UUID=5ec13406-3b24-42a6-be83-89871af43dee Billie0W ext2 auto 0 0
> 
> I'm praying I didn't trash my system. I didn't touch anything else in 
> there. Keep your fingers crossed.
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20160516/d6cb1866/attachment.html>


More information about the kubuntu-users mailing list