2

I have two LVM volumes that I'm trying to add to /etc/fstab. I am able to make it work with defaults option, but with that I end up with the mounts being owned by root. I want to mount them so that I'm the owner and don't have to use sudo anytime I'm changing them.

If I try to add uid and gid flags to the fstab entries, I get the following error:

mount: /home/hooda/code: wrong fs type, bad option, bad superblock on /dev/mapper/vg_kdata-kcode, missing codepage or helper program, or other error.

Here are the contents of my /etc/fstab file (note that I already use similar options for regular Windows NTFS volumes, and those are working as expected)

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=66e020ab-aa78-4bb9-a625-398f3f8b53b1 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p2 during installation
UUID=28E7-8A33  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
UUID=50F80317F802FACC /media/Games ntfs-3g defaults,windows_names,locale=en_IN.utf8,uid=1000,gid=1000,dmask=027,fmask=137 0 0 
UUID=5A243C15243BF31D /media/Stuff ntfs-3g defaults,windows_names,locale=en_IN.utf8,uid=1000,gid=1000,dmask=027,fmask=137 0 0
UUID=0C640848640836CC /media/Windows ntfs defaults,umask=222,ro,windows_names,locale=en_IN.utf8,uid=1000,gid=1000,dmask=027,fmask=137 0 0
/dev/vg_kdata/kcode /home/hooda/code ext4 defaults,uid=1000,gid=1000 0 0
/dev/vg_kdata/kdata /home/hooda/kdata ext4 defaults,uid=1000,gid=1000 0 0 

I'm using Kubuntu 18.04.

1 Answer 1

1

FWIW, I removed the uid and gid options for the LVM volumes, then I tried to do chown on the mount points:

sudo chown -R hooda:hooda /home/hooda/code

And so far it seems to be working across mounts. Though I'm sure there's a better way to do it. Good enough for me though.

2
  • 2
    That is how you do it. uid ang gid is for fat/ntfs . use the user or users option in fstab to allow users (rather than just root) to mount / unmount
    – Panther
    May 17, 2018 at 15:09
  • 1
    see manpages.ubuntu.com/manpages/xenial/man5/fstab.5.html and help.ubuntu.com/community/Fstab . For file system specific options see linux.die.net/man/8/mount . It is a long page, scroll down, there are "Filesystem Independent Mount Options" and then "Filesystem Specific Mount Options" by file system (ext2/3/4 , vfat, ntfs, etc). You can use those mount options in the fstab options field per file system
    – Panther
    May 17, 2018 at 15:18

You must log in to answer this question.

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