PDA

View Full Version : TLC #3: [Partitionning your hardrive]


X-Calibur
29th April 2003, 12:54
TLC #3: [Partitionning your hardrive]

This is one of the first steps when installing Linux. Most distro will have an automatic partitionnig utility, but you don't really want to do this because there is a much more efficient way to do this and to organize you data in an intelligent way.

Partition primer:The MBR is on track 0, sector 1: the very first location on the drive. In this tiny spot on your hard drive, two key pieces of information live. The first is the data on how many partitions you've created on the drive, and their vital statistics. The second is vital to whether your machine will boot properly or not without a floppy disk: the MBR contains a pointer to the specific partition or hard drive that has the boot information. Source (http://www.linuxplanet.com/linuxplanet/tutorials/4269/1/)

Partition basics:There are BIOS limits on the number of partitions you can have on a single drive in a PC. Perhaps one day this issue will change, when drives get so large that you might want more than sixteen partitions, but until then I wouldn't expect it to change soon. How you lay out these partitions is important, since of those sixteen partitions, only four of those can be primary, the rest have to be logical. So if you want one through four partitions then make them all primary. If you want five through sixteen partitions, then you make three of the partitions primary, the fourth a special type of container partition an extended, and then you make as many as you need (up to a total of sixteen) as logical partitions inside the extended one. Source (http://www.linuxplanet.com/linuxplanet/tutorials/4269/2/)

Linux sees all IDE drives as hd, and all SCSI drives as sd. And your physical drives are identified as a and b and so on. So your primary hardrive will be hda and your secondary drive (slave) will be hdb; same for SCSI drives that will be sda and sdb. If you have both, then it could look like this: hda and sdb. Then each partition on a physical drive is given a number in sequence: so hda2 would be the second partition on your first hard drive. Clear as mud? Also, all devices on your system have a corresponding file in the /dev directory; so hda2 will be referenced as /dev/hda2

Now to the filesystem: all Linux boxes need a root partition (/) and a swap partition. But we will create six (6) so that if your install get's fubared or you want to reinstall another distro, all your files and programs will be intact with a few tweaks and you'll be ready to go in an instant.

This is a suggested partition for a 40 Gig drive (thanks to Dnar for this), choose the EXT3 file system format when available because it is much more robust to unplanned power downs like a power interruption then the others.

/boot: 100 Meg ::: this is where your kernel (the core) will go.
/ (pronouced root): 6 Gig ::: this is where your OS (Linux distro) will go.
/home: 30 Gig (or whatever space is left) this is not quite your /My Document equivalent (almost).
swap: rule of thumb ::: should be twice your RAM size up to a 1 Gig
/tmp: 1 Gig ::: temporary files and logs, so if it get filled/jammed, it won't crash the whole system.
/var: 1 Gig ::: that's where your log files, mail, databases, webpages and other such items are kept and constantly changed.
/insertNameHere: bigger disks, extra space for mp3, movies, pr0n, etc.

This should leave you plenty of space to upgrade your kernel or your OS
You local data/config will be in /home/username. Binaries will be dispersed among /bin, /sbin, /usr/local/bin, /usr/local/sbin or /usr/local for most applications.

That should be enough to get you going.
Many thanks to Dnar who has spent a considerable amount of time explaining this to me.

[Contributors] ::: Dnar, X-Calibur
[References] ::: Linux Planet Tutorials - Partition Primer (http://www.linuxplanet.com/linuxplanet/tutorials/4269/1/)
[Last update] ::: 29-04-03