📄 readme.fdisk
字号:
Device Boot Begin Start End Blocks Id System /dev/hda1 * 1 17 20059 10021+ 1 DOS 12-bit FAT /dev/hda2 71060 71060 83044 5992+ 5 Extended /dev/hda3 * 20060 20060 71059 25500 83 Linux native /dev/hda5 71061 71061 79559 4249+ 82 Linux swap /dev/hda6 79985 80001 83044 1522 1 DOS 12-bit FATThe start of data in both DOS partitions is 16 sectors after thebeginning of the partition: this is one reason why you should use DOS'sown `FDISK' to create DOS partitions. Changing the units to sectorsalso affects the way in which the new partition command asks for thebeginning and end of a new partition.*Warning*: it is dangerous to create a new partition when thedisplay/entry units are sectors.The Verify command is useful because 1. It warns you if anything is wrong. *Always* do a Verify command to check your work before writing any changes to disk. 2. It reports how many unallocated sectors there are on the disk.The Quit command is also useful. `fdisk' does not actually changeany data on your disk unless you give a Write command. If you areunhappy about any changes you may have made, give the Quit command, andyour disk will remain as it was before you ran `fdisk'. You can alsointerrupt `fdisk' with `CTRL-C'.Deleting and adding partitions------------------------------Deleting a partition is simple. Give the Delete command by typing`d'. `fdisk' asks: Partition number (1-6): _Once you get this far, you must either delete a partition orinterrupt the program with `CTRL-C' (or whatever your current interruptcharacter is). Note: 1. You may delete a nonexistent partition. You will get a warning message. 2. You may delete an extended partition. This has the side effect of deleting all partitions greater than or equal to 5. 3. You may delete a logical partition. In that case, all partitions above it are renumbered at once. For example, if you delete partition 5, then partition 6 becomes known as partition 5, and partition 7 as partition 6.Adding a partition is just a bit more complicated. Give the Newcommand by typing `n'. `fdisk' allows you to 1. Create a primary partition, if there is a free slot in the primary partition table. 2. Create an extended partition if there is a free slot in the primary partition table, and if there is no extended partition. 3. Create a logical partition if an extended partition exists.If more than one of these actions is possible, you will be asked toselect Primary, Extended, or Logical, depending on what is currentlypermissible. Before you create a primary or an extended partition, youare asked what slot it is to have in the table (1-4).You may not add a primary or an extended partition if the selectedslot in the primary partition table is already occupied: in that caseyou simply return to the main menu. You are not allowed to add a newprimary partition unless there are sectors available outside theextended partition. You are not allowed to add a new logical partitionunless there are sectors available inside the extended partition.If space is available, you are prompted for the first cylinder: First cylinder ([237]-977): _The limits are the lowest and the highest cylinders in which sectorsare available in the appropriate part of the disk. The square-bracketednumber is what you'll get if you simply press enter. Not all numbers inthis range are necessarily available: they may fall inside an existingpartition. If you select a cylinder which is already in use, you aretold off and prompted again for the first cylinder. After selecting thefirst cylinder, you are prompted again: Last cylinder or +size or +sizeM or +sizeK (237-[836]): _The limits are the cylinder you have chosen as the first cylinder,and the highest cylinder which contains a legitimate upper boundary forthe new partition. The square-bracketed number is what you'll get ifyou simply press enter. In other words, all numbers in the given range arelegitimate, unlike those in the first range of cylinders. You may alsospecify the size of a partition in megabytes, kilobytes, or in thecurrent units (cylinders or sectors). A plus sign `+' indicates thatyour answer is a size rather than a boundary, and the suffix `m' or `k'(upper or lower case) indicates that the size is not given in units ofsectors or cyliners, but in megabytes or kilobytes respectively. Thuspossible answers to the last cylinder request above are700 Make cylinder 700 the last cylinder in the partition.+300 Make cylinder 237 + 300 = 537 the last cylinder in the partition.+15m Make the partition at least 15 megabytes in size.+12500k Make the partition at least 12,500 kilobytes in size.If you specify a size which is too large or an end which is out ofrange, fdisk complains and repeats the prompt.Adding or deleting partitions has no effect unless you subsequentlygive the Write command. Please remember to give the Verify commandfirst, just before giving the Write command: this is a safetyprecaution. After giving the Write command, you will see this message: The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.If there are no further messages, the kernel has successfully copiedthe information from the partition table into its own internal table.But sometimes you will see a message like this one: Re-read table failed with error 16: Device or resource busy. Reboot your system to ensure the partition table is updated.In this case, depending on what you have changed in the partitiontable, it may be dangerous to continue working without rebooting,since you may lose or corrupt your data.Here are some important things to note: 1. Before you reboot, you *may* run `fdisk' again, either to manage another disk, or to make additional changes to the same disk, or just to check that the changes have been made as you expected. This is true even after you receive the message warning you to reboot. 2. It is not a good idea to run any of the programs `mkfs', `mkswap', `mount', or `swapon' if you have received the warning message but have not rebooted. In this case it is dangerous to run any program, but these in particular may cause serious damage to the data on your disk, including the partition tables themselves.Active flags and system types-----------------------------The active flag is a bit in the partition table entry which marks apartition as bootable. This is important to some primary boot sectorprograms, which will not boot from an unflagged partition. Other suchprograms do not allow more than one partition to be flagged. Some,like LILO, ignore the flags completely. I prefer to flag all bootablepartitions as active so that they stand out on the menu which `fdisk'lists. Fdisk prints a star after the name of a partition's device fileif its active flag is set.The Active command changes, or toggles, a partition's active flag.Give the Active command, and select a partition by number. If it wasmarked inactive, it will be flagged as active; if it was flagged asactive, it will be marked inactive. You may set the active flag on anextended or logical partition, though the meaning of such a flag is byno means clear. This can be used to install LILO as a secondary bootloader to boot a Linux which lives on a second hard disk.The Type command changes the ID number which describes what type apartition is. `fdisk' currently recognises 30 system IDs, in the sensethat it prints a string for each of them, but it allows you to changeany system ID to any other, with the following exceptions: you may notchange any partition to or from the type Extended, and you may notchange a partition whose type is Empty (0) to any other type. You may,however, change the type of any data partition to 0, which isequivalent to deleting it.The new system ID or type code is a hexadecimal number. There aretwo ways of listing the numbers which `fdisk' recognises: use the Listcommand, which prints the list, or use the Type command, which, when itprompts you for the code, says Hex code (type L to list codes): _where the upper case `L' is used for clarity. The codes printed are:Some of these numbers are a trifle uncertain. By default `fdisk' usesa type of 83. It used to use 81, the type code used by the MINIX`fdisk'. It seemed prudent to change the default since (a) many Linux`minix' file systems are no longer compatible with MINIX, (b) the ext2file system, a native Linux file system, is fairly stable, as is theXia file system, and (c) the number 81 causes problems with DR-DOS.Linux does not usually care what values you use for type codes, butother systems, in particular DOS, OS/2, and DR-DOS, may.The value of 82 for Linux swap partitions is my own invention, andis intended to give some recognisable distinction to the partitionswhen the values are displayed in hexadecimal.New active flags and new system type codes are not written to thedisk until you exit from `fdisk' with the Write command, as describedabove, in the section on deleting and adding partitions.Extra commands for experts--------------------------The eXtra command `x' puts `fdisk' into `expert' mode, in which aslightly different set of commands is available. The Active, Delete,List, New, Type, Verify, and `eXpert' commands are not available inexpert mode. The commands Write and Quit are available as in ordinarymode, the Print command is available, but produces output in a slightlydifferent format, and of course the Menu command prints the expertmenu. There are several new commands. 1. The Return command brings you back to the main menu. 2. The Extended command prints the list of table entries which point to other tables. Ordinary users do not need this information. The data is shown as it is stored. The same format is used for the expert Print command. 3. The dangerous Begin command allows you to move the start of data in a partition away from its beginning. Other systems create partitions with this format, and it is sometimes useful to be able to reproduce it. 4. The slightly dangerous Cylinders command allows you to change the available number of cylinders. For SCSI disk owners, note that we require not the actual number of physical cylinders, but the number of logical cylinders used by DOS and other operating systems. 5. The extremely dangerous Heads and Sectors commands allow you to change the number of heads and sectors. It should not be necessary to use these commands unless you have a SCSI disk, whose geometry Linux is not always able to determine. SCSI disk owners note that we need not the actual number of heads or of sectors per track, but the number believed to exist by DOS and other operating systems. *Warning*: If you set either of these numbers to a bad value, you may lose all data on your disk.Always, after giving any of the commands Begin, Cylinder, Heads, orSectors, you should Return to the main menu and give the Verify command.Warnings for `fdisk' users--------------------------In general, you should not use this `fdisk' program to createpartitions for other operating systems, only for Linux. Nor should youuse `fdisk' commands from other operating systems to create partitionsfor Linux.DR-DOS 5.0 and 6.0 are reported to have difficulties with partitionID codes of 80 or more. The Linux `fdisk' used to set the system typeof new partitions to hexadecimal 81. DR-DOS seems to confuse this withhexadecimal 1, a DOS code. The values 82 for swap and 83 for filesystems should not cause problems with DR-DOS. If they do, you may usethe `fdisk' command `t' to change the system code of any Linuxpartitions to some number less than hexadecimal 80; I suggest 42 and 43for the moment.Partitioning a hard disk may destroy data which is on that disk if youare not careful. Go slowly, write down a description of the partitiontables before you changed them, and always verify before you write.Most operating systems and utilities expect that all partitions begin andend at cylinder boundaries. This version of `fdisk' does so by default,but you can use it to create partitions which begin or end anywhere.This does not normally affect Linux, but it is very dangerous, as otheroperating systems (including DOS) may try to `correct' the partitionboundaries.It is dangerous to create a new partition when the display/entryunits are sectors.The Verify command warns you if anything is wrong. *Always* give aVerify command before writing any changes to disk.If you set the disk geometry (tracks per cylinder, or sectors pertrack) to an incorrect value, you may lose all data on your disk.Do create BSD/SUN and/or IRIX/SGI disk labels only when you are surethat you want them. Both features are intended to allow you READingthose labels and prevent unintentional formatting of these disks.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -