What is the YaST friendly way of doing bind mounts?

Heya Lizardheads,

I wanted the main folders in my home dir (Documents, Downloads, Music, etc) on a different drive than my home dir itself.
I couldn’t get used to having a home dir full of symlinks, so I manually added bind mounts for them in /etc/fstab.
But when I used the YaSY partitioner to add a partition to a different drive, it removed all the manually added bind mounts from /etc/fstab.

Is there a ‘YaST friendly’ to make my system do bind mounts at startup?

Maybe a YaST problem? IMHO it should not remove entries from /etc/fstab when you do not ask it to do so.

Apart from that, what is the problem with symlinks? They are just for doing things like this.

It shouldn’t? In that case I’ll try to take a closer look at it this weekend, maybe I can find something going whoopsie-daisy.

The problem with symlinks for me is that Dolphin adds little ‘symlink arrows’ to the folders to show me they are symlinks.
I generally find this useful but I have a lot of trouble processing visual information, so the added noise of these arrows makes it harder for me to see where the directory is that I’m looking for.

I can see no reason why it should do such a thing. Maybe others understand.

That is different from my situation. I have two symlinks in my ~/Documents. Dolphin shows their entries in italic, that is all. I see no arrows at all.

I am using symlinks for “Desktop”, “Documents”, “Pictures” and a few others.

Yes, Dolphin shows something – looks like the link of a chain – to indicate the symlinks.

I don’t see that as a problem. But we can disagree about that.

I agree with Henk, that Yast should not be removing your “bind” entries. Recheck that. If it really is removing them, then it might be worth a bug report.

These days I’d use a systemd unit for such bindmounts, calling a bash script.

I like to come back to this and applogize.

I assumed that everybody uses Dolphin in the same way as I do, which is of course wrong. i use the Details view, that comes nearest to an “ls” listing and does not have all those space consuming icons. I assume you use something like Icons and that then icons are shown they may be different when something is a symbolic link.

While suggesting other solutions to the OP is a useful excersise in itself, has anybody comment on the report that YaST > Partitioner deletes entries from /etc/fstab that are not addressed by the actions asked from YaST > Partitioner?

Maybe I will try to repeat that behaviour. Shouldn’t it then be worth a bug report? Or think others that it this behaviour is something wanted by the designers (in other words, a feature and not a bug)?

Yes, I think so – and I suggested that in my previous reply.

Ok, here it is.
This is the start situation:

boven:~ # fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-60W
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 0AAF3B2B-2BCB-41BF-841D-C0E6A627F6E7

Device        Start       End   Sectors  Size Type
/dev/sda1      2048    534527    532480  260M EFI System
/dev/sda2    534528  17317887  16783360    8G Microsoft basic data
/dev/sda3  17317888  59262975  41945088   20G Microsoft basic data
/dev/sda4  59262976 478689279 419426304  200G Microsoft basic data


boven:~ #

Added a bind mount entry to /etc/fstab and mounted it.

boven:~ # cat /etc/fstab
UUID=7dc53b12-93a9-4e97-b0ae-ab165a8bd688 /                    ext4       acl,user_xattr        1 1
UUID=212ea772-7bec-4bee-85b5-786f7a810356 swap                 swap       defaults              0 0
UUID=A626-CF2D       /boot/efi            vfat       umask=0002,utf8=true  0 0
UUID=8c561c1d-e51f-4eb9-a28a-92b3a98df5be /home                ext4       defaults              1 2
tmpfs                   /tmp    tmpfs   size=25%,uid=root,gid=root,mode=1777    0 0

/home/wij /home/henk/wij none bind
boven:~ # mount | grep '/dev'
devtmpfs on /dev type devtmpfs (rw,nosuid,size=4001676k,nr_inodes=1000419,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
/dev/sda3 on / type ext4 (rw,relatime,data=ordered)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/sda4 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda4 on /home/henk/wij type ext4 (rw,relatime,data=ordered)
boven:~ #

Then I used YaST > Partitioner to create a new partition /dev/sda5, made an ext4 file system on it and set it to mount (now and on boot) on /mnt.

boven:~ # fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-60W
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 0AAF3B2B-2BCB-41BF-841D-C0E6A627F6E7

Device         Start       End   Sectors  Size Type
/dev/sda1       2048    534527    532480  260M EFI System
/dev/sda2     534528  17317887  16783360    8G Microsoft basic data
/dev/sda3   17317888  59262975  41945088   20G Microsoft basic data
/dev/sda4   59262976 478689279 419426304  200G Microsoft basic data
/dev/sda5  478689280 489175039  10485760    5G Linux filesystem


boven:~ #

It is there, but look in /etc/fstab:

boven:~ # cat /etc/fstab
UUID=7dc53b12-93a9-4e97-b0ae-ab165a8bd688  /          ext4   acl,user_xattr        1  1
UUID=212ea772-7bec-4bee-85b5-786f7a810356  swap       swap   defaults              0  0
UUID=A626-CF2D                             /boot/efi  vfat   umask=0002,utf8=true  0  0
UUID=8c561c1d-e51f-4eb9-a28a-92b3a98df5be  /home      ext4   defaults              1  2
tmpfs                                      /tmp       tmpfs  size=25%,uid=root,gid=root,mode=1777  0  0
UUID=e54b13d3-2b73-40ad-b502-00e99c1ad2c6  /mnt       ext4   defaults              0  2
boven:~ #

The bind mount entry is indeed gone!

boven:~ # mount | grep '/dev'
devtmpfs on /dev type devtmpfs (rw,nosuid,size=4001676k,nr_inodes=1000419,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
/dev/sda3 on / type ext4 (rw,relatime,data=ordered)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0002,dmask=0002,allow_utime=0020,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
/dev/sda4 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda4 on /home/henk/wij type ext4 (rw,relatime,data=ordered)
/dev/sda5 on /mnt type ext4 (rw,relatime,data=ordered)
boven:~ # 

shows that the bind mount is still active, as is the new file system. But I have no doubt that the bind mount will not be reestablished at e new boot:(

This is definitely worth a bug report.

I may do some experimenting in a VM.

Submitted: https://bugzilla.opensuse.org/show_bug.cgi?id=1159557

OK, as Stefan Hundhammer pointed out, my entry wasn’t complete correct. instead of

/home/wij /home/henk/wij none bind

it should have been

/home/wij /home/henk/wij none bind 0 0

I run the test again with the corrected entry and now nothing is removed.

My logical question to @Noisecommander: please show us the bind entries.

BTW. I understand that YaST needs to read and interprete /etc/fstab, but I am a bit surprised that it then removes entries it does think being corrupt without making any comment.

Thanks.

And I did wonder about those missing numeric entries at the end of the line (mentioned in bug report).

Yes, I was a bit sloppy, but I was lured into it by the examples in the man page.

It is however not certain that the OP made the same mistake.

And it again proves that I should have been pedantic in asking for “showing, not telling”. :wink:

I didn’t have a backup of my fstab with the original changes I made, so I just tested it with the new file and YaST kept the entries this time and neatly spaced them. :X
It’s a good thing you tested it with the incorrect entries, hcvv, otherwise I’d feel really silly.

My entries are currently written like this

mnt/wdc/home/Documents         /home/noise/Documents   none   bind   0  0

And everything is still there after creating and deleting partitions a couple times.

I can’t think of anything I did differently, but I probably did make a mistake before.
I should have done a few more tests, but I didn’t.

edit] I went into my snapshots and I found the old entry. It was me, I edited fstab wrong.

/mnt/wdc/home/Documents         /home/noise/Documents   none   bind

No 0 0 anywhere in sight.

I went over my edit limit, so I’ll just add that there is a leading / in my current fstab, it just accidentally removed it here.

Nice you can confirm where the problem originated. Thanks for reporting back.

And for next time, always post the computer information as the facts behind your story telling. It is very human to tell the conclusions one jumped to instead of just posting the neutral, but very true computer facts and then telling what one expected to happen and what happened instead. I know I should have asked for it, but sometimes I feel I am to much of an obstinate, always asking for the same, teacher. lol!

I know what you mean.
I’m generally the person asking for additional information, sources, facts, etc.

And I usually test everything, a couple times, before I ask a question.
I didn’t do that, but that wasn’t even my biggest mistake.
My biggest mistake here was thinking that YaST did something wrong and I didn’t. :nerd:
(And then not test it.)

Even YaST can have bugs. And the Partition module is rather new (replacing an older one), so you never can be certain.
I still am not convinced that meddling with fstab entries that are outside the scope of the changes initiated by the user without giving any message is a good thing. :\