Jump to content

Share max size


lachiu

Recommended Posts

  • 5 weeks later...
Posted (edited)

The workaround on how to make Unraid shares with quota. It will work with Hikvision cameras well.

 

1. Make the directory where you will store .img files for shares. I prefer to do this on cache (/mnt/cache), in the folder "system", to keep access fast. However, you can choose "/mnt/user" if you want, it is "more Unraid way". "cameras" is the name of folder where to store *.img files. Type the command in the terminal:

mkdir -p /mnt/cache/system/cameras

 

2. Create .img files with the size (quota) you want. In my case, it is the 10 GB, but you can type any another size:

fallocate -l10g /mnt/cache/system/cameras/51.img
fallocate -l10g /mnt/cache/system/cameras/52.img
fallocate -l10g /mnt/cache/system/cameras/53.img

 

3. Make the filesystems in the .imgs. I prefer ext4, but you can choose btrfs if you know why you need it - it will work as well:

mkfs.ext4 /mnt/cache/system/cameras/51.img
mkfs.ext4 /mnt/cache/system/cameras/52.img
mkfs.ext4 /mnt/cache/system/cameras/53.img

 

4. Go to your Unraid Web GUI, to the tab "Shares". And make required shares, using "Add share" button. Enter your "Share name:", for example, "camera51". "Primary storage (for new files and folders):" - "cache" - actually, it does not matter, but I prefer to set "cache". Press "Add share" button. After creation, go to the section "NFS Security Settings" a bit below and choose "Export:" - "yes". Press Apply. 
Note 1: Hikvision works better with NFS, however, you can share Samba as well in the "SMB Security Settings" section. 
Note 2: If you have no NFS section - press "Add share" button, or read this official instruction: https://unraid.net/fr/blog/deploying-an-unraid-nfs-server
Repeat this step as much as you made images (in my case I have camera51, camera52, camera53 shares). You should have one "share" for each one .img

 

Screenshot2024-05-19at01_10_29.thumb.png.1a06889ca80788285c9f95267b75f078.png

 

5. Mount your .imgs in the corresponding shared folders. Double-check that no errors during the mounts, don't move to the next steps while you do not fix them. Pay attention - your file system (ext4) in mount should correspond to mkfs you did on step 3:

mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/51.img /mnt/user/camera51/
mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/52.img /mnt/user/camera52/
mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/53.img /mnt/user/camera53/

It would be better to mount these folders to cache (/mnt/cache/camera51, ...), however, if somebody makes share on the array instead of cache it will not work. So, the "user" is more safe.

 

6. Add folder mount commands to the start script. Edit /boot/config/go and add to the end:

# mount .imgs for cameras
(sleep 20 && /sbin/mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/51.img /mnt/user/camera51/) &
(sleep 20 && /sbin/mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/52.img /mnt/user/camera52/) &
(sleep 20 && /sbin/mount -r -t ext4 -o loop,rw /mnt/cache/system/cameras/53.img /mnt/user/camera53/) &

Where "sleep 20" is - wait 20 seconds while the system mounts all necessary drives and services, after which it will mount your .imgs. The "&" at the end sends these tasks to the background and allows the system to continue loading. If your system doesn't mount disks - check "mount" again for errors or try to set a higher number for "sleep", for example, 60.
I know that this is not the best solution. Appreciate it if you could suggest better. However, it is work.

 

7. Optional: reboot Unraid to be sure that everything working properly, and .imgs mounts automatically.

 

Congratulations! That's all. You have made quota shares in Unraid.

 

 

Only for Hikvision:

8. ext4 makes "/lost+found" folder on the new drive automatically. It is a trouble, because you can't format drive on your Hikvision cameras. Drive must be empty. So delete "/lost+found" folders in each created shares:

rmdir /mnt/user/camera51/lost+found
rmdir /mnt/user/camera51/lost+found
rmdir /mnt/user/camera51/lost+found


9. Assign your nfs drives to the Hikvision cameras, like this:

 

Screenshot2024-05-19at01_46_31.thumb.png.f1fa494965a02945d8d9ae2e6c5866fc.png

 

Format drive. If the format fails - try this workaround: go to Unraid WebGUI, "Shares" -> your share. Edit "Minimum free space:", for example, set it to 1GB. Press "Apply'. This forces Unraid to reload share services, including NFS. After this Hikvison camera is able to format a drive, even despite the wrong free size. Yes, it is Hikvision, trouble with network drives existed a dozen+ years ago.

 

Screenshot2024-05-19at01_47_47.thumb.png.23eff9da3bdba87b1c4be1f58bc506af.png

 

Screenshot2024-05-19at01_50_34.thumb.png.fdc0c4ae04a589bb9147fc23b3c53ab2.png

 

Screenshot2024-05-19at01_58_47.thumb.png.2d2bdcdfaf07f05c7e0fb0f8449bd561.png

 

Get luck! I would appreciate any improvements you can suggest.

Edited by Nick Kos
  • Thanks 1
Link to comment
  • 3 months later...
On 9/1/2023 at 1:02 PM, Black_SwanNL said:

+1

 

Storage is always an issue with kids. They don't seem to grasp the fact that "a computer" can get full. I want to allow them acces to my server to write stuff onto it so it will be save. School projects and what not. I've setup the family pc with storage restrictions per account and it works like a charm, basic windows stuff. Only problem with the family pc: no redundancy and not really easy if one wants to remotely acces the files per laptop.

 

So space on the server would be THE option. But with the kids filling up there storage space and having to clean up their storage multiple times a year, I'm not giving them acces to multiple TB of storage.

+1

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...