Linux fdisk

You may want to delete a partition if your plan is to turn a logical (or physical) DOS drive over to Linux. After the partition is deleted, you can add new Linux partitions.

Linux fdisk is a powerful program that can be used to destructively repartition as well as to create new Linux partitions.

Figure 2.6. You can use Disk Druid or Linux fdisk as a partitioning tool.


To delete a partition using Linux fdisk:

1.
Start the Linux installation program using a boot floppy and the CD from the back of this book, as described in Chapter 1.

2.
When you are prompted, select the Install option rather than the Upgrade option.

3.
When you are prompted, select Custom installation rather than Workstation or Server.

For more information on these options, see "Workstation, Server, and Custom Installations" later in this chapter.

4.
When you are prompted to select a disk partitioning tool (Figure 2.6), select fdisk.

A command prompt and a list of possible actions will appear (Figure 2.7).

Figure 2.7. The fdisk program presents a prompt with a list of possible command actions.


5.
Enter p to list current partitions and devices (Figure 2.8).

Figure 2.8. Use the p option to verify changes before writing them to disk


6.
Make a note of the number of the partition you want to delete, counting from the top.

Most likely, the device name for the first partition is hda1 (if it is an IDE drive) or sda1 (if it is a SCSI drive). (See the sidebar "Linux device names and partitions" for more information.)

7.
Enter d to delete a partition.

8.
Enter the number of the partition you want to delete.

9.
Enter p to display the new partition table to verify your change.

10.
Enter w to save the changes and exit Linux fdisk.

11.
If you are prompted to reboot your system, do so.

Tip

Entering m displays the list of fdisk command actions.


Tip

You may need to use both Linux fdisk and Disk Druid (explained later in this chapter) to get your partitioning right. If so, you can use the Back option to navigate between the two utilities.


To add a Linux partition using fdisk:

1.
Start Linux fdisk as described in the preceding section.

2.
Type p to view the partition table, and make a note of the last cylinder of the partition preceding the one you want to create

3.
Type n for new partition.

4.
Type p for primary partition.

You could also enter e for extended partition; see the sidebar "Linux device names and partitions" for more information.

5.
Enter the partition number you want to create. For your first Linux partition, this will probably be 2.

6.
Enter the number of the first cylinder of the partition.

Normally, you'll want to accept the default. If you are creating partition number 2, the default offered will be one cylinder greater than the ending cylinder for partition 1.

7.
Enter the size, or ending cylinder, of the partition.

The partition size can be specified in bytes, kilobytes, or megabytes—or you can name the ending cylinder.

8.
Enter p to display the partition table.

9.
You can add more partitions, or modify existing ones. To modify a partition, enter t. To change the boot partition, enter a.

10.
When you have completed your changes, enter w to save them and exit fdisk.

11.
If you are prompted to reboot your system, do so.

Linux device names and partitions

Linux, like other flavors of Unix, references everything as a file. This means that the name for a hard drive is the file identifier of its driver. For example, /dev/hda is the name of the first IDE drive on a system, and /dev/sdc is the name of the third SCSI drive on a system. You can easily crack this code: hd stands for hard drive and sd is short for SCSI drive.

Unlike drives, partitions are denoted with numbers rather than letters. For example, /dev/sda2 is the second primary partition located on the first SCSI drive.

Linux is limited to four primary partitions: numbers 1 through 4. In addition, one primary partition can be an extended partition, which itself contains logical partitions. Logical partitions are designated by numbers that are 5 or greater.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.120.136