How do I mount the right way ?!

Share your awesome tips and tricks here.
MadaxDeLuXe
Posts: 4
youtube meble na wymiar Warszawa
Joined: Tue Jan 09, 2024 11:44 am

How do I mount the right way ?!

Post by MadaxDeLuXe »

Hey, this question might be very trivial, but I just can't get it right...

I've created a folderlayout on my AS5004T which I'd like to use in different containers, so I don't need to worry about path-mapping..
(USB1 = ext4 /// volume = btrfs)

What I've done:
- Created a new network share: /share/data/
- permissions by user: "myself" RW (nothing else allowed or denied, just that one checkbox)
- have an USB drive, which is automounted. (/share/USB1/)

Now let's say I'd like to have the folder "/share/USB1/data/pool1/" accessible at "/share/data/pool1" too:
- mkdir /share/data/pool1/
- create script in /usr/local/etc/init.d/ : S49_autostart

(1st try was mounting /data directly in / (without share) -> at every reboot I needed to recreate the folder layout before mounting + got an error "disk full..") so i switched
to the share-folder...

- S49_autostart - things i've tried:

mount --bind /share/USB1/data/pool1 /share/data/pool1
mount -t btrfs -o bind /share/USB1/data/pool1 /share/data/pool1
mount -t auto -o bind /share/USB1/data/pool1 /share/data/pool1

echo "/share/USB1/data/pool1 /share/data/pool1 none bind 0 0" >> /etc/fstab"
mount -a

all of the above in combination with : chown -R myself:myself/share/data , root:myself/share/data , chmod -R a=,a+rX,u+w,g+w /share/data [.........]

The result is always the same: If I ssh to the server im able to see everything inside of "pool1" in both locations, just as i want
If i connect via sftp im able to see the content in both places
If i open the share in Windows, the folder is empty (but in my wsl shell im seeing the content. If I create a new folder via windows inside of "pool1" I'm just seeing the new folder - in WSL SSH I'm seeing the content which used to be there (and no new folder). And yes, I'v double checked - the paths are correct.

Could please somebody help me and tell me what I'm doing wrong. That can't be that hard, hm ?
I just want to fix this last problem and finally go to bed :/

Thanks a lot, guys!
User avatar
Nazar78
Posts: 2235
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Re: How do I mount the right way ?!

Post by Nazar78 »

Code: Select all

mount --bind /share/USB1/data/pool1 /share/data/pool1

Code: Select all

mount --bind /share/USB1/data/pool1 /volume1/data/pool1
You'll need two binds, one is for the share loop (which you already did) the other for the physical volume that smb maps.

Warning, you'll need to umount the bind before reboot/shutdown else your system could hung as the mount is in use by processes like smb thus ADM won't be able to stop the volume/raid stuck there. So do a proper start/stop which includes K49_autostart.
AS5304T - 16GB DDR4 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response
MadaxDeLuXe
Posts: 4
Joined: Tue Jan 09, 2024 11:44 am

Re: How do I mount the right way ?!

Post by MadaxDeLuXe »

Thank you. I'll give that a try.
MadaxDeLuXe
Posts: 4
Joined: Tue Jan 09, 2024 11:44 am

Re: How do I mount the right way ?!

Post by MadaxDeLuXe »

Nazar78 wrote: You'll need two binds, one is for the share loop (which you already did) the other for the physical volume that smb maps.
Is there some special syntax or something I need?

Using the mount command 2 times changes nothing and trying to mount the physical drive ( # mount --bind /dev/sdg1/ /share/data/media/music/alben/ dev/sdg is the usb drive where the data lives) results in an error:

" mount: mounting /dev/sdg1/ on /share/data/media/music/alben/ failed: Not a directory "
User avatar
Nazar78
Posts: 2235
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Re: How do I mount the right way ?!

Post by Nazar78 »

You can only mount "bind" directories but not device nodes.

Code: Select all

mount /dev/sdg1 /share/data/media/music/alben
AS5304T - 16GB DDR4 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response
MadaxDeLuXe
Posts: 4
Joined: Tue Jan 09, 2024 11:44 am

Re: How do I mount the right way ?!

Post by MadaxDeLuXe »

Omg, I just found the problem...

If the user creates an new sharefolder (say data) via ADM UI the folder /share/data is created WHICH ACTUALLY IS /volume1/data.
In "mount" I saw that /share is : /dev/loop0 on /share type ext4 (rw,relatime)

If you create a subfolder "test" in /share/data/ it'll be visible on any client in /share/data/ and in /volume1/data, BUT:
1.1: If you bind to /share/data/ (mount --bind /share/USB3/test/ /share/data/test/) the content won't be visible in Win. Only via ssh / ftp and just in /share/data/
1.2: If you bind to /volume1/data (mount --bind /share/USB3/test/ /volume1/data/test/) the content will be visible in Windows and in volume1... but not in /share/data

So, let's do:
mount --bind /share/USB3/test/ /volume1/data/test
mount --bind /volume1/data/test/ /share/data/test/

Now everything shows up everywhere. I hope it's okay this way.
Is that what u meant with 2 binds?

Since created folders are automatically visible in both directories, I thought binds must be too ..
User avatar
Nazar78
Posts: 2235
Joined: Wed Jul 17, 2019 10:21 pm
Location: Singapore

Re: How do I mount the right way ?!

Post by Nazar78 »

MadaxDeLuXe wrote:Is that what u meant with 2 binds?
Yes :D
AS5304T - 16GB DDR4 - ADM-OS modded on 2GB RAM
Internal:
- 4x10TB Toshiba RAID10 Ext4-Journal=Off
External 5 Bay USB3:
- 4x2TB Seagate modded RAID0 Btrfs-Compression
- 480GB Intel SSD for modded dm-cache (initramfs auto update patch) and Apps

When posting, consider checking the box "Notify me when a reply is posted" to get faster response