70

Sometimes when I restart my computer, my drives will mount but sometimes they won't (like right now when I'm typing this question out).

Is there an easy way, like a program that can mount them for me? Going in the console, making folders, etc, is NOT what I want. I like how Windows does it where they always mount the drives no matter what.

If there isn't a program how else can I easily mount all drives?

Braiam
  • 69,112
Jryl
  • 1,153

6 Answers6

92

This works in 12.10 - 16.10

Type Disks in Dash, and you will get:

enter image description here

Click on the little gears icon, to get the sub menu, and choose Edit Mount Options. After that you will see:

enter image description here

Change the Automatic Mount Options to ON. do that to all the drives that you need mounted on start-up.

Note: Be careful with what you modify, it may cause the system not to work properly.

muru
  • 207,228
Mitch
  • 109,787
15

How to auto mount NTFS part/disks in Ubuntu

Press the Ubuntu button, start your disks application.

disks

select your NTFS Partition/Disk? Press the configuration button select Edit Mount Options...

Edit Mount Options

Turn off the Automatic Mount Options, select Mount at startup. choose your Display Name Like Data or partition-Data or seriously-not-porn, whichever best describes your personality?!

Mount Options window

Mount Point means where do you want it to be mounted! this could be /mnt/DATA//home/username/part-data or /home/username/Videos/no-porno again, what best describes your personality! After that Press OK, type in your password, again OK. and restart your system, and see your mounted HardDiskdrive.

source

blade19899
  • 26,994
5

If you want to do this by your own script (without using any program), then the following may help you:

Create file named automount in /usr/local/bin and give it execution permission (sudo chmod +x).

  • ###case-1 : sudo without password (If you have set NOPASSWD in /etc/sudoers:-)

    Contents for /usr/local/bin/automount:

      #!/bin/bash
      cd /dev/disk/by-label
      for label in *
      do
          partition=$(basename $(readlink $label))
          sudo mkdir /media/$USER/$label
          sudo mount /dev/$partition /media/$USER/$label
      done
      exit
    

    Then create Startup Application (gnome-session-properties) and add the following:

screenshot

  • ###case-2 : sudo needs password (If you have not set NOPASSWD in /etc/sudoers):-

    Contents for /usr/local/bin/automount:

      #!/bin/bash
      cd /dev/disk/by-label
      user=$(zenity --entry --text="Enter Username")
      for label in *
      do
          partition=$(basename $(readlink $label))
          sudo mkdir /media/$user/$label
          sudo mount /dev/$partition /media/$user/$label
      done
      exit
    

Alternatively you can set <username> permanently instead of $user.

Then create Startup Application (gnome-session-properties) and add following:

screenshot2

Note: For running gksudo, the package gksu must be installed. If not, first do: sudo apt-get install gksu


Additional Notes:

  • This script mounts partitions on /media/$USER/<Disk-Label>.

  • To check/change labels of your partition, you can use gnome-disk-utility:

gnome-disk-utility

screenshotforlabel

wovano
  • 115
  • 2
  • 7
Pandya
  • 37,289
1

In the "Mount Options" window, be sure to UNCHECK the "Show In User Interface" option if you make changes using this utility. There is a KNOWN BUG that can cause the mounting to fail and even make your system unbootable if you use the DISKS utility to change these options and leave "Show in User Interface" checked.

That bug will show up as stating that the commend "x-gvfs-show" is not recognized or that there is a parameter missing when trying to mount that partition.

0

For people used to MS windows behavior there is the Gigolo app which is available on Ubuntu or Linux Mint through the software manager.

https://www.maketecheasier.com/manage-remote-filesystems-with-gigolo/

https://codepre.com/how-to-install-gigolo-in-ubuntu-a-best-application-for-linux-to-manage-remote-file-system.html

Once you configure it and set the automount options there, you can set it to your "startup" programs and if all your mounts are available it will connect them. (Note: it will keep reconnecting very few minutes if not available, similar to MS windows so if you want to disconnect a mount longer term/permanent it's best to turn the automount on the drive off)

0

If you know the drives you want to mount you can write a shell script like the following to mount the drives. In my case I need to mount Windows drives within my Ubuntu subsystem for Linux, so my script looks like:

for i in 1
do
    sudo mount -t drvfs C: /mnt/c
    sudo mount -t drvfs F: /mnt/f
    sudo mount -t drvfs G: /mnt/g
done