LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Bodhi (https://www.linuxquestions.org/questions/bodhi-92/)
-   -   run a script on boot to auto mount? (https://www.linuxquestions.org/questions/bodhi-92/run-a-script-on-boot-to-auto-mount-4175678115/)

questionsBot 07-03-2020 10:04 PM

run a script on boot to auto mount?
 
I would like to automount a directory on boot automatically... how would I go about that? I assume I need to write a script.. but how to get that to automatically run?

Basically I want to auto mount my windows partition. It works fine, and I can access it as long as I click the "drive" in file manager to mount it... but I need it to automout.

questionsBot 07-03-2020 10:38 PM

I found a solution for mounting a drive....

use these two commands...
Code:

sudo fdisk -l
sudo blkid

fdisk will display your drives and blkid will show you the drive UUID

Then type
Code:

sudo nano /etc/fstab
And then at the very bottom add this line...
Code:

UUID=14D82C19D82BF81E /MountPointDirectory auto nosuid,nodev,nofail,x-gvfs-show 0 0
but replace the UUID and the mount point directory to w/e you wish.

This is the exact lines I added to the bottom of my file.
Code:

#
# Add AutoMount
UUID=A224420E2441E5BF /home/itisme/WindowsData  auto nosuid,nodev,nofail,x-gvfs-show 0 0

NEW QUESTION :

How can I automount a directory, rather than an entire drive?

cordx 07-03-2020 10:41 PM

you should be able to do that by adding an entry for your windows partition to your fstab (in /etc).

michaelk 07-03-2020 11:06 PM

To elaborate on cordx's post you can not just mount a single directory on a filesystem but you can use a bind mount to provide an alternative view to the existing directory tree.

If you mount your windows drive to say /mnt/WindowsData you can then create another mount point to the desired directory within the drive.

/etc/fstab entery would look like.

/mnt/WindowsData/subdirectory /home/itsisme/subdirectory none defaults,bind 0 0

There is also a fuse filesystem bindfs that can do the same thing without having to have a fstab entry.

cordx 07-03-2020 11:06 PM

Quote:

Originally Posted by questionsBot (Post 6141234)
NEW QUESTION :

How can I automount a directory, rather than an entire drive?

how do you mean? once the partition is mounted, your os should have access to all of the directories located therein.

questionsBot 07-04-2020 12:26 AM

Quote:

Originally Posted by michaelk (Post 6141239)
To elaborate on cordx's post you can not just mount a single directory on a filesystem but you can use a bind mount to provide an alternative view to the existing directory tree.

If you mount your windows drive to say /mnt/WindowsData you can then create another mount point to the desired directory within the drive.

/etc/fstab entery would look like.

/mnt/WindowsData/subdirectory /home/itsisme/subdirectory none defaults,bind 0 0

There is also a fuse filesystem bindfs that can do the same thing without having to have a fstab entry.

perfect! Thanks!


All times are GMT -5. The time now is 09:29 PM.