Samba quota via sparse container

Creating a sparse file, formatting it with a file system, mounting it, and sharing it.

There are a few ways to go about it. Here's a simple approach that won't require installing any special quota management software. Basically, we set up a 10GB container that we format as ext4, mount, and share.

  • Decide where you want to save her 10GB file. Open a terminal and cd to that directory.
  • Create a 10GB sparse file. This will actually start out with a real size of zero (reported by ls as 10GB though) and grow (du command can show real size) as she adds data

    dd if=/dev/zero of=10GB_Container.img bs=10G count=0 seek=1
    
  • Format the sparse file

    mkfs.ext4  10GB_Container.img
    
  • Create an empty folder somewhere on your computer where you'll mount the sparse file.

    mkdir /your/path/to/mount/point
    
  • Open /etc/fstab for editing and at the very bottom, add an entry to automatically mount your sparse file. Add the following line, changing the paths. The mount will take place automatically on successive boots.

    /path/to/10GB_Container.img    /your/path/to/mount/point    ext4    defaults,loop    0    2
    
  • If you don't want to reboot at this point, mount the sparse file

    sudo mount /your/path/to/mount/point
    
  • Point the file sharing server for your sister's directory to /your/path/to/mount/point.

For use with Hikvision cameras also ensure smb.conf includes:

server min protocol = NT1

No comments:

Post a Comment

Note: only a member of this blog may post a comment.