Score:0

How can I implement quotas in samba?

co flag

I want to create smb shares that are limited by a given quota size also I want to be able to modify the quota size in the future. While searching for a solution I came across the setquota command but I guess it only gives the option to implement per user and per group size quota limit but not on per folder/filesystem basis.

Then, I tried doing this using this https://superuser.com/a/976714 answer. The problem is file size modified using the "dd" command is correctly showing an increased size on the Ubuntu system, but the modified size is not reflected to the users (i.e. they still see the old size).

SUNITA GUPTA avatar
co flag
After increasing size of image I see the extra added space is un-allocated (shown as free space in parted), I think it might be cause of problem so I am trying to find cli based method to merge this space in original partition. Am I in right direction?
Emre Talha avatar
ar flag
Yes. But I've noticed that I've written incorrectly. The file itself is the disk. By increasing the file size, you've increased the disk itself. After that, you need to increase the size of the partition [with `parted` or `fdisk` (cli partition managers)](in my case it increased automatically). After increasing the size of the partition, you need to resize the file system, (before resizing it is recommended to check the file system's integrity with e2fsck(ext2/3/4))with `resize2fs` (for ext2/3/4 file systems, if other you need to specify it or find the necessary one yourself).
SUNITA GUPTA avatar
co flag
@EmreTalha Thanks for guiding me through the process.
Score:1
co flag

The problem was I was trying to merge the unallocated space with an already-made partition using fdisk, another issue was I was running resize2fs on the loop device rather than on the image (noob mistake). Somehow that was creating block errors which were diagnosed with e2fsck. I stopped merging partitions and directly used the resize2fs command and I was able to get the task done. Steps I followed are below:

a) Made a sparse file with dd and an empty folder using mkdir.

b) Formatted file/image using mkfs.ext4 on the image.

c) Mounted image of created folder by editing /etc/fstab file with loop option.

d) Stored some files in the mount (just for testing).

e) Unmount the folder using umount.

f) Extended the size of the file again using the dd command with an increased seek parameter.

g) Resized the filesystem in the image using resize2fs.

h) Ran e2fsck for checking any errors in image formatting.

i) Mounted it again.

j) Created a samba share with the path pointing to the folder mounted and appropriate permissions.

theYnot avatar
gb flag
Instead of doing a bullet pointed list please use proper formatting. You can find more information on formatting help here. Use back ticks for code a single back tick for inline code editing and triple back ticks followed by \n for code blocks. see more here: https://stackoverflow.com/editing-help
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.