skip to Main Content

I’m banging my head against a wall for the last 5 hours or so.

I have a brand new Centos 6 installation with Plesk. Once the machine is booted up I’m trying to move the /var folder to an attached EBS (/dev/xvdj):

#copy original /var to /dev/xvdj
mkdir /mnt/new
mount /dev/xvdj /mnt/new
cd /var
cp -Rax * /mnt/new
cd /
mv var var.old
#mount EBS as new /var
umount /dev/xvdj
mkdir /var
mount /dev/xvdj /var

I know prior to moving /var I’m supposed to boot the instance into runlevel 1 (single user) to prevent anything writing and reading from /var. However, this locks me out from the instance which I learned the hard way.

I tried to manually stop mysql, webserver and mail server, but after I move /var I can’t bring these services back up, they just state [FAILED] when I attempt to start. They also don’t write anything into /var/log. On a first glance permission of the directories inside /var look alright, symlinks exist too.

Any ideas?

2

Answers


  1. The best way to do that is probably offline. Detach your EBS disks from the first instance, attach to another one, mount them and make the changes, including the fstab of the root EBS. Then, detach and attach it again on the original instance and boot. I would do that way.

    Login or Signup to reply.
  2. This is a very common requirement for all corporate clients, having separate partition does help a lot in order to increase volume size at any given point of time.

    Most of the people get stuck with SSH connection problem after doing partitioning that’s when they use a more generalized approach to do partitioning.

    I have specially written a blog for this with a detail step by step procedure to perform such operation on AWS EBS.

    Steps to create separate /var partition on AWS EBS volume

    Also if you choose to do partitioning using LVM then here is one more post which has detailed step by step procedure with screenshots.

    Create root swap and LVM partition on AWS EBS volume

    Hope this helps! 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search