How to move or relocate /var folder to a new partition in Linux

How to move or relocate /var folder to a new partition in Linux

Situation
How to move or relocate /var folder to a new partition in Linux

Resolution
Sometimes it may be necessary to move linux directories to separate partitions because the root partition is too small and cannot be resized or extended. To relocate or move the /var folder to a new partition in Linux, please follow the steps below:

1. Add a new hard disk to the server. Note: If this is a virtual machine, see how to add a new virtual hard disk to the VM with a corresponding vendor.
2. Mount the new filesystem in /mnt, from YaST:
o Launch YaST, select Partitioner | expand Hard Disks | select Add Partition...
▪ New Partition Type: Primary Partition
▪ Select Maximum Size, if preferred.
▪ Formatting Options: ext3 (default)
▪ Mounting Options: Mount Partition and specify Mount Point as /mnt/newvar Note: If there is a problem, the directory may need to be created first.
▪ Select Finish and then Next.
3. Switch to single-user mode:
init 1
Note: This will reboot the server into single-user mode where services aren't started and networking is offline for the server. Please login as root when the login dialog is presented and proceed to open a terminal window.
4. Copy the data in var only to the new mounted filesystem:
cp -apx /var/* /mnt/newvar
5. Rename the current /var directory for backup purposes:
mv /var /var.old
6. Make the new var directory:
mkdir /var
7. Edit the /etc/fstab file:
o Replace /mnt/newvar with /var
o Save and Close the file. Note: The new partition is now configured to be mounted at /var on boot.
8. Restart the server.
    • Related Articles

    • HOW TO INCREASE DISC SIZE

    • HANA LOG FULL

      SAP HANA Database Tips Everything about SAP HANA Database at one place! /hana/log is 100% full in Sap Hana BY HANA BLOGGER Many of us would have came across this situation of /hana/log is 100% full & your system is not able to come up. If you’re ...
    • SAP AUDIT TRAILS

    • SQL TO HANA MIGRATION

      METHODOLOGY MIGRATE SAP BUSINESS ONE FROM SQL SERVER TO SAP HANA In general, we recommend adopting the latest version for SAP Business One, version for SAP HANA. Nevertheless, it is up to the customer whether they go for the SAP Business One, version ...
    • SAP BUSINESS ONE COMPLIANCE GUIDE FOR DEVELOPERS AND SYSTEM ADMINISTRATORS

      3137373 - DIAPI_Slow Performance When Working With DI API Symptom ➢ You are working with the Data Interface API (DI API) add-on and you are affected by slow performance issues. Cause ➢ System behavior/ Functionality description/ Business process ...