Partitioning a Linode Slice
I'm about to install everything on my 360 plan (I have at least a fairly good idea of how to go about doing that) but I want to know how / when I typically would go about partitioning my linode slice for a reasonably good layout given that I want to keep my data should I want to replace / re-install my distro partition.
So, let's take an example (inspired by Jed on this forum) of the partition map that I'm aiming for:
root partition of 2gb
/var/log partition of 1gb
/srv partition of the rest (something like 9gb)
my plan is thus to point mysql data folder to somewhere on srv as well as host all my sites there in public_html/site1.com and so on i.e. keep my data in one place, keep the OS stuff in another and the logs somewhere else.
Questions
1) is this advicable, other better suggestions?
2) is this something I do in the linode manager i.e. set the disk images in there, and then mount them from within my SSH client once installed a distro?
3) If I use Ubuntu 8.04 (Hardy), how do I mount the disk images where I want them i.e. in /var/log and /srv
Any help or pointers or even referring url's on the matter is of great help. Many thanks.
Thanks.
3 Replies
Set everything up in the Linode Manager
Deploy a distribution
Create the new disk images for all the extra partitions you want in the Linode Manager (LM). These are mine (rather simplistic):
- home (ext3) 3072 MB
- tmp (ext3) 256 MB
- var (ext3) 2048 MB
- usr (ext3) 1024 MB
I create a FINNIX Configuration Profile so I can mess with all of my images at one time even if things get messed up.
Click "Create New Config. Profile" and select "Recovery…Finnix" for the kernel
Make /dev/xvda "Recovery Finnix"
Assign each image to some dev path, like /dev/xvda, etc.; do this for all partitions. Mine are:
- /dev/xvda Recovery - Finnix (iso)
- /dev/xvdb home
- /dev/xvdc tmp
- /dev/xvdd var
- /dev/xvde usr
- /dev/xvdf
For Uncompressed initrd image, select Finnix
Add the partitions to your OS deployment (replace as you see fit, just make sure you know where everything is at), by clicking your profile from the LM Dashboard. Use the drop downs.
- /dev/xvda <your os="" image="">- /dev/xvdb home
- /dev/xvdc usr
- /dev/xvdd var
- /dev/xvde tmp
- /dev/xvdf swap</your>
- Boot your Finnix profile
Then you'll need to move everything from the default deployment of your OS (everything in / partition) onto your partition images.
Boot your FINNIX profile and connect with LISH from the LM
First you've got to mount the partitions. These are mine (replace with what you setup above):
mkdir /mnt/{home,var,usr,root}
mount /dev/xvdd /mnt/var
mount /dev/xvde /mnt/usr
mount /dev/xvdf /mnt/root
- You now have to copy everything from the OS into the partitions. Do this for all of the default OS directories (that aren't empty in a default deployment) that you want on its own partition. Mine:
cp -a /mnt/root/var/* /mnt/var/
cp -a /mnt/root/usr/* /mnt/usr/
You now have everything on your new images for the partitions you created in the LM
You now have to edit your fstab file to tell your Linode it needs to mount these images where you want when it starts up. For my setup (I'm using Debian, might be somewhere else depending on your OS and where you mounted your OS deployment that had everything on it…note: I keep calling that root since you cant just use a /):
pico /mnt/root/etc/fstab
- Create a line for each partition, making sure the /dev/xvd? corresponds to those you setup in the LM for your OS configuration profile (not the FINNIX profile) and the desired mount point
proc /proc proc defaults 0 0
/dev/xvda / ext3 defaults,nosuid 0 1
/dev/xvdb /home ext3 defaults,nodev,nosuid,nouser,usrquota,grpquota 0 1
/dev/xvdc /usr ext3 defaults,nodev 0 1
/dev/xvdd /var ext3 defaults,nodev,usrquota,grpquota 0 1
/dev/xvde /tmp ext3 defaults,noexec,nodev,nosuid 0 0
/dev/xvdf none swap sw 0 0
Boot your OS config profile now to make sure everything works before putting any data on it or making any OS changes
If it boots right up without a bunch of warnings popping up in the LISH console…you're probably good, but you may want to cd into the mount points of the partitions just to make sure everything got moved correctly
Setup Linode; install packages, setup sites, have fun, be smart…etc.
Let me know if you have any questions. This is basically what I do and has served me well; it maybe more detailed than you needed, but just wanted it there in case you did.
For things different than mine like options in fstab etc., just search Google and let us know what you find and we'll help you the rest of the way. Good luck…
Partition setup:
/dev/xvda - 2GB - System
/dev/xvdb - 256MB - Swap
/dev/xvdc - 13.75GB - Content
My system drive is actually much larger than it needs to be and I'll probably resize it next time I need to reboot. Anyway, what I have is the content partition mounted as /content/, then folders inside content such as /content/home/, /content/www/, and /content/log/. These are bind mounts to /home/, /var/www/, and /var/log/. If you're not familiar with bind mounts is similar to a symlink as far as the end user knows, but is actually just mounting a folder (or file if I recall) as a different folder. /home/ actually does not reside on /dev/xvda/ anymore but is now pointing to /content/home/ on /dev/xvdc/.
It seems like a better idea to just use a single large partition for all the data/configuration files instead of splitting it up into 3-4 differen partitions. It takes a little bit more work to set up, but I think will prevent potential space problems in the future.
Thanks,
Smark
I did some internet searches and came across a setup similar to the latter one described and went with that.
I very much appreciate you both taking the time to answer, it is always nice to see the setup of others.
This is my first linode and so I'm hosting only smaller sites with not that much traffic. What I did was like so:
Partition setup:
/dev/xvda - 2GB - System
/dev/xvdb - 512MB - Swap
/dev/xvdc - 11.5GB - /home
/dev/xvdd - 2GB - /var
Now that I saw what Smark did I think I'll try that on next time when / if I decide to move some of my larger sites here.
I'm terribly new at all of this still so I'm right now just trying to cope with it all. I'm an avid programmer but I'm just a plain newbie at setting up an environment.
Thanks again.