fstab file (solved)

Forum rules
Before you post please read how to get help
Post Reply
fred0843
Level 1
Level 1
Posts: 47
Joined: Tue Jan 16, 2007 10:59 am

fstab file (solved)

Post by fred0843 » Wed Oct 29, 2014 12:19 pm

using Linux Mint KDE.
I have a ext 4 partition labled (Data). What line do I have to add to the fstab file to auto mount on startup ?
Last edited by fred0843 on Wed Oct 29, 2014 1:47 pm, edited 1 time in total.

C-TZ
Level 1
Level 1
Posts: 6
Joined: Wed Nov 13, 2013 4:20 am

Re: fstab file

Post by C-TZ » Wed Oct 29, 2014 12:26 pm

A little bit more about automounting can be found here:

http://community.linuxmint.com/tutorial/view/1513

I've chosen an article where fstab is talked about in a more general way, not just automounting. Getting to know fstab will save you time later on when you want to add, for example, a network share, or an NTFS partition. Any questions, please ask!

altair4
Level 19
Level 19
Posts: 9620
Joined: Tue Feb 03, 2009 10:27 am

Re: fstab file

Post by altair4 » Wed Oct 29, 2014 12:51 pm

There's a couple of things wrong with that HowTo:

*** It's best to mount using UUID's ( or LABEL's ) to identify the partition not /dev/sdxy.
*** You really don't want to mount anything to /media/user/label - that's for system use.

My suggestion:

[1] Run the following command to find the UUID for your partition:

Code: Select all

sudo blkid -c /dev/null
[2] Make a permanent mount point:

Code: Select all

sudo mkdir /media/Data
[3] Add the following line to the end of /etc/fstab:

Code: Select all

UUID=076426af-cbc5-4966-8cd4-af0f5c879646 /media/Data ext4 defaults,noatime 0 2
Substitute the UUID you found in step [1].

[4] If you currently have the partition mounted unmount it.
[5] Then run this command to remount it which uses the new line in fstab:

Code: Select all

sudo mount -a
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

User avatar
Flemur
Level 16
Level 16
Posts: 6990
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: fstab file

Post by Flemur » Wed Oct 29, 2014 1:29 pm

altair4
*** It's best to mount using UUID's ( or LABEL's ) to identify the partition not /dev/sdxy.


I use labels because they mean something when you see them.

*** You really don't want to mount anything to /media/user/label - that's for system use.

At first I was mounting data partitions to something like /DATA, /WINE, but it's better to put them under /mnt.
I run "finds" a lot and have a script that excludes /mnt, namely all non-system files.

I have a ext 4 partition labled (Data). What line do I have to add to the fstab file to auto mount on startup ?

FWIW: Partition label = "DATA" = mp3s, movies, pics, etc
$ sudo mkdir /mnt/DATA
$ sudo chown username /mnt/DATA

fstab line:
LABEL=DATA /mnt/DATA ext4 defaults 0 0

I made //mnt/DATA/music .../pics etc bookmarks in thunar, so one-click to navigate there, and made a couple of scripts to make it easy to "cd" there:
$ data download/mp3
then PWD = /mnt/DATA/download/mp3
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

fred0843
Level 1
Level 1
Posts: 47
Joined: Tue Jan 16, 2007 10:59 am

Re: fstab file Solved

Post by fred0843 » Wed Oct 29, 2014 1:46 pm

fred0843 wrote:using Linux Mint KDE.
I have a ext 4 partition labled (Data). What line do I have to add to the fstab file to auto mount on startup ?

fred0843
Level 1
Level 1
Posts: 47
Joined: Tue Jan 16, 2007 10:59 am

Re: fstab file (solved)

Post by fred0843 » Wed Oct 29, 2014 1:48 pm

Thanks Guys

altair4
Level 19
Level 19
Posts: 9620
Joined: Tue Feb 03, 2009 10:27 am

Re: fstab file

Post by altair4 » Wed Oct 29, 2014 1:59 pm

Flemur wrote: *** You really don't want to mount anything to /media/user/label - that's for system use.

At first I was mounting data partitions to something like /DATA, /WINE, but it's better to put them under /mnt.
I run "finds" a lot and have a script that excludes /mnt, namely all non-system files.
Depends on what you want it to do. On most DE's if you mount a partition under /home/$USER or /media it will produce a mount icon on the desktop and other places. This is what happens when the system mounts to /media/$USER/LABEL. If you mount it under /mnt or anywhere else it will not. It's up to the user.
I have a ext 4 partition labled (Data). What line do I have to add to the fstab file to auto mount on startup ?

FWIW: Partition label = "DATA" = mp3s, movies, pics, etc
$ sudo mkdir /mnt/DATA
$ sudo chown username /mnt/DATA

fstab line:
LABEL=DATA /mnt/DATA ext4 defaults 0 0
It's a pet peeve of mine and in this particular case it really doesn't matter since the ownership / permissions issue has already been resolved but if this was a newly formated partition or a partition where you wanted to change ownership / permissions your steps are backwards:

** create the mount point
** add the line in fstab
** mount the partition
** then and only then change ownership / permissions.

Partitions don't "inherit" the permissions from the mount point. It's the other way around. The permissions of the mount point are always overridden by the permissions that exist on the partition when mounted or in the case of ntfs explicitly defined in fstab.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

C-TZ
Level 1
Level 1
Posts: 6
Joined: Wed Nov 13, 2013 4:20 am

Re: fstab file

Post by C-TZ » Wed Oct 29, 2014 3:36 pm

altair4 wrote:There's a couple of things wrong with that HowTo:

*** It's best to mount using UUID's ( or LABEL's ) to identify the partition not /dev/sdxy.
*** You really don't want to mount anything to /media/user/label - that's for system use.
I disagree. There is no "best", they're two different ways. I also use UUID's in fstab but for normal mounting it's easier to use /dev/sdxy. Using the latter in fstab has no advantages and it takes a longer time, since you can't tell from heart what UUID /dev/sda3 is.

Also, blkid? why? You need root-acces for that.. Just use:
ls -la /dev/disk/by-uuid/
:?

altair4
Level 19
Level 19
Posts: 9620
Joined: Tue Feb 03, 2009 10:27 am

Re: fstab file (solved)

Post by altair4 » Wed Oct 29, 2014 4:05 pm

Just within the last 5 days or so there was a post where I observed the following:
altair4 wrote:A modern PC has become so complex that sda, sdb, sdc have become relative terms since depending on temperature, humidity, and sunspot activity what the system sees as sda on one boot it may see as sdb the next. For example:

When you installed Linux the partition you installed it to was sda2:
# / was on /dev/sda2 during installation
UUID=f33ddffe-bf98-4ad6-a3fa-f7ce0ed6a6f5 / ext4 errors=remount-ro 0 1
Now it's at sdc2:
/dev/sdc2: UUID="f33ddffe-bf98-4ad6-a3fa-f7ce0ed6a6f5" TYPE="ext4"
That's why we all use UUID's today - although if you keep your wits about you LABEL can also be used.
Once you are loged in if you want to do a temporary mount using sdxy that's fine but for automounting though fstab there really is a best way - actually two of them - UUID or LABEL. After all that's how your system partition is mounted.

The /media/$USER/Label mount point is self explanatory.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Post Reply

Return to “KDE”