General Category > General Discussion
How to move /var folder to a new partition in Linux
(1/1)
vaishakp:
Your /var directory has filled up and you are left with no free disk space available. This is a typical scenario which can be easily fixed by mounting your /var directory on a different partition.
- make the new partition, & format with mkfs.ext3
- mount the new filesystem in /mnt
#mkdir /mnt/newvar
#mount /dev/sdb1 /mnt/newvar
- Go to single-user mode so that there is no rw activity on the directory during the process
#init 1
- Backup data in var only (not the /var directory itself)
#cd /var
#cp -ax * /mnt/newvar
- Rename the /var directory (to make sure this has worked before deleting it!)
#cd /
#mv var var.old
- Make new var directory
#mkdir /var
- Unmount the new partition
#umount /dev/sdb1
- Remount it as /var
#mount /dev/sdb1 /var
- If everything goes fine then put an entry into /etc/fstab
/dev/sdb1 /var ext3 defaults 0 0
Done.
Navigation
[0] Message Index
Go to full version