-->
Previous | Table of Contents | Next |
Because youve repartitioned the drive for DOS, you shouldnt have to delete any partitions for Linux. You should only have to add partitions. To add a partition, issue the n command, which displays this:
Command Action e extended p primary(1-4)
Press <p><Return>. fdisk then asks for the partition number; enter your selection and press <Return>. If you indicate a partition number already in use, fdisk reports this fact and asks you to delete the partition before trying to add it to the partition table. For this example, enter 3 to add a third primary partition thats referred to as /dev/hda3.
Next, fdisk asks for the location of the first cylinder. This is usually the first available cylinder; in fact, fdisk displays a default range for your selectionfor example:
First cylinder (42-1024) :
Notice that the first partition ends at cylinder 41 and that the next partition begins at cylinder 1024. Thus, the range supplied by fdisk here allows you to start the next partition anywhere in the range of 42-1024. Its a very good idea not to place partitions just anywhere throughout the disk; instead, choose the next available location, which in this case is cylinder 42. Enter 42 and press <Return>.
NOTE: Linux can have trouble booting from partitions defined to start at cylinders above 1024. If you can create a Linux partition only in this range, you may have to boot Linux from a floppy. You learn how to create a boot floppy (different from the boot floppy used for installation) later in this chapter. The only downside is that it takes a little longer to boot Linux from a floppy than it does from the hard drive.
Now fdisk wants you to specify how much space to allocate for this partition. You can express this size in number of cylinders or by the number of bytes (+size), kilobytes (+sizeK), or megabytes (+sizeM). Because you should already know the approximate size you need for the swap file, define this partition first, and then leave the rest of the disk space for the Linux program partitions. Thus, for this example, your machine has 8MB of RAM, so you need to specify a 16MB partition size by replying
Last cylinder or +size or +sizeM or +sizeK (42-1023): +16M
You should then use the p command to look at the new partition table youve defined. In this example, the new partition table looks like
Disk /dev/hda: 15 heads, 17 sectors, 1024 cylinders Units = cylinders of 255 * 512 bytes Device Boot Begin Start End Blocks Id System /dev/hda1 * 1 1 41 5219 1 DOS 12-bit FAT /dev/hda2 1024 1024 4040 384667+ 51 Novell? Partition 2 has different physical/logical endings: phys=(967, 14, 17) Logical=(4039, 14.17) /dev/hda3 42 42 170 16447+ 83 Linux native
By default, fdisk made the new partition a Linux Native type. To change this to a swap partition, you need to use the t command. Enter t, and then enter the partition number you want to change; in this example, enter 3. fdisk then requests that you enter the hexadecimal value of the desired partition type from Table 2.7 (if you dont have the table handy, you can type l to get the list of codes). Because you want a swap partition, enter 82 at the prompt.
As you can see, fdisk reports the new partition type, but you can also use the p command to double-check that partition 3 is now a Linux swap partition.
Now you can add your Linux partitions. For this example, add only one partition, but if you want to have multiple partitions for various reasons, you can also do so at this time. To add a partition, press <n>, specify p for another primary partition, and then specify the number for this partition (4). To keep from fragmenting different partitions across the drive, start the last partition where the other left off, at cylinder 171. For the last cylinder, because you want to use the rest of the space for the Linux system, you can specify the last cylinder instead of an exact byte count. Thus, enter 1023, as shown here:
Command (m for help):n Command action e extended p primary partition (1-4) p Partition number (1-4): 4 First cylinder (171-1024):171 Last cylinder or +size or +sizeM or +sizeK (171-1023):1023
Now use the p command to verify the new partitions. If you need to make any changes, do so now.
When youre satisfied with the layout of your partitions, you can use the w command to write the partition table information to the hard disk. None of your changes are permanent until you use the w command; thus, if you feel youve made some changes in error, you can use the q command to exit without altering the partition table. If you use the w command, Linux tells you the partition table has been altered and then resynchronizes the disks to match the new partition table. If your Linux system hangs at this point, reboot with the installation boot and root disks until youre back at the # prompt.
CAUTION:
Dont use the Linux fdisk program to create or modify partitions for other operating systems. This could leave the hard drive in a useless state for both operating systems.
Previous | Table of Contents | Next |