Custom Partitioning
Often, a user will require custom partitioning for his VPS. This means that he will say something like "I want 20GB reserved for /var and the rest for /". We can sort this out for any user.
When a DTC reinstall occurs, the partitioning will be reset to its default state with all space for the root partition, and some for swap. We thus need the user to get his VPS set up in its most basic sense first, i.e. for him to install the OS and confirm that it is set up as expected.
Once that is done, we need to do the following:
- Log into the physical node that the VPS is set up upon.
- Ensure the VPS is shut down.
- Reduce the size of the root filesystem. This can be done by:
- Reducing the filesystem by typing resize2fs /dev/lvm1/xenXX YY where XX is the VPS ID and YY is the size that the filesystem needs to be shrunk to (e.g. 20G). If you are prompted to run a fsck, please do so.
- Reducing the logical volume (essentially the actual size of the disk) to the same size by typing lvresize -L YY /dev/lvm1/xenXX where XX and YY are as above.
- Creating and initialising new logical volumes for the user as per his requirements. Obviously, make sure that the requirements are sensible and fall within the user's allocated amounts as per the package he has ordered. To create new partitions, do the following:
- Create the logical volume by typing lvcreate -L YY -n /dev/lvm1/xenXXZZ lvm1 where ZZ is a suitable identifier (e.g. var for what would live as the /var partition, so this could be xen10var) and YY is the size, e.g. 20G.
- Create the filesystem on there by typing mkfs.ext3 /dev/lvm1/xenXXZZ where XX and ZZ are as before. If the user wants another filesystem, change the mkfs.ext3 command to something more suitable.
- Change the user's Xen configuration at /etc/xen/xenXX to add new disks (in the disk directive). With the previous example, something like adding ,'phy:/dev/mapper/lvm-xenXXvar,xvdc,w' would do
- Starting the user's VPS by typing xm create -c xenXX and making sure it starts up.
Let the user know that he has new /dev/xvdZ partitions, and that he is required to set these up in /etc/fstab to point to the relevant places. Also let them know that any reinstalls will require us to reconfigure his partitions.