Muckin' with a HDD

There are many times that you will want to get personal with your hard disk drives. In linux there are great tools for manipulating partitions, tuning performance, and saving partition information in case of problems.

Not sure what partitioning your HDD means? Check out this great partitioning primer that describes how HDDs are built and how partitions are stored on the HDD.

Tools

First a word of warning:

Using these tools incorrectly can be hazardous to your data's health. Backup early and read the documentation for these tools before you use them.

fdisk

The fdisk utility is used for partitioning a drive. I find this utility the easiest to use and prefer it for creating partitions. Fdisk is usually included in a Linux distribution.

There are advanced features of fdisk accessable from the 'x' menu item. One handy feature is 'f' to fix partition order. If you end up moving and resising partitions you can end up with the logical parition order not matching the physical partition order. This command will fix it up for you.

parted

Parted is the Swiss Army knife of partition tools. It can create, resize, copy, and check partitions. I feel that its greatest strength is the ability to resize and copy partitions.

hdparm

Want to make sure that your HDDs are pumping data the fastest they can? Then Hdparm is the tool you need. Setting the parameters of operation for you HDDs can make a significant difference in the performance of you HDDs.

However, I have found that if you set the wrong parameter or set a parameter incorrectly for your HDD, you can fubar the filesystem. Therefore, make sure you read the documentation for hdparm and find out as much information about your HDDs and information about your chipset's HDD interface. You did read the earlier warning right?

SMART Monitoring Tools

Current PATA/SATA hard disk drives support Self-Monitoring, Analysis, and Reporting Technology (SMART). If you want to monitor the health of a PATA/SATA hard disk drive then take a look at smartmontools.

For an idea of what smartmontools can show you about your drive, take a look at anatomy of a drive failure.

HDD Temp

hddtemp runs as a daemon on the system and can periodically report the temperature of the specified drive(s).

Take a look at a sample configuration for how to get regular reports of each HDD's temperature.

Parted Magic

PartedMagic is a bootable image (CD or USB) that has many graphical tools for managing partitions. I have used Parted Magic successfully to move and resize partitions. A nice feature of the included GParted is that when resizing a partition, it also resizes the file system in that partition.

Ultimate Boot CD

UBCD is a bootable floppy/ISO image that contains an metric butt-load of utilities for PC and HDD maintenance (including the entire Parted Magic distro -- though not necessarily the most recent release). Highly recommended to have handy.

Partition Image

Partition Image is your best defence against hosing your data using the tools I have described above. This tool allows you to make a logical image of a partition and later if you need to, restore that image. Note that I said logical image, meaning that only data is included in the partition image not empty space. Believe me, this makes a huge difference in image file sizes when you are imaging a mostly empty drive.

If you have ever installed a version of Windows, you know how long it can take to get all the drivers installed. Why Windows needs to reboot at the slightest configuration change I will never know. You can use Partition Image to make an image of a Windows partition just after installation so that you only need to restore the image to get Windows back to a sane state.

FSArchiver

FSArchiver is another tool for saving all the data from a file system. The advantage that FSArchiver has over Partition Image is that you can restore your data to a file system that has a different size than the one you created the image from (assuming you are not restoring to a drive that is too small for all your data).

Others

There are other tools that you may want to look at if you did not find the ones I use to your liking.