0

How to change an order of mount points if a volume is mounted twice (or more)?

sudo mount /dev/sda2 /media/Folder_1;

sudo mount /dev/sda2 /media/Folder_2;

udisksctl info --block-device /dev/sda2;

... org.freedesktop.UDisks2.Filesystem:

MountPoints:        /media/Folder_2 

                    /media/Folder_1 

...

How to change this order? I mean I want to see: first - "/media/Folder_1", then - "/media/Folder_2" Where this order is stored?

[Alternate:]

Does exist a call to some system program that software (like file managers) uses to detect which mountpoint should be used?

Eg.: a_program an_argument_1 ... an_argument_N

(In this case it may be possible to override such program and preprocess its arguments before actual call)


P.S. It may be important, as I suspect that some software (like file managers) get the FIRST mount point and associates this one with the volume label.

0

One solution could be to mount Folder_1 on Folder_2, instead of mounting the device on Folder_2, using bind mounts:

sudo mount /dev/sda1 /media/Folder_1
sudo mount -o bind /media/Folder_1 /media/Folder_2

This way, the device is never mounted on the second folder, but all its files are visible there.

  • No, it is not a solution (order will not be changed)!!! I.e., file managers (after start a new program instance) still associate "/media/Folder_2" (not "/media/Folder_1") with volume label of /dev/sda2. – ChapaikinVA Sep 14 '14 at 11:24
  • @ChapaikinVA Did you unmount your previous mounts? As far as I know, no file manager do this association with bind mounts. – muru Sep 14 '14 at 11:25
  • I have unmounted first. Effect is the same: the order is the same (i.e., the problem remains). File manager (aftrer reopened) does such association, i.e., associates volume label and mount point: volume label is used as displayname of a drive (in device list panel), and mount point is displayed in location bar. And not only file managers. All system dialogs (file open / save etc.) also uses such association. (I use KUbuntu, i.e., KDE) – ChapaikinVA Sep 14 '14 at 11:46
0

You can give a pass number in /etc/fstab. The higher the number the later it'll mount.

  • Do a pass number affects a mount order, but not a checks order? – ChapaikinVA Sep 14 '14 at 19:22
  • Don't know. I guess mounts and checks take place at the same time, because it's not until mount starts that are checks required can be answered. – rhubarbdog Sep 14 '14 at 19:32
  • I think it will not help. As actually (via fstab) I normally mount a volume, and then mount its subfolder as binded. So bind-mount goes chronologically AFTER the mount of the entire volume. But after I log in I see that the order is always alphabetically, by descending (i.e., the problem remains). [But I will try to change the pass number.] – ChapaikinVA Sep 14 '14 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.