Linux Blog

I ordered a PC a while back and thought I’d write about it. I’ve been running pretty much the same desktop hardware for the past 5 years. Eventually things got so slow on the desktop that I started using my Core 2 Duo Lenovo T61 laptop as my desktop. This worked for a while, and I really like the laptop I just didn’t feel like I was using it for what it was intended for, mobility. I really didn’t want to build if I could avoid it so I started getting specs and prices for computers from the local big box stores and wasn’t really thrilled with anything. I started looking at new PC’s on Amazon, Newegg and TigerDirect. Nothing really jumping out as value / performance there either. At that point was when I decided I’d do what I normally do, break down, buy parts and build. So, my budget was as little as possible, but still wanting decent performance. This is what I came up with: (Read on …)

I’m excited because this weekend I’m getting another laptop. I’ve gone through quite a few laptops some of which have been more Linux friendly than others. I have been happy with my last two Toshiba laptops (Portege 4010 and Tecra M2) but this time I am buying a used Lenovo Thinkpad.

I was very happy with my last upgrade, from a 933MHz with 512MB of ram, to a 1.7GHz with 768MB ram that was recently upgraded to 1GB. The performance increase was phenomenal. Now moving from a 1.7GHz to am Intel Core 2 Duo should provide another greatly needed performance increase.

One question people often ask me is
“What is the best way to partition a hard drive?”
With graphical installations becoming more popular often hard drive partitioning is overlooked.

If you already have a working installation you can check how your system is currently partitioned by running the command:

bash-3.1# fdisk-l/dev/hdX (depending on your drive)

If you are happy with the performance of your system then reinstalling is not really needed. If you would like to possibly gain a performance increase then you may want to consider reinstalling with a better partitioning method.

Repartitioning your drive
The first thing that I recommend doing when deciding how to partition the hard drive is to figure out what the system is for. Is the system going to be a Linux workstation, desktop, server or application. Knowing this information is not necessary as sometimes computer often have multiple roles but it is good start into setting up your hard drive properly.
There are many ways that a hard drive can be partitioned. Depending on the role of the computer I have different partitioning methods.

Firstly, my hda1 is swap. I always make my swap disk the first primary partition on the hard drive. This is because its the fasted to access. If your currently running an install, check to make sure your swap is hda1.

My hda2 is not used, this is just a preference that I have, to my knowledge there is nothing wrong with using hda2 as root. I just like to use /dev/hda3 as my root. My root file system for this particular machine is about 95% of the total drive. The other 5% is used for my swap partition and my /boot/ partition. I used /dev/hda5 for my boot partition as this is not so important as it only gets accessed at boot time and when copying kernels to the partition. You don’t have to have a separate boot partition, but I like to just in case I want to export it as an NFS share.

Once your happy with your disk partitioning scheme, the next thing that needs to be done in the partitioning manager is to choose a file system. The file system type for Linux Swap partition is 82 and 83 for the Linux type.

Choosing a filesystem and formatting it.
Most installations will take care of the formatting and adding swap, you just have to choose what type of file system you want to use. I would advise to use the ext3 or Reiser file systems for your root and boot partition. Ext2 is depreciated and has been replaced with ext3. If ext2 is still in your distributions setup it is for legacy reasons and should not be used. I like to use ext3 because its more mature, but I have no problem with using Reiser. Choose one and install your distro as usual.

Basic Tuning
Once your install has finished and is booted it is good to check to make sure your disk is being used correctly.
I like to double check this because I want to make sure that I am getting the most out of my system. Some times certain distributions don’t set up the drive correctly for stability issues (I’m not pointing any fingers here).

To do this I use the hdparm tool. Quote [man pages]:

DESCRIPTION
hdparm provides a command line interface to various hard disk ioctls
supported by the Linux SATA/PATA/SAS "libata" subsystem and the older
IDE driver subsystem. Some options may work correctly only with the
latest kernels.

The first thing to do is run hdparm /dev/hdX (depending on your drive)
I have changed some options for the purpose of this tutorial but here is my current setup:

Turning DMA on.
Notice, that IO_support and using_dma are set to off.
For performance reasons this should change.
As I know my controller supports DMA I should turn this on. If your unsure if your controller supports DMA you should refer to your motherboard specifications or try it at your own risk.

If you just try it without knowing if DMA is supported, it will either error or may become unstable. Whenever installing a new system, if DMA or 32-bit transfers are turned off, I like to keep the system running for a while and copy large files around to make sure there are no stability issues.

Turning 32-bit transfers on
Now that DMA has been turned on successfully and the system is still stable, I will turn 32-bit transfers on. The same applise for 32-bit transfers as to DMA. The command is the same as before but with the -c1 switch.

Now the basic hard drive tuning has been set up I will run stability tests for a while and make sure the settings work as desired. If the system is not stable, you can try using 32-bit transfers or DMA independently and try to find out which one is guilty or if they both work separately. Which one to use should probably be measured with a bench mark test. This can be done with a benchmarking script, or just by copying a file and measuring the time it takes with both.

Final Notes
Check out your hard drive settings and partitioning scheme and make sure you are happy with the way its set up. If you have the time and want to tweak your system these basic steps should help you with your quest of having lean mean Linux machine.