📄 fdisk.texi
字号:
table to the disk. Those that need to write to the disk immediately, warn the userabout it and are only available when not running in Linux fdisk compatibility mode.The default unit used is cylinder and can be changed to sector. Partition sizescan be specified in any other available unit, though. See the next section for more information.@table @code@item @b{m}A command obsoleted by reading this manual.@item @b{p}Displays the partition table on the disk. It shows information likethe start and end of the partitions, and their partition number. Thisis needed for using most of the commands below, so it is a good ideato list the partition table before using them. The start and end ofthe partition are displayed in the unit that you have selected forfdisk, while the size is displayed in blocks.@item @b{a}Toggles the bootable flag on a partition. On a DOS partition table typethe partition with the bootable flag is the one that the system will bootfrom if there is no a boot manager in the master record. Make sure you have a bootable partition, and it is indeed bootable. You will beasked for a partition number.@item @b{d}Delete the selected partition so you can use it to create another partition on the free space left by it.@item @b{n}Creates a new partition on some free space in the partition table. You will be asked for the type of partition you want to create, and you can enter @b{p} forprimary, @b{e} for extended or @b{l} for logical. Make sure that you select a type, that can be created in the position that you want to create it. You can createlogical partition only inside the extended. You will be asked about the startand end of the partition. If you put a @i{+} before the end, it will be regardedas size. You can also specify the start and end or size in a different unit,please check the next section for more information. If you are using gfdisk, you will also be asked about the filesystem type and whether you want to createa filesystem on the partition. If you don't want to select a filesystem type,just select the default and you can later change the system type with the@b{t} command.@item @b{o}Creates a new empty DOS partition table. Use this command if you want tostart the partition table on the disk from scratch, deleting all the partitionsthat are currently residing on it.@item @b{s}Creates a new empty SUN disklabel. If you are using a disk with a SUN disklabel, use this command if you want to start the partition table on the disk from scratch,deleting all the partitions that are currently residing on it.@item @b{l}Lists the known filesystem types for the partition table or disklabel on the disk.This is not about the supported filesystem types, but about the way the disklabelmarks the filesystem that is supposed to be residing on the partition. It candiffer from the real filesystem, although it is not recommended.@item @b{t}Changes the filesystem type of a partition. This does not touch the actual filesystemon the partition, it just changes the field in the partition table that marksthe filesystem that is supposed to be residing on the partition. If you are running gfdisk, when you select a filesystem during the creation of a newpartition, the most appropriate value for this field is selected.@item @b{w}Writes the partition table to the disk, notifies the operating system about thechanges and quits the program. If fdisk wasn't able to notify the OS, youwill have to restart the computer in order to use the new partition table.@item @b{q}Quits the program without saving the changes.@item @b{x}Displays a menu with extra operations, which are described below.@end tableThere is a menu with extra functionality in GNU fdisk. In gfdisk, itwill include the specific to gfdisk commands. Everything is described below.The extra commands in lfdisk include@table @code@item @b{f}Fixes the order of the partitions in the partition table. This isuseful, when for example on an DOS partition table, the partitions havea wrong order and you want to order them in order they are placed onthe disk.@item @b{b}Moves the beginning of the data in the partition. Asks for a new startof the partition and then changes the partition geometry.@item @b{c}Changes the number of the cylinders of the disk. @item @b{h}Changes the number of the heads of the disk.@item @b{s}Changes the number of the sectors per track of the disk. @end tableThe extra commands in gfdisk include@table @code@item @b{h}Checks the consistency of the filesystem. It is useful to see whetherit is safe to perform operations like resize on the partitions. Itperforms a very basic check on the filesystem, so if you want to makea more thorough test or fix the errors on the filesystem, you should anexternal utility like e2fsck for ext2 or reiserfsck for reiserfs. Pleasenote that the check is limited on some filesystem types (ext2, ext3 andreiserfs at the time of writing of the manual), but if the partitioncontains errors resize will gracefully fail without destroying the filesystem.@item @b{v}Moves the partition to another location on the disk. It asks for the number of the partition you want to move. This command works in the sameway as the new partition command and asks same questions, see above.The new location can't overlap with the current location. If this is whatyou need, you should try using the resize function, instead. Moving thepartition requires that all changes you made so far are written to the disk. @item @b{c}Rescues a partition with a supported filesystem, that has been deleted. You specify the start and end of the region where you want to look forthe start of the partition.@item @b{z}Resizes the partition and its filesystem, if supported. You will be askedfor the number of the partition, and the new size and end. Somesupported filesystem types require that the start of the partitionstays fixed. This command requires that all changes you made so farare written to the disk.@item @b{o}Copies another partition over an already created partition on the disk.You can copy a partition from a different disk. You will beasked for the device of the disk that you want to copy from and thenumber of the partitions on both disks. This requires that allchanges you made so far are written to the disk.@item @b{k}Creates a new file system on the selected partition. You will be askedto choose the filesystem type. The filesystem field in the partition tableor disklabel is updated automatically. Please note that this requires that allchanges you made so far are commited to the disk. If there is alreadya filesystem on the partition, it will be destroyed.@end table@node Units@section UnitsWhile you can select either cylinders or sectors as display units, you can specify the positions and sizes in units of your choice,by entering the size followed by the unit. This is a list of the unitsthat are available. Please note, that at the time of writing, using someof the units, like percent, as a position or size is broken. @table @code@item @b{compact}Display each size in the most suitable unit from B, kB, MB, GB and TB.@item @b{B}One byte@item @b{kB }One kilobyte (1,000 bytes)@item @b{MB}One megabyte (1,000,000 bytes)@item @b{GB}One gigabyte (1,000,000,000 bytes)@item @b{TB}One terabyte (1,000,000,000,000 bytes)@item @b{KiB}One kilo binary byte (1,024 bytes)@item @b{MiB}One mega binary byte (1,048,576 bytes)@item @b{GiB}One giga binary byte (1,073,741,824 bytes)@item @b{TiB}One tera binary byte (1,099,511,627,776 bytes)@item @b{s}One sector. It depends on the sector size of the disk. You can use it if you want to see or choose the exact size in sectors.@item @b{%}One percent from the size of the disk@item @b{cyl}One cylinder. It depends on the cylinder size.@item @b{chs}Use CHS display units.@end table@node Bugs@chapter BugsBefore editing a BSD disklabel, the partition with the disklabel shouldalready exist on the disk and be detected by the OS. If you have created a BSD-typepartition, you need to write the changes to the disk. If fdisk fails to notify the OS about the changes in partition table, you need to restart your computer.As fdisk tries to guess the device holding the BSD disklabel, it might fail toedit it at all, even if the OS has detected it. In this case you are adviced tosimply open the device with fdisk directly. It is possible that it doesn't workon some operating systems.Getting the size of a partition with -s might fail, if fdisk fails to guess the disk device, for the same reasons as with the previous bug.@node See also@chapter See also@b{cfdisk}@r{(8),}@b{mkfs}@r{(8),}@b{parted}@r{(8)}@node Copying this manual@appendix Copying this manual@menu* GNU Free Documentation License:: License for copying this manual@end menu@include fdl.texi@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -