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?

3
  • 1
    Operating system? File manager?
    – user25656
    Mar 23, 2013 at 12:11
  • @vasa1 I'm using an unmodified/vanilla version of Ubuntu 12.10
    – Jryl
    Mar 23, 2013 at 12:18
  • 1
    Okay, so the file manager will be Nautilus.
    – user25656
    Mar 23, 2013 at 12:26

6 Answers 6

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.

7
  • 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. Mar 23, 2013 at 13:53
  • 1
    Will this also work with encrypted drives? Mar 26, 2013 at 21:23
  • 1
    @TomBrossman I just created an encrypted disk, and unfortunately it will not work with it.
    – Mitch
    Mar 27, 2013 at 6: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, 2015 at 4: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, 2016 at 9:40
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

0
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

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.

2
  • 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, 2015 at 11:57
  • This bug was fixed in utopic (Ubuntu 14.10), afaict.
    – vaultah
    Jun 12, 2015 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .