[SOLVED] Mount partition automatic and/or with fstab

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

[SOLVED] Mount partition automatic and/or with fstab

Post by tetrodotoxine »

Hi everybody,

I'm using Linux Mint 17.2 with Cinnamon.
Yesterday i had a problem with mounting an internal disk.
It was in NTFS format when i was on Windows. I would to use it in ext4 format.
First i used gparted to format the disk. All was allright until i would to use it : it had root rights. I knew it was mounted by the system with bad options.
I got an other issue too : when starting i had to choose to ignore mounting by typing S or M...
So i looked for how to fix this little issue.
Most of help was oriented with use of terminal and fstab file, so i tried to solve it with this methode.
I found disks manager could do it too.
But i was lost between disks manager which it's found in start menu and gparted with fstab and command line.
After a long research i found help and i put a line in fstab to mount my disk, something like this, after created a directory in /media/tetro/ :

Code: Select all

UUID=xxxx xxzdsd xxqsdsd    /mnt/tetro/500G defaults ext4 0 2
But before doing that i tried with disks manager which put an obscur line, like this (problem at startup appeared with it) :

Code: Select all

/dev/sdc1/..by-uuid/ fdsfxc fsdqfsc csqfdsf /media/tetro/DATAS and a lot of options with nosuid, nosomething, gvfs blablabla
(DATAS is the label i gave to my disk in gparted)

My issues wouldn't be solved, so i erased all the lines i made or disks managers wrote in fstab.
Like a miracle no problem appeared and i could use my disk. It mounts in Cinnamon with DATAS label, i can write on it...

I was curious to know how this fix worked. I opened fstab in /etc but there is no line, nothing about my disk !!!
I wrote a line in fstab like this to see what would happen :

Code: Select all

UUID=xxxx xxzdsd xxqsdsd    /mnt/tetro/500G defaults ext4 0 2
And i got 2 mounts, mine and the mount of the system !!!

Here i have my real questions :
How Linux Mint 17.2 does to automatically mount disk with good rights, with wich soft and where it is in system files and why it's different with manual way (fdisk and fstab) and why i can have both ?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
tetrodotoxine

Re: Mount partition automatic and/or with fstab

Post by tetrodotoxine »

Hi again to be more precise :
I did a mkdir : /media/tetro/DATAS
A chown tetro:tetro DATAS
I put this line in fstab :

Code: Select all

UUID=d9d576cc-895f-4b2b-a6f8-380dbb7b7eed /media/tetro/DATAS ext4 defaults 0 2
I see my disk with DATAS label in the explorer file of Cinnamon and all is right, my disk mounts in cinnamon, i see it with a disk icon on the desktop, with the DATAS label ; i can write on it.

If i quote my line in fstab

Code: Select all

#UUID=d9d576cc-895f-4b2b-a6f8-380dbb7b7eed /media/tetro/DATAS ext4 defaults 0 2[code]
I have a strange thing :
I always see it in file explorer with DATAS label and when i click on it, it mounts AND in /media/tetro an other directory is created : DATAS1
Then i see it with a disk icon on the desktop, with the DATAS label ; i can write on it.

Why ? How Linux Mint does it ? With what ?
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Mount partition automatic and/or with fstab

Post by altair4 »

When there is no line in fstab for a partition AND the partition has a label it will appear as a link with that label on the side panel of your file manager.

It may appear to the user that it is automounting but it is not. That link is not a pointer to the partition it's a launcher that mounts the partition first and then displays it's contents.

When that laucher does mount the partition it creates a temporary mount point at that moment to /media/$USER/$LABEL. $USER = tetro and $LABEL=DATAS in this case.

When you create a line in fstab it's best to avoid using the same mount point that this default system uses so for example you would:

*** Create a mount point at /media/DATAS

Code: Select all

sudo mkdir /media/DATAS
*** Then add the line to fstab that points to that mount point:

Code: Select all

UUID=d9d576cc-895f-4b2b-a6f8-380dbb7b7eed /media/DATAS ext4 defaults 0 2

Notes:

*** You are getting a DATAS1 because you created a folder in the same place the system uses to mount the partition. The system will try to create a temporary mount point at /media/tetro/DATAS but can't because there already is a folder with that name so it creates a new folder at /DATAS1.

*** There is no need to do a chown on the mount point before that mount since the permissions of the mount point are always overridden by the mount itself. If a chown is required you need to do it after the mount.


Personal note: I avoid using Disks since it has goofy default settings and no intelligence in it that prevents the user from doing odd things.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
tetrodotoxine

Re: Mount partition automatic and/or with fstab

Post by tetrodotoxine »

Hi altair4,

Thanks for your post, i have a better idea of using mount and edit fstab.
I noticed now i don't have any errors and my ideas clearer that when we write mounts in fstab it overwrite rights of these automounts.
Then this "launcher" "does not automount disks with temporary directory".
My exact issue is solved, i'm going to mark my topic as solved but :) :

Perhaps you could tell me what program is used to do this automount ?
And in a different way, with an USB disk, if i will choose to format one and use it with ext4 and If i do the same way for it, what will happen when plug and unplugged it ? I have doubt :) ...

Anyway i thank you again altair4, See you later all :).
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: [SOLVED] Mount partition automatic and/or with fstab

Post by altair4 »

The system uses udisks2 to mount these non-fstab partitions on command.

It looks something like this:
udisksctl mount -b /dev/disk/by-uuid/4638c269-d57d-44c0-9c0c-e7d7c330d33b
It will create - in my case - a temporary folder at /media/altair/LABEL if there is a label or at /media/altair/4638c269-d57d-44c0-9c0c-e7d7c330d33b if there is no label. Then it brings the file manager to that folder to display it's contents.

It will do the exact same thing for any USB storage device you plug in and that is another reason why you don't want to use the /media/$USER/$LABEL mount point in fstab. If you have a USB device and happeded to give it the label DATAS it will conflict and mount to DATAS1 or DATAS2 or ....
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Storage”