Several HDDs - all in the same folder for server

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
Post Reply
ShakeyJake
Level 2
Level 2
Posts: 51
Joined: Fri Feb 26, 2010 7:35 am

Several HDDs - all in the same folder for server

Post by ShakeyJake » Mon Jun 24, 2019 1:18 pm

Hi guys,

Please help, I'm stuck. I have a server at home with a boot drive and a swap drive as well as 3 data disks. I would like, for the sake of simplicity, to have all three data disks appearing in one folder on the network. I know that LVM and JBOD etc would be options, but I'd prefer to stay away from that if at all possible.

1st I tried simply mounting the disks (using fstab) in one folder and then sharing that folder. This however caused problems with permissions and apparently it's conventional wisdom not to share the root directory of a hard drive.

2nd was to mount the disks as before, then create a folder within each disks. I then created a folder /home/jack/server and symlinked a folder on each hard drive into the server folder. Unfortunately, when accessing the server from a client pc the symlinked folders don't show up.

Loads of people will have multiple disks on one server, so I can't be the first person to want to do this, what's the best way to do it please?

Thanks,
Jack

PS- if the specifics matter then they're below:

1st scenario: disks mounted as /disks/vault, /disks/backup and /disks/videos. Shared /disks folder, permission issues

2nd: disks mounted almost as above, one folder in each disk /disks/backupdisk/backup etc. Folders symlinked into /home/jack/server/backup etc. Sharing /home/jack/server. No symlinked folders showing in share.
Jack :)

altair4
Level 19
Level 19
Posts: 9716
Joined: Tue Feb 03, 2009 10:27 am

Re: Several HDDs - all in the same folder for server

Post by altair4 » Mon Jun 24, 2019 1:39 pm

1st I tried simply mounting the disks (using fstab) in one folder and then sharing that folder. This however caused problems with permissions and apparently it's conventional wisdom not to share the root directory of a hard drive.
It's conventional wisdom not to share the root directory of the partition that the operating system occupies but that is only for security reasons.

What are the Linux permissions of the /disks folder and its three subfolders:

Code: Select all

ls -al /disks
And how are you sharing them:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

ciniset
Level 1
Level 1
Posts: 5
Joined: Thu Dec 28, 2017 10:14 am

Re: Several HDDs - all in the same folder for server

Post by ciniset » Mon Jun 24, 2019 7:04 pm

use "mount --bind"
see http://docs.1h.com/index.php?title=Bind ... &oldid=492 (or google "mount --bind")

ShakeyJake
Level 2
Level 2
Posts: 51
Joined: Fri Feb 26, 2010 7:35 am

Re: Several HDDs - all in the same folder for server

Post by ShakeyJake » Thu Jun 27, 2019 2:36 pm

altair4 wrote:
Mon Jun 24, 2019 1:39 pm
1st I tried simply mounting the disks (using fstab) in one folder and then sharing that folder. This however caused problems with permissions and apparently it's conventional wisdom not to share the root directory of a hard drive.
It's conventional wisdom not to share the root directory of the partition that the operating system occupies but that is only for security reasons.

What are the Linux permissions of the /disks folder and its three subfolders:

Code: Select all

ls -al /disks
And how are you sharing them:

Code: Select all

testparm -s

Code: Select all

net usershare info --long

Thanks for the help!

Code: Select all

ls -al /disks
total 32
drwxrwxrwx  8 root   jack    4096 Jun 24 17:41 .
drwxr-xr-x 24 root   root    4096 Jun 27 19:29 ..
drwxr-xr-x  2 root   root    4096 Jun 24 17:14 backup
drwxrwxrwx  4 nobody nogroup 4096 May 14 21:08 backupdisk
drwxr-xr-x  2 root   root    4096 Jun 24 17:14 vault
drwxrwxrwx  4 root   root    4096 Jun 24 17:39 vaultdisk
drwxr-xr-x  2 root   root    4096 Jun 24 17:14 videos
drwxrwxrwx  4 root   root    4096 Jun 24 17:43 videosdisk

-----

[jack@jack-server ~]# testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
	dns proxy = No
	log file = /var/log/samba/log.%m
	map to guest = Bad User
	max log size = 1000
	obey pam restrictions = Yes
	pam password change = Yes
	panic action = /usr/share/samba/panic-action %d
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	passwd program = /usr/bin/passwd %u
	server role = standalone server
	server string = %h server (Samba, Ubuntu)
	syslog = 0
	unix password sync = Yes
	usershare allow guests = Yes
	idmap config * : backend = tdb


[printers]
	browseable = No
	comment = All Printers
	create mask = 0700
	path = /var/spool/samba
	printable = Yes


[print$]
	comment = Printer Drivers
	path = /var/lib/samba/printers

-----

[jack@jack-server ~]# net usershare info --long
[Server]
path=/home/jack/Server
comment=Banktop Server
usershare_acl=Everyone:F,
guest_ok=y

Jack :)

ShakeyJake
Level 2
Level 2
Posts: 51
Joined: Fri Feb 26, 2010 7:35 am

Re: Several HDDs - all in the same folder for server

Post by ShakeyJake » Thu Jun 27, 2019 2:48 pm

ciniset wrote:
Mon Jun 24, 2019 7:04 pm
use "mount --bind"
see http://docs.1h.com/index.php?title=Bind ... &oldid=492 (or google "mount --bind")
Thanks to you also! This works fine but it reports the wrong 'free space' when I access my folder from a client and this prevents me from copying anything in. The videos disk is an empty 2TB drive, but when I look at the share from my desktop it only shows 108.4GB, which is the amount of free space on the server's boot drive, not the storage drives.
Jack :)

altair4
Level 19
Level 19
Posts: 9716
Joined: Tue Feb 03, 2009 10:27 am

Re: Several HDDs - all in the same folder for server

Post by altair4 » Fri Jun 28, 2019 6:53 am

drwxrwxrwx 8 root jack 4096 Jun 24 17:41 . <--- This is the /disks folder permissions
drwxr-xr-x 2 root root 4096 Jun 24 17:14 backup
drwxr-xr-x 2 root root 4096 Jun 24 17:14 vault
drwxr-xr-x 2 root root 4096 Jun 24 17:14 videos
The Linux permissions on the subfolders to /disks only allow write access to root.

I'm not sure how you are using these subfolders locally as "jack" unless you do everything as root or sudo but if you created a samba share of /disks and allow guest access samba will let you in but you won't be able to do much because Linux will stop all writes by that guest.

So create the share at /disks not your home folder and ...

[1] You can set permissions of all those subfolders to 777 if you want:

Code: Select all

sudo chmod 777 /disks/backup
sudo chmod 777 /disks/vault
sudo chmod 777 /disks/videos
[2] You can also create the share definition in smb.conf itself and "force" the guest user to be root which is not something I would do personally but it will work.

[3] You can also make the owner of those subfolders "jack" then in smb.conf force the guest user to be "jack".

All of this depends on how you are using these subfolders.

Option [1] will allow write access to everyone but all files saved will be owned by "nobody". Option [2] files will be saved owned by root and option [3] will save with jack as owner.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

ShakeyJake
Level 2
Level 2
Posts: 51
Joined: Fri Feb 26, 2010 7:35 am

Re: Several HDDs - all in the same folder for server

Post by ShakeyJake » Mon Jul 01, 2019 12:33 pm

Thanks all,

I'm now at the point where I've got all the shares in all of the right places but I'm still suffering with the problem where the folders show that they have 104GB of free space when accessed via the desktop client. In other words, they show the amount of free space on the server's . drive rather than the free space on the storage drives. This means I can't really copy anything into the server.
Jack :)

Post Reply

Return to “Other networking topics”