Chown user:group directory not changing user or group (automonted partition)

Hi @tharangalion,

Change the directory it’s mounted TO’s ownership and permission before the mount is done.

$ /usr/bin/ls -lah /mnt
total 36K
[...]
drwxr-xr-x  4 mirdarthos mirdarthos 4.0K Jun 16 12:00 4tb_backup
drwxr-xr-x 12 mirdarthos mirdarthos 4.0K Jan 24  2022 5TB
[...]

Inside those I’ve mounted my 2 hard drives:

$ mount
[...]
systemd-1 on /mnt/4tb_backup type autofs (rw,relatime,fd=48,pgrp=1,timeout=10,minproto=5,maxproto=5,direct,pipe_ino=22542)
/dev/sda1 on /mnt/5TB type ext4 (rw,relatime)/dev/sda1 on /mnt/5TB type ext4 (rw,relatime)
[...]

The 4TB is an automounted one. With the following systemd unit files:

/etc/systemd/system/mnt-4tb_backup.mount:

[Unit]
Description=Mount Backup disk (/mnt/4tb_backup)

[Mount]
What=/dev/disk/by-uuid/c47c5a52-db30-4aef-bcbc-af35b7b021fd
Where=/mnt/4tb_backup
Type=ext4
Options=defaults,rw
TimeoutSec=10
TimeoutIdleSec=300

/etc/systemd/system/mnt-4tb_backup.automount:

[Unit]
Description=Automount backup drive
ConditionPathExists=/mnt/4tb_backup

[Automount]
Where=/mnt/4tb_backup
TimeoutIdleSec=10

[Install]
WantedBy=multi-user.target

This automounts the drive on demand.

I figured out how to do this from here:

And here:

That might help, and I hope it does!

1 Like