How To: Separate and extend /var/log from /var partitions quick and undirty

If you plan a new UCS domain, you can adapt the partitioning to a more serverly way. This would be suitable basically for UCS Masters, BackUps and Slaves. Partitionsizes in this example may change to your needs.


  • choose install LVM with separate /home, /var/ and /tmp partition
  • finish the installation of UCS (with or without joining the system into the domain, if its not an UCS Master)
  • shutdown the system
  • mount a Live-Linux-CD (i.e. Debian, GParted Live, Ubuntu or whatever you like) and boot it
  • enter the command prompt in the Live-Linux of your choice

In between the following steps, check with lsblk, pvdisplay and/ or df -h frequently, if the results fit your needs.

# create mount directories and mount root, var and lognew
cd /mnt
mkdir root var logneu
mount -o rw /dev/vg_ucs/root /mnt/root
mount -o rw /dev/vg_ucs/var /mnt/var
mount -o rw /dev/vg_ucs/varlog /mnt/lognew

# for the following work with the lvms:
# -t is for dry-run, remove to run the command on the selected partition; 
# -v for verbose output; remove if you are a more quiet person ;) 

# remove /home and /tmp paritions
lvremove -tv /dev/vg_ucs/home
lvremove -tv /dev/vg_ucs/tmp

# extend /var-partition to 70 GB
lvextend -tv -L70GB -r /dev/vg_ucs/var

# create /varlog-partition and use all free space, that is left (see "Free PE" when checking `pvdisplay` and create ext4-filesystem
lvcreate -tv -l+100%FREE -r varlog vg_ucs
mkfs.ext4 /dev/mapper/vg_ucs-varlog

# copy old /var/log/-content to /mnt/lognew
rsync -oav /mnt/var/log/ /mnt/lognew/

# remove old /var/log/-content, but not the directory itself!
rm -r /mnt/var/log/*

# adjust /etc/fstab of the "real" UCS-system
# remove the lines /home with /tmp
# duplicate line of /var and change the partitionname to -> varlog and the mount-point /var/log
vi /mnt/root/etc/fstab

systemctl poweroff

If everything worked fine, it should look i.e. like this:

df -h
Dateisystem               Größe Benutzt Verf. Verw% Eingehängt auf
/dev/mapper/vg_ucs-root     22G    3,9G   17G   19% /
/dev/mapper/vg_ucs-var      70G     31G   34G   42% /var
/dev/mapper/vg_ucs-varlog   52G    3,6G   46G    8% /var/log

see also: How-To: Extend Disk Space


This topic was automatically closed after 60 minutes. New replies are no longer allowed.