I am using Ubuntu Minimal + LXDE. I am wondering how can I auto-mount a partition (internal) on boot automatically. Currently I do something like

mount /dev/sda3 /media/works

But I want it to be permanent. Also I have GParted, but the Partition > UnMount is greyed out (yes, unmount, even though I haven't mounted it)

  • How does the mount command not have a flag to just persist the mount after a reboot? Incredible. Oct 19, 2021 at 22:30

4 Answers 4


Unmount is greyed out because the partition isn't there to be unmounted. You haven't mounted it yet.

To make the partition auto-mount, first find out the UUID of /dev/sda3 by doing:

sudo blkid

I'll assume you're using ext4 on /dev/sda3. Open up gedit like so:

sudo -H gedit /etc/fstab

(Or, in the command line, sudo vim or sudo nano instead of gksudo gedit.)

Now you want to add a line to the bottom of that file. It should look something like this (UUID will be different):

UUID=03ec5dd3-45c0-4f95-a363-61ff321a09ff /media/works ext4 defaults  0      2

For more info on fstab, this is a good resource.

  • I have to mount 2 partitions(sda5 and sda6). Both are ntfs. How can I do it ?
    – TomJ
    Jun 4, 2014 at 14:08
  • Is a reboot required?
    – jjxtra
    Aug 28, 2019 at 19:01
  • 1
    A reboot is not reqiured, you can use mount -a. Beware that depending on the filesystem type, this may mount it with different user or permissions than what you may need.
    – jjmontes
    Oct 31, 2019 at 14:50
  • This broke my Debian 11. Could'nt even boot in recovery mode. I had to boot with a Ubuntu USB stick in live mode, and restore the fstab file. which I had saved a copy of before making the changes.
    – BERA
    Dec 18, 2021 at 9:16
  • Did this on a Raspberry Pi, then upon reboot it tried to boot from the newly mounted drive. Didn't even boot after removing the drive. Thankfully this wasn't a laptop, I could just edit the fstab file by removing the SD card. I used auto for the fileystem and nodev,nofail options and now it works. Also the UUID for me is much shorter (8 chars)
    – Nicolas
    Mar 5, 2023 at 19:48

Use Disks utility. Select the disk, then click Additional partition options icon. Choose Edit Mount Options from drop-down menu.

  • 3
    This is definitely the simplest way with modern operating systems Aug 1, 2019 at 17:47
  • This saved me a lot of time, thank you. Mar 24, 2020 at 17:54
  • Amazing man! This is quite helpful. Apr 24, 2022 at 12:14
  • @BHP I tried this and apparently it should've worked. But upon restart, i can't see the partitions anymore and have to do it all over again.
    – Talha Imam
    Apr 4 at 0:10

I'm using Ubuntu Server and I made the permanent mount as follows with a disk already formatted in ext4.

I have listed my disks and partitions with

sudo fdisk -l

After that, I listed the UUID of the partition I would like to mount permanently with the following command:

sudo blkid /dev/sda2

To mount the partition I created a target location with

sudo mkdir -p /home/files

then I rode with

sudo mount /dev/sda2 /home/files

We need to put the mounted partition in the /etc/fstab file Don't forget to make a backup first. run

sudo cp /etc/fstab /etc/fstab.bkp

To avoid breaking the file system you need to look at the structure that is already in /etc/fstab for the disks that are already automounted. In my case it is like this

sudo cat /etc/fstab

# / was on /dev/sdb3 during curtin installation
# device                                               dir type options  dump fsck
/dev/disk/by-uuid/866f0e5d-e590-450c-beff-507620a4afbd /   ext4 defaults 0     1

On the site Arch Linux Wiki it is presented what this structure means. Below is an excerpt:

  • <device> describes the block special device or remote file system to be mounted; see #Identifying file systems.
  • <dir> describes the mount directory.
  • <type> the file system type.
  • <options> the associated mount options; see mount(8) §FILESYSTEM-INDEPENDENT_MOUNT_OPTIONS and ext4(5) §MOUNT_OPTIONS.
  • <dump> is checked by the dump(8) utility. This field is usually set to 0, which disables the check.
  • <fsck> sets the order for file system checks at boot time; see fsck(8). For the root device it should be 1. For other partitions it should be 2, or 0 to disable checking.

Edit the /fstab file with

sudo vim /etc/fstab


sudo nano /etc/fstab

In the file I added the following line

/dev/disk/by-uuid/6d81205-fc60-44ce-9da2-3565aa /home/files ext4 defaults 0 2

Save the file at the end

You can test by restarting the machine


For Booting time mount. you have to provide only auto option. It will work , provide mount id, mount place in your folder, file type, auto, 0, 1.

You must log in to answer this question.

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