Set quota on dir

I should think so, as I said never done a container mount myself.

well Iā€™m not there w/ the container file yet, was just trying you recipe for the symlink

well, then it should work. If there is an issue, Iā€™ll gladly try to setup this for myself and ā€œdocumentā€ a solution. But I hope you enjoy playing around in shell and get more comfortable there, because you can do real magic with your OSMC device when you feel comfortable in shell. I mean my device is so much more then just a video-device.

agreed. i already run NextDNS CLI on it. and borgbackup

do I need to mount the *.img first to a dir on /media/ā€¦ and only then mount this mount point to the ~/osmc?

Did this but it seems I get no permission to write

write permission problem in OS or vsftp?

hmm, ftp canā€™t write into the dir (mounted *.img)

okey then we got to look in the ftpd logs, youā€™ll find the location in vsftpd.conf file somewhere under /etc folder, to see if there is something obvius. Itā€™s 11pm here and Iā€™m about to hit the sack. If you havenā€™t got it to work tomorrow afternoon for me Iā€™ll try to do a image file mount and share it via vsftpd.

hi, I canā€™t check this out before the weekend, I believe ā€“ too busy w/ day job

Iā€™ll do some quick testing here then, if the mrs permits =). Will get back to you

@thobu Well the mrs didnā€™t premit much this week =)

But reward comes to those that wait, login to your osmc user folder, via ssh and do this:

mkdir /home/osmc/containers
dd if=/dev/zero of=/home/osmc/containers/test1_container.img bs=1M count=1024
mkfs.ext4  /home/osmc/containers/test1_container.img
sudo mkdir -p /mnt/test1
sudo mount -t ext4 -o loop,rw /home/osmc/containers/test1_container.img /mnt/test1
sudo chmod 777 /mnt/test1/
mkdir /home/osmc/test1-storage/
sudo mount -o bind,rw /mnt/test1/ /home/osmc/test1-storage/
sudo nano /etc/vsftpd.conf

At the bottom of the file insert this line:

allow_writeable_chroot=YES

Then CTRL+x,y,ENTER

Restart the ftp server:
systemctl restart vsftpd

Login via your ftp client, and go to your ā€œtest1-storageā€ folder in you home directory. I did this and voila I could write, read files and create folder. Didnā€™t try to delete anything or write more then 1 gigabyte of data, but I guess it would work.

So modify the file and folder names to suite your needs.

So whatā€™s need to be done is convert those mount lines to fstab entries. Good Luck

1 Like

hey, thanks :+1: ā€¦ Iā€™ll study the recipe and see how far I can get.

one question: do I read this correctly and you created the img container under ~/osmc/containers. Would it also work for an image container on a /media location?

Itā€™ should work, but you have to make sure osmc user has read/write to that /media location, when mounting the image file as a folder ~/ or /mnt/container, and then a bind mount from /mnt/container/ to /home/osmc/thisistheimagefsfolder.

As long as the file system gives you r&w access, ftpclient should have the same in the end.

thanks, Iā€™ll check this out once Iā€™m back from a week of vacationsā€¦

it seems to work as I get the recordings in both /mnt/test1 and in /home/osmc/test1-storage. But Iā€™m actually not sure since I tell the camera to write to /test1-storage. Does this setup control the /test1-storage via the /mnt/test1 and the container and limits it to the 1GB defined for the .img. Is this what it does?

As I understood it, yes. You make a mount of the 1gb file as a ext-fs into /mount/test1, then bind a folder in /home/osmc/test1-bind-folder, which has ā€œthe sameā€ function as a ln would have. So in short when you write in the ā€œbind-folderā€, it gets writen to your 1gb filesystem, Represented twice in your Root file system, but it shouldnā€™t be two copies of it.

you said something about the fstab file. how would I add these 2 mount commands, would this work?

/home/osmc/containers/test1_container.img /mnt/test1 none defaults,bind 0 0 
/mnt/test1/ /home/osmc/test1-storage/ none defaults,bind 0 0

Iā€™m no fstab expert, add these lines (changed to your perfered paths) at the end of fstab, I think would work:

# Initial mount (this example uses smb to connect to NAS), but if you are using an extrnal hdd, it should automount when connected/reboot in /media filder instead
//servername/sharename  /mnt/windowsshare  cifs  guest,uid=1000,iocharset=utf8  0  0

# loopback (container file)
/mnt/windowsshare/contrainerfile.blob /mnt/container ext4 defaults,x-systemd.requires-mounts-for=/media/windowsshare,loop 0 0

#bind to osmc-home folder directory
/mnt/container /home/osmc/preferred_name  none  bind,x-systemd.requires=/mnt/container

This is untested, but thatā€™s from my understanding how it should work. the requires option makes it so that the remote filesystem is there first, then next that the containers is mounted before binding to your preferred folder.

Ps. since I havenā€™t tested it, I would make sure mount points exist, that is mkdir em once, before trying out the fstab. If there are errors in my suggested setup, you are stuck with google for solutions, Iā€™m not knowledgeable enough in fstab to be more help full.

thanks man, Iā€™ll look into this and check the fstab documentation. For the time being Iā€™m using the local dirs so no initial mount necessary for this, I guessā€¦