DiskDrake: Managing your Hard Drive Partitions

Abstract

Please refer to the Reference Guide to learn what partitions are used for. Partitions are initially set up during the installation process. DiskDrake allows you, to some extent, to resize your partitions, move them, etc. DiskDrake can also deal with RAID devices and supports LVM but these are advanced uses we won't talk about here.

Warning

DiskDrake is very powerful and can therefore be a dangerous tool. Misuse of it can very easily lead to data loss on your hard drive. Because of this potential loss of data, you are strongly advised to take some protective measures before using DiskDrake:

  1. Back up your data. Transfer it to another computer, ZIP disks, etc.

  2. Save your current partition table (the table describing the partitions held on your hard drive(s)) to a floppy disk (see the section called “DiskDrake's action buttons”).

The Interface

Figure 17.1. DiskDrake's Main Window

DiskDrake's Main Window

DiskDrake enables you to configure each physical hard drive on the machine. If you only have one IDE disk, you will see a single tab called hda below the file-system types. If there is more than one drive, then each will have its own tab and will be named according to the Linux name for that drive. DiskDrake will allow you to manage the partitioning of each drive.

The window (Figure 17.1) is divided into four zones:

  • Top. The structure of your hard drive. When you launch DiskDrake it will display the current structure of the drive. DiskDrake will update the display as you make changes.

  • Left. A menu relevant to the partition currently selected in the above diagram.

  • Right. A description of the selected partition.

  • Bottom. Buttons for making general actions. See next section.

We will now review the actions available through the buttons at the bottom at the window, and then see a practical use case.

DiskDrake's action buttons

Clear all

Clicking on this button will clear all partitions on the current hard drive.

More

Display a three button dialog allowing you to:

Save partition table

Allows you to save the current partition table to a file on a disk (a floppy, for example). That can prove useful in case a problem arises (like an error made during drive repartitioning).

Restore partition table

Allows you to restore the partition table as previously saved with Save partition table. Restoring a partition table may recover your data as long as you do not reformat partitions, because the formatting process will overwrite all your data.

Rescue partition table

If you lose your partition table and have no backup, this function tries to scan your hard drive to reconstruct the partition table.

Help

Display this documentation in a browser's window.

Undo

Cancels last action. Most modifications done on your partitions are not made permanent until DiskDrake warns you it will write the partition table. This button therefore allows you to undo all of your modifications on partitions up to last write.

Toggle to expert mode

This button allows you to access the expert mode functions (which are even more dangerous if you are not sure what you are doing). Reserved for experts.

Done

Saves your changes and exits DiskDrake.

From Theory to Practice: Resizing an Old Partition And Creating a New One

Abstract

In this section, we are going to do a little exercise to demonstrate one of the more useful features of DiskDrake. Let's imagine that you decide to use your machine as an FTP server and you want to create a separate /var/ftp partition in order to host the FTP files. Note that doing this step by step tutorial will actually modify the structure of your hard drive.

This is what the current /home partition looks like (Figure 17.2), before any modification. We are going to shrink this partition in order to create free space for the new file system.

Warning

In order to perform the steps in this example, you must login directly as root, not as your user account.

First of all, you need to unmount the /home partition by clicking on it and then pressing the unmount button.

Figure 17.2. The /home Partition Before Resizing

The /home Partition Before Resizing

The next step, as you may have guessed, is to click on the Resize button. A dialog will appear (Figure 17.3) which will allow you to choose the new size for the /home partition. Move the slider, then click on OK.

Figure 17.3. Choosing a New Size

Choosing a New Size

When this is done, you will notice that the graphic representation of your hard drive has changed. The /home partition is smaller, and an empty space appears on the right. Click on the empty space and then on the Create button that appears. A dialog (Figure 17.4) will appear to let you choose the parameters for the new partition. Change the start sector if you wish to leave a gap between the /home and /var/ftp partitions. Set the size, choose the file-system you want (usually Journalized FS: ext3) and then enter the mount point for the partition, which in our example will be /var/ftp.

Figure 17.4. Defining The New Partition

Defining The New Partition

This is what our projected partition table now looks like (Figure 17.5).

Figure 17.5. The New Partition Table

The New Partition Table

The last step is to format (prepare to host files) the newly created partition. To format the partition, click on its representation in the partitions picture, then on the Format button. Confirm the writing of the partition table to disk and the formatting of the partition. You may be asked to reboot the computer to make changes effective.

Figure 17.6. Confirming The Writing of The Partition Table

Confirming The Writing of The Partition Table