Mounting volumes for dummies. Anyone care to help?
-
Hi,
First of all, thanks for a great product/service. I am really loving my Cloudron, and I can now have stuff at home that I never would have managed to have without the assistance of this wonderful product. I do, however, have one question.I self host my Cloudron on a dedicated IP/domain with a dedicated ISP. Right next to my Cloudon server, I have a NAS for storgage. This NAS is on a different ISP, and the two networks are not connected.
Let's say I wanted to connect these two networks on "the inside" (ie: keep them on two separate external networks, but have my Cloudron access LAN resources on the NAS), how could I do this?
There's (at least) two different questions. (1) how to get the two networks' LAN's connected, and (2) how to mount a shared folder on the NAS on my Cloudron box?
I have tried searching for help on this forum and on Google, but I probably don't know enough about terminology etc. to find good and understandable responses. I am not a networking professional, so I have no idea if it would work by simply putting an unmanaged Switch between the two networks (ensuring they were on different LAN addresses, e.g. 10.0.1.x on cloudron and 10.0.2.x on NAS), or if that could end up confusing both networks (and the boxes on them).
If anyone could bother to try and help, I would be very thankful!
Have a nice day everyone!
-
@odie do not put a switch between both networks. You'll end up with 2 DHCP servers on the same network, and it'll basically break stuff everywhere.
The "cleanest" way to do this would be to use a third network : just use a second network port on each box (possibly with a cheap USB to LAN adapter), hook them up directly, assign manually addresses on the same subnet to both these new interfaces, and you should be good to go.
As for mounting the storage, depends on what your NAS supports out of the box, but you should read up on NFS and things like that. It's not at all cloudron-specific. You have to mount the storage on the underlying OS before being able to use it on cloudron.
-
I have noticed that this is one of the things that trips users about Volumes the most on Cloudron. That it has to be mounted on the server by hand. Someday, we will have a way to specify the backend (nfs/cifs etc) directly in the Volumes UI and cloudron will take care of adding fstab entries and running mount command. I went ahead and created https://git.cloudron.io/cloudron/box/-/issues/777
-
@girish said in Mounting volumes for dummies. Anyone care to help?:
I have noticed that this is one of the things that trips users about Volumes the most on Cloudron. That it has to be mounted on the server by hand. Someday, we will have a way to specify the backend (nfs/cifs etc) directly in the Volumes UI and cloudron will take care of adding fstab entries and running mount command. I went ahead and created https://git.cloudron.io/cloudron/box/-/issues/777
Yasssss!
I have the damndest time mounting my connection from wasabi to my server.
Having that automated, would be phenomenal! -
Hopefully I am not too forward when asking for more help. I struggle to find good information online (that is comprehensible to me).
I did what @mehdi suggested, got a second USB LAN adapter, and it seems to be working on my Cloudron box (Ubuntu 20.04 server). I manage to add a temporary IP address and enable the card via the two commands:
sudo ip addr add 192.168.9.101/24 dev enxc4411eb4c476
sudo ip link set dev enxc4411eb4c476 upBut I cannot make this persisent across reboots. I found instructions using netplan to edit the /etc/netplan/50-cloud-init.yaml file, but according to the headers of that file, manual edits to this file will be overwritten. The only instructions I manage to find online, are either to edit this file or to use deprecated solutions from 16.04 and before.
If anyone could be of assistance, I would be very grateful.
In short, what I am looking to do:
- (and most importantly), keep my main network interface (enp3s0) as the default gateway (192.168.8.0/24)
- setup the USB network card (enxc4411eb4c476) with the permanent IP address 192.168.9.101/24
- Use the USB network card to access my NAS on the 192.168.9.0/24 network
Any help will be appreciated. Thank you!
-
@jdaviescoates It's not the mount that's the problem here, it's the static IP part.
@odie sorry, I'm not sure about Ubuntu 20.04, I never had to configure a static IP on a distro that wasn't using ifconfig
-
@odie I think it means the manual edits to just that file and not to any file in netplan. You should create your own netplan yaml file and drop it in /etc/netplan. The numbering controls the ordering. So, if you create 99-my-custom.yml then this gets applied after the 50-cloud-init. I also found that https://netplan.io/examples/ has a lot of templates.
-
@girish so if I understand you correctly, adding the USB interface (enxc4411eb4c476) in a 99-my-custom.yml will add that to the already properly configured enp3s0 interface?
This is my "production" cloudron, and I don't have a dev/test, so I'd rather not break anything....
Thanks everyone for offering assitance, I really appreciate it. It's really tricky to figure this stuff out on my own! Most examples seem to require a level of understanding that I don't yet have.
-
@odie also (and I feel bad for asking this) - anyone have a suggestion for how to mount a cifs file system with user and password, and make it persistent. Preferably without storing a password in plain text?
I struggle to mount my shares. I get error messages all the time. Preferably, I'd like to make separate mounted volumes on my cloudron to avoid exposing the entire NAS , and to keep things simpler.
E.g: on my NAS, let's say I have several shares, e.g.:
Entertainment
WorkLet's say I wanted to make a "music" volume on Cloudron, my preference would then be to mount the music folder nested under entertainment, e.g. like this:
sudo mount -t cifs 192.168.9.102/Entertainment/music /mnt/music
similarly, I'd like to be able to mount some work articles in a seperate volume:
sudo mount -t cifs 192.168.9.102/Work/Knowledge/Articles /mnt/articles
I've tried a few variants, they all throw up error messages:
sudo mount -t cifs 192.168.9.102/(share)
sudo mount -t cifs //192.168.9.102/(share)
sudo mount -t cifs 192.168.9.102:/(share)I get error messages like mount: bad usage
Try 'mount --help' for more information.and
mount: /mnt/music: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
Sorry once again for all my beginner questions. I feel bad for having to ask.
-
@odie said in Mounting volumes for dummies. Anyone care to help?:
anyone have a suggestion for how to mount a cifs file system with user and password, and make it persistent. Preferably without storing a password in plain text?
Have a look at the instructions from Hetzner here:
https://docs.hetzner.com/robot/storage-box/access/access-samba-cifsBut basically the idea is to store credentials in
/etc/backup-credentials.txt (mode 0600)
and then reference those in the mount code like this://<username>.your-storagebox.de/backup /mnt/backup-server cifs iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=<system account>,gid=<system group>,file_mode=0660,dir_mode=0770 0 0
-
@odie I think the mount usage is not correct. Please check https://askubuntu.com/questions/1086458/bad-usage-on-attempting-to-mount has some notes as well. I think you want something like:
sudo mount -t cifs //192.168.9.102/Entertainment/music /mnt/music
Also, no need to feel bad for asking
I think the final solution will help others as well. Besides, ultimately, it's just a post in a forum. Worst case, it gets not answered.
-
@girish Thanks for helping out. This is quite tricky. I will write what I've done in case other newbies need something to follow, and see where I am stuck.
Here is my status for now. I can successfully mount the network card and the shares in the way I want (e.g. the example above in music, articles etc. when I do it manually. But my fstab and netplan configs just don't work at all.
- Network card
First trick was to install cifs-utils
sudo apt-get install cifs-utils
Then, I proceed to mount my USB network card with a static IP. The following two commands set the ip address and put the link state to "up":
sudo ip addr add 192.168.9.101/24 dev enxc4411eb4c476 sudo ip link set dev enxc4411eb4c476 up
However, when trying the Netplan config, nothing works. Currently, my 99-my-custom.yml netplan file looks like this:
network: ethernets: enxc4411eb4c476: addresses: [192.168.9.101/24] dhcp4: true version: 2
I've tried different variations of spacing in the file, have have included and removed different parts, e:g:
version: 2 renderer: networkd
But nothing works. No matter what I try, I always get the following message when I try the config:
sudo netplan try Warning: Stopping systemd-networkd.service, but it can still be activated by: systemd-networkd.socket Do you want to keep these settings? Press ENTER before the timeout to accept the new configuration Changes will revert in 113 seconds Configuration accepted.
If anyone can help me making this configuration persistent, I'd be very grateful.
- Mount
Mount is a similar story. After installing cifs-utils, the volumes mount ok, I've even managed to make my credentials file with mode 600:
The folloing manual mounts work:
sudo mount.cifs //192.168.9.102/Entertainment/music /mnt/music -o uid=yellowtent,gid=yellowtent,credentials=/etc/backup-credentials.txt,iocharset=utf8,x-systemd.automount 0 0
and
sudo mount -t cifs //192.168.9.102/Entertainment/music /mnt/music -o credentials=/etc/backup-credentials.txt,uid=yellowtent,gid=yellowtent
But nothing works when trying to automatically mount using fstab. I've tried many variantions on entries, but nothing sticks. Currently, this is what I have:
//192.168.9.102/Entertainment/music /mnt/music /mnt/music cifs iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=yellowtent,gid=yellowtent,file_mode=0660,dir_mode=0770 0 0
when testing the config, I get no error messages, no output at all. But mounting doesn't work...
sudo mount -a
Any assistance/suggestions are appreciated.
Thanks!
Update 1:
After working with the USB interface in a link up statec(manual like above), I tried editing the 99-my-custom.yml file to show the following:network: ethernets: enxc4411eb4c476: addresses: [192.168.9.101/24] dhcp4: no version: 2
Following the advice in the accepted solution in this post: https://unix.stackexchange.com/questions/485395/cant-permanently-assign-additional-ip-addresses-to-usb-ethernet-adapter-via-et
I decided to try adding the "generate"-option with netplan and issued the 3 commands:
sudo netplan generate sudo netplan try sudo netplan apply
I did a sudo reboot, and two strange things happened. Firstly, the Cloudron took forever to reboot, I was thinking I had messed up everything. It still takes forever to reboot on subsequent reboots, so something has happened (I have messed something up, it seems). And secondly, upon successful reboot, the USB ethernet device is just gone from my system...
I do
sudo ip link show enxc4411eb4c476
and it returns: Device "enxc4411eb4c476" does not exist.
I do:
ip a
and the device name doesn't show up. The same thing happens when I do:
sudo lshw -C network
Any ideas on how I messed up, and what to do to fix it? Thanks!
Update 2:
I unplugged and replugged the USB ethernet dongle, and now it's recognized again by the Linux. I've reverted my netplan (99...)-file to the one in Update 1:network: ethernets: enxc4411eb4c476: addresses: [192.168.9.101/24] dhcp4: no version: 2
It still doesn't mount the device on boot, but at least linux finds the device and I am able to mount it manually.
Fun fact... after mounting the device manually, I am able to do a
sudo mount -a
which returns without errors. Further, I am able to list the contents of the mount by doing a
sudo ls /mnt/music
if I list it without root, I get permission denied (probably because of the "yellotent" uid and gid in the mount string in my fstab (see above). Fun fact #2: In my Cloudron web interface, I am able to browse the content of this share if I:
a. unmount the previously mounted volume (/mnt/music)
b. re-add the previously mounted volume (/mnt/music)
c. go to the file browser in the Cloudron GUI and click the "browse" button
d. allow the following Cloudron error in red: "Cloudron error: unable to connect to the file manager server"
e. click browse once more - then the contents of the share is loaded, and I can access the filesSo it might look like my fstab code is halfway working, and the problem is that ubuntu 20.04 doesn't automount my usb network card. Hopefully, someone can shed some light on this.
- Network card
-
@odie Still stuck on this. The culprit is definitely that the usb network card fails to receive its configuration on boot. I cannot get netmanager to configure and initialize it at all. Only the two manual commands seem to work:
sudo ip addr add 192.168.9.101/24 dev enxc4411eb4c476 sudo ip link set dev enxc4411eb4c476 up
I have tried various thing with network manager, and I've tried adding a config file to systemd-networkd under /etc/systemd/network/ - the only thing I achieved, was to have every network freeze when I inserted the usb ethernet adapter (only to unfreeze as soon as I disconnected it). Tried keeping it disconnected for longer, just to see, but connections were frozen until I unplugged the usb network card. So I had to remove these config files.
Can anyone offer suggestions? I don't know where to even look for assistance on this now... Thanks!