spacer.png, 0 kB
Home arrow Articles
Creative Commons License
Categories
Recent Articles
Latest Comments
Archives
FREE Newsletter!

Want to hear more about the Black Art of Linux and Mac? Subscribe to our FREE Newsletter to make sure you don't miss a beat!







Awesome Reading

Anaedor Book

Click here to read the first two chapters!
Get Ubuntu Linux!

Get Ubuntu
Get Firefox!

Get Firefox
We are green!

Green Web Hosting! This site hosted by DreamHost.
spacer.png, 0 kB
spacer.png, 0 kB

Linux Partition Quickie

linux Ooh-la-la!  That title sure does sound fun, but can this article live up to it?  I rather doubt it.

Okay, so you have just decided to put Linux on your computer system.  Let me be the first to say that you are a wise, cutting edge sort of individual.  However, before your new Linux OS, and therefore you, can be admired and desired by many, you first have to know how to partition the drive.  I bet if you really use your imagination, you can make that seem sexy.

There are many schools of thought on this subject.  Having tried many different configurations myself, I feel I’ve finally discovered a setup that is easy to implement and maintain.  In my short and adventurous life I’ve had three drive failures (let’s get this clear that none of them were my fault) and each time I’ve been able to successfully recover all of my personal data using this partitioning setup.  I offer no guarantees that my method will work for you, but I’ve had good luck with it, as has my Grandma Bebe.  I am sure that there are many other people out there who have creative and exciting ways to partition their drives for Linux, but since this is my article we will go with my solution (which is the right one, and if you’re smart you will see that).

Before beginning, though, why exactly would you want to partition a drive?  Well, if you don’t partition your drive it will end up being one giant data dump.  Giant data dumps hurt, trust me.  It’s better to split things up.  Again, just trust me on this.  Dividing your drive into multiple partitions simpilifies your backup process and increases the performance of your machine.  Another reason to partition your drive is to restrict growth of certain file systems.  For example, if your mail spool was in the same partition as your root file system, and it filled the remaining space in your file system, your system would hang.  That particular problem would probably not be an emergency issue for a desktop machine, but it could be for a server.

This was supposed to be a quickie, so let’s get to it.  For this article I am making the important assumption that you have a single drive with no other operating systems on it.  Also, I’m going to assume that you only want to install Linux on this drive.  If you have other operating systems and don’t want to lose your precious data, make sure you are not overwriting those previously existing partitions.  If you don’t understand what I just said, please find someone who does.  I don’t want you going all freaky on me when you permanently lose your "Sea Monkeys Gone Wild" photo collection.

Once you put your Linux Install CD into your machine and reboot, the install process should begin.  After some disk spinning and a few strange noises, the installer will ask you about partitioning your disk.  You should be presented with an option that says "Manual".  That’s the one you want to pick.  This is not a job for a machine, let me tell you.

The very first partition will be the swap partition.  Conventional wisdom says that this partition should be twice the size of your physical RAM.  I don’t know about you folks, but this sounds good to me.  For my old machine, which has 512 MB of RAM, I will create a swap partition of 1GB (512 x 2 = 1 GB).  Keep in mind that servers should have more swap space than desktop machines.  If you are interested in extracting as much speed as possible, it is best to put swap on the outer tracks of your drive.  That’s why I’m telling you to put it on the first partition.  Some people may say swap is not needed, however, I have always found the machine performs best when there is a swap partition.  The people who say this stuff just don’t get how fun swapping can be.  They should try it.  They might like it.

The second partition will be the root partition, and marked as "bootable".  On modern Linux installs, I usually make this at least 5 GB in size.  This amount has always provided plenty of room for me, but if you feel you want more and have the room to do it, go ahead and allocate more.  It’s really a personal choice, and the beauty of doing it "Manual".  Just make sure the mount point is / (a.k.a. root) and marked as bootable.  If down the road you would like to update your distribution or change to a completely different distribution, this is the only partition you will have to touch.  I think that is pretty cool.

The third partition is the /usr partition.  This partition will be where most of the executable binaries will live on your machine.  The kernel source tree will also be found here along with much of the documentation (this is also where you will find your system’s man pages, if you’re interested in that sort of thing).  Any additional software that you install on the system will be placed in this partition, as well.  Make sure the mount point is listed as /usr and is not marked as bootable.  I usually make this close to twice the size of the second partition.

The fourth and final partition is the /home partition.  This is where the user’s home directories go.  This is the partition you would want to back up on a regular basis as it contains your precious data (Sea Monkey pictures) and programs (Sea Monkey Slideshow App).  Make this partition size take up the remainder of the room left on your drive.  Again, make sure the mount point is listed as /home and not marked as bootable.

Here is a summary of what my test 32 GB drive looks like after I partitioned it:

Partition Type Size Bootable Mount Point
 #1  primary  1.0 GB  No  swap
 #2  primary  5.0 GB  Yes  /
 #3  primary  10.0 GB  No  /usr
 #4  primary  16.0 GB  No  /home

After the OS is installed into partition #2, you can issue a "fdisk -l" command to see your four partitions and a "df -hl" to see their respective sizes.  If you are creating a server, I would have had you add three more partitions, one for /boot, one for /var and one for /tmp.   However, for a reliable and awesome desktop setup, this has served me well.  So go ahead and install that latest linux distribution with the confidence that you know exactly how that drive should be partitioned.

Well, I never was good at quickies.  But I hope this was a satisfying experience all the same.

2 Responses to “Linux Partition Quickie”

  1. Drew responded on Friday, April 11, 2008 at 2:00 pm:

    Gorkee,

    I really enjoy your articles. You have a great sense of humor (sharp and dry like mine, so it’s more like amazing). And you are able to translate ‘geek’ for mere users - a rare talent still.

    I also read your “Linux Filesystem Explained”. Between that and your comment above about how “/” is the only partition you’d have to touch if slapping on a new distro, I find myself still hungry/thirsty/unsatisfied . You just kind of whet my appetite with a great writing style and only the first layer of the information onion.

    Please…let me elaborate. As a side job I set up home users with new/working system. Listening to my conscience I find myself needing to make sure that it’s a free OS (linux) that they get.

    But along with that I only feel right if I can explain the basics, indoctrinate them if you will. And I can best do that only if I REALLY understand it myself.

    I do realize one article from a guru like yourself (or at least more seasoned padawan) isn’t going to be enough, but I’m still hoping you may be able to fill in a few gaps for me.

    I’ll be more specific: Can you write an article about installing programs in linux - from two angles.

    1. HOW?: What is the standard procedure (or main 2-3 ways) to install an application you find and like? When the installer asks you where to store certain parts, what does one want to tell it?

    2. WHY?: In an OTHER OS, an app typically throws files around like debris from a chandelier falling. I suspect linux has more rhyme and reason to it. What is it? How does it decide where to put things?

    3. Sorry, just one more for now: Uninstalls can be a nightmare on other platforms. Is it simple file removal in linux? Or is there more magic to it that everyone should know?

    Thanks for listening and for the great material you’re putting out. Very helpful - and fun!.

    drew

  2. Gorkee responded on Friday, April 11, 2008 at 9:37 pm:

    Drew,

    First of all, thank you for your kind words. I have a passion for Linux and I enjoy writing about it. As far as your questions go, they are all very excellent questions. I believe you just gave me another idea for a future article. But, if you want me to answer your questions sooner, just pop me an email in the “Contact Us” page and I will be more than happy to answer them all.

    Thanks again!

Add your own comment...

spacer.png, 0 kB
spacer.png, 0 kB
Copyright © 2008 Gorkee, LLC - General Policies | Privacy Policy | Disclaimer | Site Map spacer.png, 0 kB