Units cylinders of 1008 512 516096 bytes

Device Boot

Start

End

Blocks

Id

System

/dev/sdal

l

1041

524632+

82

Linux swap

/dev/sda2 *

1042

7283

3145968

83

Linux

/dev/sda3

7284

11445

2097648

83

Linux

/dev/sda4

11446

15321

1953504

5

Extended

Command (m for help):

Command (m for help):

To create a partition, press n (new partition). After entering n, fdisk prompts you for the type of partition that you want to create: p (for primary) or e (for extended). As you already have three partitions, creating an extended partition will use all of your available primary partitions. However, as you are creating an extended partition, you can add more logical partitions when needed.

After entering e to create an extended partition, fdisk prompts you with a suggested value for the starting cylinder for the new partition. This is always the first available cylinder on the disk — the first cylinder that is not already allocated to an existing partition. Unless you have a specific reason not to do so, you should always accept the suggested first cylinder by simply pressing Return to accept the default value (shown in Listing 3-3 as <CR>, for carriage return).

Next, fdisk prompts you for the size or ending cylinder of the partition that you are creating. You enter +2G to show that you want to create a 2GB partition, at which point the fdisk prompt redisplays. After entering p to print the new partition map, you can see that you have created a 2GB-sized extended partition. This enables you to create logical partitions within it totaling no more than 2GB collectively.

"'■''TT'g^-^ As mentioned previously, it is safe to experiment with fdisk on your primary system " ' ■v ■ as long as you never write out the updated partition table. When you start fdisk, it creates an in-memory copy of the partition map for the specified disk and makes all of its changes there. It never updates your disk until you actually issue the w (write) command. Never issue the write command in fdisk unless you want to save your changes and update your disk's idea of its partitions. This can usually be undone, but if you have accidentally updated the partition table for your system's boot drive, and have changed any existing partition definitions, your system may well crash the next time that it tries to read from disk. If you accidentally save an updated partition table, you may be able to recover by booting from a rescue disk and manually recreating the old partition table within fdisk before you attempt to check the consistency of the drive (by using fsck). Unfortunately, this is impossible to guarantee, so be very careful when experimenting with fdisk.

Now, go ahead and create a logical partition to hold a filesystem, as shown in Listing 3-4.

Was this article helpful?

0 0

Post a comment