linuxcentospartitioningoraclelinux

How to do partition for directories in Linux server


Kindly to make partitions as shown below.

    Filesystem                    Size  Used Avail Use% Mounted on
    devtmpfs                       12G     0   12G   0% /dev
    tmpfs                          12G     0   12G   0% /dev/shm
    tmpfs                          12G  1.2G   11G  10% /run
    tmpfs                          12G     0   12G   0% /sys/fs/cgroup
    /dev/mapper/ol-root           300G   96G  205G  32% /
    /dev/mapper/ol-var             13G  1.7G   11G  14% /var
    /dev/mapper/ol-home            40G   12G   29G  29% /home
    /dev/mapper/ol-tmp             10G   33M   10G   1% /tmp
    /dev/sda1                     497M  311M  187M  63% /boot
    /dev/mapper/ol-var_log         10G  330M  9.7G   4% /var/log
    /dev/mapper/ol-var_log_audit  5.0G   68M  5.0G   2% /var/log/audit
    tmpfs                         2.4G     0  2.4G   0% /run/user/1000

My new server is showing as below, i want to do partition as same as above - root directory should contain 220+GB, home - 40GB, tmp - 10GB, var - 13GB.

    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs              12G     0   12G   0% /dev
    tmpfs                 12G     0   12G   0% /dev/shm
    tmpfs                 12G  8.7M   12G   1% /run
    tmpfs                 12G     0   12G   0% /sys/fs/cgroup
    /dev/mapper/ol-root   50G  5.3G   45G  11% /
    /dev/mapper/ol-home  328G  109M  327G   1% /home
    /dev/sda1           1014M  251M  764M  25% /boot
    tmpfs                2.4G     0  2.4G   0% /run/user/1003

please help, thanks in advance.


Solution

  • The steps are:

    1. login as root
    2. unmount and destroy LV ol-home (make backup if there are some files in home directory before operation)
    3. extend LV ol-root and / filesystem to 300GB
    4. Create LVs ol-var, ol-home, ol-tmp with relevant sizes and create filesystems for these LVs
    5. edit /etc/fstab to mount the filesystems on startup

    Voila