Monday, August 24, 2009

Move /var to its own (logical) partition in LVM

(all this using Oracle EL 5, aka RHEL 5...)

From memory, so there may be errors:

  1. Boot off of the installation cd using "linux rescue"
  2. Unmount all of the drives in /mnt/syslinux
    • Note: Before unmounting /mnt/syslinux itself, you must unmount all of the mountpoints within it.
  3. $ resize2fs /dev/VolGroup00/ 5G
  4. ... boot back into regular linux ...
  5. $ lvreduce -L 6GB /dev/VolGroup00 (answer yes)
  6. $ lvcreate -L 10G -n var VolGroup00
  7. ... boot back into rescue mode ...
  8. mkdir /mnt/var
  9. mkfs -t ext3 /dev/VolGroup00/var
  10. mount -t ext3 /dev/VolGroup00/var/ /mnt/var
  11. mv /mnt/syslinux/var* /mnt/var
  12. (edit fstab so that it mounts the new logical volume to /var)
  13. resize2fs /dev/VolGroup00/LogVol00 (remember how I made this 5Gb when the LV was 6GB?)
  14. reboot!

On rebooting, syslogd had a problem starting. (Running in debug mode, it would complain of "permission denied" to /var/log/secure and all other log files).  It was an SELinux problem and was remedied by relabeling the filesystem.

No comments:

Pyjamas