10

I've a partition on /dev/sda2 of 279 GB Ext4 filesystem, but I'm not able to auto mount it on login.

I've added the partition entry /dev/sda /home ext4 defaults 0 0 in /etc/fstabt still it does not auto mount.

I've even tried to edit the mount options from disks (please see the below screenshot), yet no results.

The udisks command works well but the problem is that, it asks a admin password for standard user.

So my question is how do I auto mount this partition or at least grant read write permission to standard user so that they can mount this partition using udisks command.

enter image description here


Thanks to dschinn1001 I was able to automount my partition by editing the entry in fstab.

First I fount the UUID using sudo blkid

Then edit the fstab file using sudo /etc/fstab

Add the entry in the following format

[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]

Device will be your UUID
Mount Point will be the location where you want to mount your partition
File System Type will be displayed when you run blkid command
Options Add the options you need. See options in Fstab for more details.
Dump This value will be zero most cases. See Fstab for more details.
Pass This value will be zero most cases. See Fstab for more details.

So finally this is how my entry looks like.

UUID=fe9ab5ba-35ed-49c5-b1d3-9bfc02060867 /media/mount ext4 auto,user,rw,exec 0 0

Save the file and restart your PC.

In the options I've mentioned

auto which means auto mount
user which means grant standard users to mount partition
rw read write permission
exec Permit the execution of binaries from the filesystem

0
6

partition entry is not quite correct ( /home is in /dev/sda2 ? ) :

you wrote:

/dev/sda /home ext4 defaults 0 0

( if you write like that then you should replace /dev/sda with:

UUID=number-of-device

you can determine UUID-number with command: sudo blkid)

but it could look like this too ( in older Linux-Versions):

/dev/sda /mnt/ext4 defaults 0 0

or like this:

/dev/sda /media/ext4 defaults 0 0

more is explained here :

https://help.ubuntu.com/community/AutomaticallyMountPartitions

https://help.ubuntu.com/community/Fstab

https://help.ubuntu.com/community/UsingUUID

3

By /etc/fstabt I assume you meant /etc/fstab. The problem with your mount spec is probably that you want to mount a partition, where /dev/sda refers to the entire disk.

/dev/sda2 /home ext4 defaults 0 0

(as an example). List available partitions using sudo fdisk -l. As dschinn1001 mentions, a UUID is more desirable than a disk/partition number. The corresponding entry in my own fstab runs:

UUID=xxx /home ext4 defaults 0 2

Worth mentioning, /home is where your user accounts live. You have been running apparently with /home sourced from somewhere else. Once you get /home mounting properly from a new partition at boot time, the old home directory will be buried.

0

For everyone who want to auto mount different partitions (different UUID's) but all partitions with a specific label use this (example for exFAT file system).

  1. Be able to handle exFAT file systems
    sudo apt-get install exfat-fuse exfat-utils
    
  2. Create a mount point
    sudo mkdir /backup
    
    I use the auto mount feature for usb sticks where my backup is stored. So my mount point is just called /backup.
  3. Show all connected devices
    sudo blkid
    
    This should result in something like this.
    /dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" TYPE="vfat" PARTUUID="738a4d67-01"
    /dev/mmcblk0p2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" TYPE="ext4" PARTUUID="738a4d67-02"
    /dev/sda1: UUID="906E-3FB6" TYPE="exfat" PTTYPE="dos" PARTUUID="738a4d67-01"
    /dev/sda2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" TYPE="ext4"
    /dev/mmcblk0: PTUUID="738a4d67" PTTYPE="dos"
    
    Let's take /dev/sda1 in this example. In my case you can see, that /dev/sda1 has no LABEL and TYPE="exfat" (file system).
  4. Optional format your device if it is not formatted as exFAT

    ATTENTION, all data at this partition will be removed after calling this command!

    sudo mkfs.exfat /dev/sda1
    
  5. Set a fitting label

    My label is just called backup. Don't swap this label backup with the previous created mounting point /backup.

    sudo exfatlabel /dev/sda1 backup
    
  6. Check the file system and label
    sudo blkid
    
    This should result in something like this
    /dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4BBD-D3E7" TYPE="vfat" PARTUUID="738a4d67-01"
    /dev/mmcblk0p2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" TYPE="ext4" PARTUUID="738a4d67-02"
    /dev/sda1: LABEL="backup" UUID="906E-3FB6" TYPE="exfat" PTTYPE="dos" PARTUUID="738a4d67-01"
    /dev/sda2: LABEL="rootfs" UUID="45e99191-771b-4e12-a526-0779148892cb" TYPE="ext4"
    /dev/mmcblk0: PTUUID="738a4d67" PTTYPE="dos"
    
    In my case you can see, that /dev/sda1 has LABEL="backup" and TYPE="exfat" (file system).
  7. Now you should be able to mount your device via label and unmount
    sudo mount -L backup /backup
    
    sudo umount /backup
    
  8. Prepare system for auto mount

    Open /etc/fstab with nano editor.

    sudo nano /etc/fstab
    

    Add this line to the end of file.

    LABEL=backup /backup exfat defaults 0 0
    

    Save the file.

  9. Reboot your system
    sudo reboot
    
    Your device should be auto mounted after restart!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.