Restricting Linux Directories With Partition Sizes – Linux System Administration Training – Ubuntu


During the installation of Linux you can specify the partition sizes of several key Linux system directories.

You can also do this with the Linux fdisk or parted commands and then edit the / etc / fstab file to set this up – after the installation of Linux.

The sizes you specify for these Linux system directories restrict the maximum amount of space that can be used in these system directories.

Restricting Directory Sizes with By Specifying Partition Sizes

Each partition that is created on a disk has a fixed size.

Other than the Linux swap partition, system partitions can be assigned to a directory.

Once a Linux system directory has been assigned to a partition, files can only be created in, and "use up" space in that directory – up to the size of the partition. This restricts the amount of space that is available in a directory.

To restrict the amount of disk space that a particular Linux system directory can take up, a partition is created for the directory and then the directory is assigned to the partition.

For example, on a Linux Web server, the system directory named / var is used to contain variable length "log" files.

These log files keep track of the activity on the server, such as access requests that people have made of the server. These log files increase in size as time passes and more requests are made. The more the server is accessed, the greater the size of the log files.

If log files are left unchecked, they can become hundreds of megabytes and even use up all of the space on a disk. These files are sometimes referred to as "runaway" log files. The system should be set up to automatically stop log files from becoming too large, but this does not always happen.

To restrict the space that can be taken up by "runaway" log files, you can create a partition that is large enough to hold the log files and assign the / var directory to it.

For example, if you know that the maximum amount of space that you need for log files (and other files) in the / var directory is 200 MB, you can create a 200 MB partition and assign the / var directory to it. This will stop "runaway" log files from taking up more than 200 MB of disk space.

As another example, you can restrict the size of the "home" directory, in the directory path of / home, that is used by Linux users as the parent directory for their home directories and user data files, by creating a partition specifically for this directory and assigning the / home directory path to this partition.

The Linux commands and concepts covered here apply to ALL Linux distributions, including: Ubuntu, Red Hat, Fedora, SUSE, Slackware, openSUSE and Debian Linux.


Leave a Reply