Building a NAS Using Proxmox – Part 2

The setup described in this article will work if you have a followed the first article in this series however it is not an optimal setup. Once you’ve read the next article in this series you’ll understand the weaknesses in the setup described here and how to fix them. This article also covers a couple of other minor setup points towards the end.

Home Shares

When you set up the Samba server as detailed in the earlier article it automatically shared the users home directory. This is all well and good but that directory is inside the container which only has a virtual drive of 8GB, that’s a pretty small home.

Hiding Home Shares

One option you have is to just turn off home directory sharing. The easiest way to do that is to modify the Samba configuration file and just make them unavailable by setting the available flag to no.

[homes]
   comment = Home Directories
   available = no
   browseable = no

Making the Home Directories Writeable

If you’ve kept reading it’s fair to assume you want home directories and you probably want to be able to write things in there. Well this one simple trick should allow you to do that. As mentioned above, out of the box Samba will share home directories but, it turns out, in read only mode! I spent several hours scratching my head wondering why I could read from but not write to my home shares when the permissions looked correct and other shares worked fine. The setting you need is in the [Homes] section and is call read only, as shown below.

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no

Creating Home Shares

I want to give each member of the family their own home directory to store files so what I’ll do is create a new ZFS dataset call home on the host and then bind mount it into /home on the container. At a command prompt on the Proxmox machine.

# zfs create tank/home
# zfs list
NAME           USED  AVAIL     REFER  MOUNTPOINT
tank          4.95M  42.9T      170K  /tank
tank/home      170K  42.9T      170K  /tank/home
tank/scratch   170K  42.9T      170K  /tank/scratch

# cd /tank
# ls -la
total 6
drwxr-xr-x  4 root root    4 Jul  6 17:31 .
drwxr-xr-x 19 root root 4096 May 18 16:17 ..
drwxr-xr-x  2 root root    2 Jul  6 17:31 home
drwxrwxrwx  2 root root    2 Jul  6 12:30 scratch

/tank# chmod 777 home/

Note that it’s necessary to make this directory world writeable so that the container can create home directories. As mentioned in the previous article this is not great but it may be ok in your situation if you only have a home lab.

At this point you might like to move any files out of existing home directories in the container as we’re going to bind mount over the top. Edit the container configuration file on the host e.g. /etc/pve/lxc/100.conf. Add the line shown below.

mp1: /tank/home,mp=/home

You’ll need to restart the container for this to take effect. Once restarted log back into Cockpit and use Navigator to example the /home directory. You should find that it’s now empty. If you copied users home directories away it’s time to put the contents back now.

Windows and Home Directories

Windows Explorer will only show a home directory that matches the name of the user that is currently logged in. If your current Windows account name doesn’t match your Linux account name your home directory won’t show up. All the hidden home directories are still available you just need to enter the name e.g. \\FILESERVER\foo and the credentials.

Workgroup Name

The workgroup name is essentially just a legacy setting now. On Windows machines you can only see shares that are in the same workgroup as your current machine but you can still access any share. On Linux you can see any workgroup and share. Typically you’ll want to just set this to “WORKGROUP” as that is the default for Windows machines. See also and this.

Linux Mint Can’t Access Samba Shares

When I tried to access the Samba shares I had created I got the error message “Unable to mount location. Failed to retrieve share list from server: Invalid argument”. It seems this is a long standing issue in Mint related to kio-fuse which is used by the file explorer (Dolphin or Nemo). Rather than browsing for shares you need to enter the network path into the location bar e.g. smb://fileserver/scratch