Home > server > How can i limit disk space usage for one user?

How can i limit disk space usage for one user?

April 3Hits:1
Advertisement

Like.. User john123, you can only use 100mb of my harddisk. User jake155, you can only use 250mb of my harddisk.

Answers

To restrict hard disk usage per user efficiently we could create a separate partition for each of the /home directories. However then it's obviously not so easy to change the granted space or add new users.

We therefore may use fixed sized images as a container for the users /home and mount these as loop devices (as root):

1 mkdir /media/users/
2 dd if=/dev/zero of=/media/users/john123.img bs=512K count=200
3 mkfs.ext4 /media/users/john123.img
4 mkdir /home/john123

For testing:

5 mount -o loop /media/users/john123.img /home/john123

After having done so we then create our user john123 who will now have 100 MB space available in his /home/john123.

Subsequently the loop devices will have to be mounted prior to login, e.g. by adding this to /etc/fstab:

6 /media/users/john123.img    /home/john123    ext4    loop    0    2

The standard way to do it in UNIX is through the quota command. It allows you to dynamically change how much disk space each user can use.

See the man page, or google for a tutorial.

The route to take may be to limit the size of a user's home directory, i.e. limit /home/jake155 to a certain size. Typically a non-admin user cannot access anything beyond their home directory unless you change permissions otherwise. This thread discusses multiple ways to do that.

Related Articles

  • How can i limit disk space usage for one user?April 3

    Like.. User john123, you can only use 100mb of my harddisk. User jake155, you can only use 250mb of my harddisk. --------------Solutions------------- To restrict hard disk usage per user efficiently we could create a separate partition for each of th

  • Does a recursive disk-space-usage pie-chart web-page generator exist for Linux?October 27

    Does anyone know of a per directory ( not per user) disk space usage pie chart generator script for linux? I want to generate a set of web pages that will give me the usage of each directory, and then you can click on the pie-chart segment and see th

  • Calculating disk space usage per MySQL DBMarch 4

    I am currently using information_schema.TABLES to calculate the total disk space usage grouped by the database name, but it is running terribly slowly. On servers with hundreds of databases, it can take minutes to calculate. What is the quickest meth

  • Windows 8 disk space usage vs Windows 7

    Windows 8 disk space usage vs Windows 7August 18

    The official Microsoft Windows 8 (64 bit) disk space requirements are the same as Windows 7: 20 GB. In actual practice, how does Win8's disk space usage compare to Win7's? Specifically, how does disk space usage compare after a clean install of each?

  • What's going on with the disk space usage here?

    What's going on with the disk space usage here?April 11

    I have a process where I am removing BLOBs from a DB and writing them to a file structure on disk. I have a 1TB disk, with a single folder in the root, and a structure similar to: F:\RootFolder\_year_\_week_\_clientid_\_accountid_\file.txt There will

  • Why am I getting low disk space usage?

    Why am I getting low disk space usage? June 30

    I have problems understanding my disk space usage. I am using Ubuntu 12.04. I am recently going low on disk space and I cannot understand why. Here is the result of du (only largest folders). 716.0K Videos 1.1M giorgio2.pdf 1.7M 2011_Thesis_Caroline_

  • GoDadddy Disk Space Usage figure doesn't make sense

    GoDadddy Disk Space Usage figure doesn't make senseFebruary 27

    I'm trying to figure out how much disk space my website takes up. I'mm looking on cPanel (Linux version) and the Disk Space Usage figure doesn't make sense: Maybe i'm just being stupid but they haven't specified the unit type. Am I really using up 70

  • Disk space usage utilization analysis for Windows

    Disk space usage utilization analysis for WindowsJanuary 22

    I have been using 2 different disk usage utilities to quickly find which files and folders are wasting the most space on Windows. They are Disk Piecharter and Ridnacs. http://www.splashsoft.de/Freeware/ridnacs-disk-space-usage-analyzer.html Does anyo

  • OSSEC disk space usageMay 7

    A few days ago I noticed that the disk of my Ubuntu server was almost full. I dug a bit and found out that the disk space was used by OSSEC, in the /var/ossec/queue/diff folder. I wanted to try something immediate so I deleted the contents of this fo

  • Logwatch Disk Space Usage is Wrong/StaleJanuary 3

    I have a RHEL 5 server that recently ran out of disk space and now our Logwatch for the server reports the following disk usage (I think this is the last accurate night before the /var partition filled up): Filesystem Size Used Avail Use% Mounted on

  • ubuntu server disk space usage June 23

    I have an Ubuntu server.my Mysql service stopped and it did not start. I found out that my free disk space is very low. Filesystem Size Used Avail Use% Mounted on /dev/cciss/c0d0p1 32G 31G 0 100% / none 497M 312K 497M 1% /dev none 501M 0 501M 0% /dev

  • Determining disk space usage & file counts for extremely large data sets (any tricks?)August 20

    Long time reader, first time asker: I'm a junior-level Linux admin who's increasingly supporting very large data sets/stores on local & NFS storage. The data is generally in the form of massive folder & file trees with arbitrary names. To give an

  • strange ZFS disk space usage report for a ZVOLMay 30

    We have a 100G ZVOL on a FreeBSD 10.0-CURRENT host which claims to use 176G of disk space: [email protected]:~ # zfs get all zroot/DATA/vtest NAME PROPERTY VALUE SOURCE zroot/DATA/vtest type volume - zroot/DATA/vtest creation Fri May 24 20:44 2013 - zro

  • How to limit disk space per user on Ubuntu 13.10?February 10

    I am new on Ubuntu. I want to limit the disk space per user. For example: Jhon Doe 10gb, Jane 20gb, and so on. I wrote the following code as root: gedit /etc/fstab . In the new window I got this: # /etc/fstab: static file system information. # # Use

  • analyse disk space usage of an encrypted home directoryMay 4

    I'm having some problems with a full disk. According to df -k I'm using 47 gb of data in my home folder and I have no idea where all of that data is hiding. I tried using the disk usage analyser aka baobab but since my home directory is encrypted I c

  • Reducing system disk space usage on computer with SQL Server

    Reducing system disk space usage on computer with SQL ServerNovember 20

    The disk usage on my computer continues to rising with time. How can reduce his size without damaging programs and windows. The disk is SSD with 180 GB, because of that this is sensitive to me ! Biggest folders: Program Files (x86) -52.6 GB Windows -

  • Disk space usage in large folders with over one million filesFebruary 4

    I have a NTFS-compressed folder containing one to two million small (~25KB) text files. Recently, I noticed that far more space was being consumed than would be expected. Digging deeper revealed that right clicking on the containing folder and viewin

  • Hard disk space usage goes from 96% to 100% one minute after restartOctober 27

    I have a mid 2014 MacBook Pro 13" (MacBookPro11,1) with 128 GB SSD. I have a lot of applications that I use that won't work on a external hard drive, so I always have issues with space. But going from 5 GB to 0 in a minute after restart? I had a look

  • slim down disk space usage windows 7

    slim down disk space usage windows 7December 29

    How can I reduce the amount of hard drive space Windows 7 uses? I've got my Win7 cramped into a 10GB virtual machine, and with Office installed, I'm running out of space. The short answer 'use a bigger virtual HD' is not working out for me. The host

  • determining disk space usage on plesk domainFebruary 27

    I have an unix webserver runing Plesk control panel with several domains configured. Plesk is reporting that one of the domains is using 1129 mb of disk space, however, I can't seem to find what exacly is taking so much space. I've logged in into the

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.477 s.