How I do my partitioning in Slackware

One Linux topic on which everybody seems to have an opinion is partitioning. “What’s the best way to partition my system?” newbies ask, and if they do so in a public Linux forum frequented by experienced penguin techies, they are bound to get at least a dozen answers, many of them completely different from each other.

So what is the best way? Simple. Whichever way you find works best for you.

When I first started out with Linux, I didn’t know either, and I did a lot of reading on the subject, and as a result I created a partitioning scheme that works best for me, and that’s still more or less what I stick with.

With my recent Ubuntu installation I didn’t do any manual partitioning, mostly because for one, I wasn’t planning on dual-booting that laptop with anything else, and for another, I wanted to accept the defaults so that I could see what Ubuntu does on its own.

However, when I’m setting up a Slackware machine, I have a method that I follow.

One word of caution. If you’re setting up your partitions presumably to hold a Linux installation, write down what you’re designating what (i.e., “hda1 = Windows”, “hda5 = swap”, “hda7 = root”, et al) so that you have it to refer to when you’re installing later. Nothing quite like coming to the point in the install where it asks you “where do you want to mount your home directory?” and you don’t remember which partition you created with /home in mind.

Been there, done that.

I use cfdisk

Slackware’s default partitioning tool is called cfdisk. If you’re in possession of a Slackware installation CD, and you boot from it, cfdisk is accessible simply by typing “cfdisk” and hitting enter.

This isn’t a graphical partitioning tool, so if you’re interested in that, you may wish to stick to another tool with which you are more familiar. But bear with me… cfdisk is pretty easy to use, so don’t be daunted by its interface. It’s menu-driven, and you can do most of what you need with the arrow keys on your keyboard.

I’m not going to go into the gory details of how to do every minute thing with cfdisk; if you’re reading this, and you’re interested in partitioning schemes, I’m going to go out on a limb and say that I’m safe in assuming that you can probably figure out the basics… it’s not a difficult program to master.

But here’s the way I have a typical dual-boot arrangement set up.

Windows likes to be on the first partition, so (as in my screenshot example), I typically create that partition first. The size of the partition depends largely upon what your needs are… I don’t use the Windows 2000 installation on my desktop machine very much, so I only have around 9.5GB allocated to the partition on which Windows lives. Also, at the time I set up this machine, I had only a single 120GB hard drive in it (it’s an older computer) and space was a bit tight for me.

So I created a 9.5GB partition at the beginning of the drive, selected the filesystem type to be “NTFS” and moved on to the next partition, which, as you can see from the screenshot, is designated “Linux swap”.

The swap arguments

This one gets people up in a tizzy, and I’m really not sure why. As a general rule of thumb, you want your swap partition as close to the beginning of the drive as possible, reason being that it’s going to be faster for read/writes. Face it, if you’re going to be swapping, you want it to be quick, right?

So, as you can see from my screenshot, I followed that rule and created my swap partition right after the Windows partition. The only reason I didn’t create the swap first was because (as I mentioned above), Windows thinks it has to be first, so it has to cut in line in front of everything, even your Linux swap partition.

Well, that’s not the contentious part. The part everyone seems to squawk about is the size of the swap partition.

The rule of thumb for swap partition size is, for desktop systems, you should be allocating twice the space as your system has physical RAM. So if you have 2GB of RAM in your box, make your swap partition 4GB so that you aren’t in danger of crashing if you have a huge pile of memory-intensive apps running.

I don’t do that, as you can tell from my screenshot. I’ve been running Slackware as my main desktop for years, and even though I have only 1GB of RAM in my main desktop right now, I can honestly say that I don’t know what I’d have to be doing in order to crash this box for lack of swap space.

I don’t normally see this machine use ANY swap. Maybe Slackware’s more efficient at handling memory… I really don’t know. But the normal amount of swap space usage is 0Mb, and if I have a TON of stuff running and open and doing lots of things, it might use 15 or 20 Mb, that’s about it. By the rule of thumb, since I have 1GB of physical memory in this computer, I should have made my swap partition 2GB at a minimum, but I see that as just a waste of hard drive space.

One thing I might point out here. If, by whatever means, I happen to be swapping THAT MUCH out of physical memory into disk paging, this box would be running so slowly as to be nigh unusable.

So, your mileage may vary, folks. Follow the rule of thumb if you want to be safe; I’ve never allocated more than 512Mb of space to a Linux swap partition on a desktop or laptop machine, and I’ve never, ever had problems running that way. So the choice is yours.

To read in much more detail on the subject, there’s a great article on Linux.com that discusses what swap is, how it works, and how you should do it, linked here for your convenience: All about Linux swap space.

About these ads

5 thoughts on “How I do my partitioning in Slackware

  1. Pingback: Partitioning: A Different Perspective with Encryption and RAIDs « The Linux Critic
  2. Informative post. I’ve never dual booted Slackware with anything else, however I did have to manually partition for my last installation. I used both cfdisk and fdisk to do it-I created the partitions with cfdisk, then I went back and designated my swap partition as swap with fdisk.
    I’m not sure if I did it right though, because I only flagged my root partioion as bootable thinking it would make no difference if my swap was flagged as bootable. Do you know if I made a mistake there? If so can I just change it to bootable using the installation disk without having to run setup and fully start over, or is there another way?

  3. Never mind. I ran cfdisk from the terminal and it turns out I had it right the first time since the Master Boot Record cant boot two partitions flagged bootable at the same time anyways. Ack. I feel really dumb now.

    • Nah, no reason to feel dumb. How else are you going to figure that out?

      I have several times (not just once) tried marking more than one partition bootable in a single-boot system (durr). Cfdisk just won’t let you do it. :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s