Hello SMB, bye bye OMV
In this post I'm going to talk about why and how I moved my Open Media Vault Network Attached Storage system to my Ubuntu server.
In my previous posts I talked about my OMV NAS. In my NAS I have the following things set up.
- SMB shares that can be accessed by both Windows and Linux machines
- Custom user permissions
- Automated backups
- Metrics and logging
In an attempt to be more frugal I'm trying to reduce the number of servers in my home lab. So lets talk through the process of moving this setup from OMV to Ubuntu.
- Mounting multiple USB hard disks to the same location between reboots
- Creating samba shares in Ubuntu server
- Setting up SMB in windows client machines
- Automated backups using rsync and cron
- Metrics and logging
Mounting USB drives permanentlyAs mentioned before I'm using 3 USB hard drives for storage and backup. These USB drives needs to be mounted to the same location all the time because the SMB shares and the rsync cron job depends on it.
Every disk partition has a unique identifier which is called an UUID. Firstly you need to find this. This can be found using the blkid command. You may or may not need super user permissions to do this. You can issue "sudo blkid" command to find the UUID of all drives connected to your system or you can issue "sudo blkid [device ...]" to find the UUID or a specific partition.
Armed with the UUIDs of my USB disk drives I created mount points for them. I created 3 folders in "/media" as mount points for the disks. Next step is to add entries into the file system tables or fstab. Fstab is generally used to mount internal devices. In my use case though I'm going to use fstab to permanently mount my USB disk drives. The syntax for the fstab is,
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
I added 3 new entries to my /etc/fstab file.
I validated the disk mount locations with a few restarts.
Creating Samba shares
I installed samba into my Ubuntu server using the apt tool
sudo apt install samba
Next comes the user management. Firstly I created the users I need in my Ubuntu server using the "adduser" command. Samba doesn't use system passwords so I needed to set the samba passwords for the users.
sudo adduser user1 sudo smbpasswd -a user1
Then I created the samba shares. The configuration has to be added to the "/etc/samba/smb.conf".
Given above is the config for one of the shared folders. The configuration follows the samba syntax. Linux permissions proceed samba permissions so the folders shared has less restrictive permissions to allow "others" category read, write and execute permissions as needed.
Enabling Samba in Windows
In order for the windows machines in my network to view the samba shares I had to enable the SMB file sharing support windows feature.
I will talk about the backups and logging in a future post. Stay tuned ...
Post a Comment