Fstab step by step instructions?

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
catalin-ch

Fstab step by step instructions?

Post by catalin-ch »

I have an external HDD that I connect to my Linux Mint laptop via eSATA. I have two partitions on it, one formatted as EXT4 and one as NTFS that the computer sees as two separate drives. They show in the folder structure when i plug it in but are not mounted. When i click on their icons they mount automatically, just one click i don't do anything else. I named the drives the same as their format, NTFS and EXT4 respectively. They mount as /media/NTFS and /media/EXT4. Is there an easy way for them to mount automatically to that location at computer startup - via fstab I'm guessing?

I tried the GUI PySDM but the thing mounts them in /../sdb/something and it also creates duplicate sda folders, it looks messy and I don't want to have to change the path for all my other devices accessing it so i removed it. Let me know your thoughts.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
wayne128

Re: Fstab step by step instructions?

Post by wayne128 »

check Fred's tutorial
Auto Mount Partitions on Boot (also Windows partitions)

http://forums.linuxmint.com/viewtopic.php?f=42&t=22093
eanfrid

Re: Fstab step by step instructions?

Post by eanfrid »

Altering the fstab to automount removables drives may not be such a good idea. If the removable drive is not plugged or detected when starting Linux, the computer will wait for manual input or at least issue mount errors. Your choice.
altair4
Level 20
Level 20
Posts: 11425
Joined: Tue Feb 03, 2009 10:27 am

Re: Fstab step by step instructions?

Post by altair4 »

I agree with eanfrid about external storage devices controlled by fstab. You're between a rock and a hard place concerning these drives but if you are really determined to use fstab I would suggest templates. These are really variations of Fred's method just updated:

These are the templates:

Code: Select all

UUID=DA9056C19056A3B3 /media/NTFS ntfs defaults,nls=utf8,umask=000,uid=1000,windows_names 0 0
UUID=076426af-cbc5-4966-8cd4-af0f5c879646 /media/EXT4 ext4 defaults,noatime 0 2
To find the correct UUID number for your partitions run the following command:

Code: Select all

sudo blkid -c /dev/null
Templates are easier and far safer than using PySDM or any of the other fstab editors. Also note that to the purist it's somewhat redundant to have a umask=000 and a uid=1000 in the same ntfs statement but I did that to make it easier to share using Samba if you need to do that.

Since you have labels assigned to your partitions you can also use those instead of UUID's.

So the fstab entries would look something like this:

Code: Select all

LABEL=NTFS /media/NTFS ntfs defaults,nls=utf8,umask=000,uid=1000,windows_names 0 0
LABEL=EXT4 /media/EXT4 ext4 defaults,noatime 0 2 
UUID's will always be unique but Labels are the next best choice - just make sure you don't give the same label to another device.

Final note: Just make sure that the mountpoints exist. If you have these partitions currently mounted unmount them then create the mountpoints:

Code: Select all

sudo mkdir /media/NTFS
sudo mkdir /media/EXT4
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
catalin-ch

Re: Fstab step by step instructions?

Post by catalin-ch »

Thanks guys, based on your input I will probably not mess with fstab and stick to the manual process. I am hoping to build a NAS server soon and that would take care of the storage problem. One more question, is there a good reason why Linux doesn't mount external storage automatically, like Windows does?
eanfrid

Re: Fstab step by step instructions?

Post by eanfrid »

It is a by-design feature to depend on minimal resources at boot-time: unless you boot the computer from a removable drive or from the network (PXE boot for example), removable/remote drives/shares might be unavailable and it is a waste of time to wait for them to be ready.
Locked

Return to “Storage”