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
  • 67,791
  • 32
  • 179
  • 269
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
  • 197,895
  • 55
  • 485
  • 740
Mitch
  • 107,631
  • 15
    This is excellent advice. Many people are used to having to edit /etc/fstab manually. While that's appropriate and useful in many situations, it's good to know that a volume's mount options can be customized with the reasonably user-friendly GUI in Disks. – Eliah Kagan Mar 23 '13 at 13:53
  • 1
    Will this also work with encrypted drives? – Tom Brossman Mar 26 '13 at 21:23
  • 1
    @TomBrossman I just created an encrypted disk, and unfortunately it will not work with it. – Mitch Mar 27 '13 at 06:26
  • 2
    sudo apt-get install gnome-disk-utility if it isn't installed by default in your Ubuntu-based distro. This solution worked in Ubuntu Mate 15.04 – Insperatus Aug 19 '15 at 04:22
  • Also it is good to backup /etc/fstab like sudo cp /etc/fstab /etc/fstab_backup before using the disk utility, since it would modify /etc/fstab. – Yixing Lao May 24 '16 at 09:40
  • Also tick "show in user interface" if you want to display it in devices list. – Shahzain ali Jun 28 '16 at 21:46
  • Method is still on in 17.04 – Ege Sucu May 05 '17 at 10:12
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,704
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
  • 107
Pandya
  • 35,771
  • 44
  • 128
  • 188
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.

  • Thanks, helped me heaps, kept having to log into the terminal when 'startx' failed and type "sudo mount -no remount,rw /" to get ubuntu to boot each time... – ALM865 May 11 '15 at 11:57
  • This bug was fixed in utopic (Ubuntu 14.10), afaict. – vaultah Jun 12 '15 at 22:50
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