FDISK(8) Linux Programmer?. Manual/Linux程序手册 FDISK(8)
NAME/名称
fdisk - Partition table manipulator for Linux/Linux分区表操纵器
fdisk - Partition table manipulator for Linux/Linux分区表操纵器
SYNOPSIS/简介
fdisk [-u] [-b sectorsize]/扇形尺寸 [-C cyls] [-H heads] [-S sects] device/设备
fdisk [-u] [-b sectorsize]/扇形尺寸 [-C cyls] [-H heads] [-S sects] device/设备
fdisk -l [-u] [device ...]
fdisk -s partition .../分区
fdisk -v
DESCRIPTION/描述
Hard disks can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk.
硬盘可以分为一个或多个称为分区的逻辑磁盘。此分区在磁盘的扇区0中的分区表中进行了描述。
Hard disks can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk.
硬盘可以分为一个或多个称为分区的逻辑磁盘。此分区在磁盘的扇区0中的分区表中进行了描述。
In the BSD world one talks about ?.isk slices?.and a ?.isklabel?.
在BSD的世界里,我们谈论的是什么?.isk slices?.and a ?.isklabel?.
在BSD的世界里,我们谈论的是什么?.isk slices?.and a ?.isklabel?.
Linux needs at least one partition, namely for its root file system. It can use swap files and/or swap partitions, but the latter are more efficient. So, usually
one will want a second Linux partition dedicated as swap partition. On Intel compatible hardware, the BIOS that boots the system can often only access the first
1024 cylinders of the disk. For this reason people with large disks often create a third partition, just a few MB large, typically mounted on /boot, to store the
kernel image and a few auxiliary files needed at boot time, so as to make sure that this stuff is accessible to the BIOS. There may be reasons of security, ease
of administration and backup, or testing, to use more than the minimum number of partitions.
Linux至少需要一个分区,即根文件系统。它可以使用交换文件和/或交换分区,但后者更高效。所以,通常需要第二个Linux分区作为交换分区。
在与Intel兼容的硬件上,引导系统的BIOS通常只能访问磁盘的前1024个柱面。
因此,拥有大磁盘的人通常会创建第三个分区,只有几MB大,通常安装在/boot上,以存储内核映像和启动时所需的一些辅助文件,以确保BIOS可以访问这些文件。
使用超过最小分区数的分区可能有安全、易于管理和备份或测试的原因。
one will want a second Linux partition dedicated as swap partition. On Intel compatible hardware, the BIOS that boots the system can often only access the first
1024 cylinders of the disk. For this reason people with large disks often create a third partition, just a few MB large, typically mounted on /boot, to store the
kernel image and a few auxiliary files needed at boot time, so as to make sure that this stuff is accessible to the BIOS. There may be reasons of security, ease
of administration and backup, or testing, to use more than the minimum number of partitions.
Linux至少需要一个分区,即根文件系统。它可以使用交换文件和/或交换分区,但后者更高效。所以,通常需要第二个Linux分区作为交换分区。
在与Intel兼容的硬件上,引导系统的BIOS通常只能访问磁盘的前1024个柱面。
因此,拥有大磁盘的人通常会创建第三个分区,只有几MB大,通常安装在/boot上,以存储内核映像和启动时所需的一些辅助文件,以确保BIOS可以访问这些文件。
使用超过最小分区数的分区可能有安全、易于管理和备份或测试的原因。
fdisk (in the first form of invocation) is a menu driven program for creation and manipulation of partition tables. It understands DOS type partition tables and
BSD or SUN type disklabels.
fdisk(第一种调用形式)是一个菜单驱动的程序,用于创建和操作分区表。它了解DOS类型的分区表和BSD或SUN类型的磁盘标签。
BSD or SUN type disklabels.
fdisk(第一种调用形式)是一个菜单驱动的程序,用于创建和操作分区表。它了解DOS类型的分区表和BSD或SUN类型的磁盘标签。
fdisk doesn?. understand GUID Partition Table (GPT) and it is not designed for large partitions. In particular case use more advanced GNU parted(8).
fdisk盘不?。了解guid分区表(gpt),它不是为大分区设计的。在特定情况下,使用更高级的GNU parted(8)。
fdisk盘不?。了解guid分区表(gpt),它不是为大分区设计的。在特定情况下,使用更高级的GNU parted(8)。
The device is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk. The old systems without libata (a library used inside the Linux kernel to
support ATA host controllers and devices) make a difference between IDE and SCSI disks. In such a case the device name will be /dev/hd* (IDE) or /dev/sd* (SCSI).
该设备通常是/dev/sda、/dev/sdb等。设备名称指的是整个磁盘。没有libata的旧系统(Linux内核中用于支持ata主机控制器和设备的库)在IDE和SCSI磁盘之间产生差异。
在这种情况下,设备名称将是/dev/hd*(ide)或/dev/sd*(scsi)。
support ATA host controllers and devices) make a difference between IDE and SCSI disks. In such a case the device name will be /dev/hd* (IDE) or /dev/sd* (SCSI).
该设备通常是/dev/sda、/dev/sdb等。设备名称指的是整个磁盘。没有libata的旧系统(Linux内核中用于支持ata主机控制器和设备的库)在IDE和SCSI磁盘之间产生差异。
在这种情况下,设备名称将是/dev/hd*(ide)或/dev/sd*(scsi)。
The partition is a device name followed by a partition number. For example, /dev/sda1 is the first partition on the first hard disk in the system. See also Linux
kernel documentation (the Documentation/devices.txt file).
分区是一个设备名,后跟一个分区号。例如,/dev/sda1是系统中第一个硬盘上的第一个分区。另请参见Linux内核文档(documentation/devices.txt文件)。
kernel documentation (the Documentation/devices.txt file).
分区是一个设备名,后跟一个分区号。例如,/dev/sda1是系统中第一个硬盘上的第一个分区。另请参见Linux内核文档(documentation/devices.txt文件)。
A BSD/SUN type disklabel can describe 8 partitions, the third of which should be a ?.hole disk?.partition. Do not start a partition that actually uses its first
sector (like a swap partition) at cylinder 0, since that will destroy the disklabel.
bsd/sun类型的disklabel可以描述8个分区,第三个分区应该是?孔盘?分区。不要在柱面0上启动实际使用其第一个扇区(如交换分区)的分区,因为这样会破坏disklabel。
sector (like a swap partition) at cylinder 0, since that will destroy the disklabel.
bsd/sun类型的disklabel可以描述8个分区,第三个分区应该是?孔盘?分区。不要在柱面0上启动实际使用其第一个扇区(如交换分区)的分区,因为这样会破坏disklabel。
An IRIX/SGI type disklabel can describe 16 partitions, the eleventh of which should be an entire ?.olume?.partition, while the ninth should be labeled ?.olume
header?. The volume header will also cover the partition table, i.e., it starts at block zero and extends by default over five cylinders. The remaining space in
the volume header may be used by header directory entries. No partitions may overlap with the volume header. Also do not change its type and make some file sys-
tem on it, since you will lose the partition table. Use this type of label only when working with Linux on IRIX/SGI machines or IRIX/SGI disks under Linux.
An Irix/Sgi type disklabel can describe 16 partitions,the eleventh of which should be an entire?Olume?Partition,
while the ninth should be labeled?Olume Header?The Volume Header will also cover the Partition Table,I.E.,
it starts at block Zero and extends by default over five cylders.The remaining space in the volume header may be used by Header Directory Entries.
没有政党可以克服与卷头。Also do not change its type and make some file system on it,since you will lose the partition table.
使用这一类型的Label only when you working with Linux on Irix/SGI machines or IREX/SGI Disks under Linux.
header?. The volume header will also cover the partition table, i.e., it starts at block zero and extends by default over five cylinders. The remaining space in
the volume header may be used by header directory entries. No partitions may overlap with the volume header. Also do not change its type and make some file sys-
tem on it, since you will lose the partition table. Use this type of label only when working with Linux on IRIX/SGI machines or IRIX/SGI disks under Linux.
An Irix/Sgi type disklabel can describe 16 partitions,the eleventh of which should be an entire?Olume?Partition,
while the ninth should be labeled?Olume Header?The Volume Header will also cover the Partition Table,I.E.,
it starts at block Zero and extends by default over five cylders.The remaining space in the volume header may be used by Header Directory Entries.
没有政党可以克服与卷头。Also do not change its type and make some file system on it,since you will lose the partition table.
使用这一类型的Label only when you working with Linux on Irix/SGI machines or IREX/SGI Disks under Linux.
A DOS type partition table can describe an unlimited number of partitions. In sector 0 there is room for the description of 4 partitions (called ?.rimary?.. One of
these may be an extended partition; this is a box holding logical partitions, with descriptors found in a linked list of sectors, each preceding the corresponding
logical partitions. The four primary partitions, present or not, get numbers 1-4. Logical partitions start numbering from 5.
DOS类型的分区表可以描述无限数量的分区。在0区,有空间描述4个分区(称为?是吗?…其中一个可以是扩展分区;这是一个包含逻辑分区的框,
在一个链接的扇区列表中找到描述符,每个扇区都在相应的逻辑分区之前。四个主分区,不管是否存在,都得到1-4号。逻辑分区从5开始编号。
these may be an extended partition; this is a box holding logical partitions, with descriptors found in a linked list of sectors, each preceding the corresponding
logical partitions. The four primary partitions, present or not, get numbers 1-4. Logical partitions start numbering from 5.
DOS类型的分区表可以描述无限数量的分区。在0区,有空间描述4个分区(称为?是吗?…其中一个可以是扩展分区;这是一个包含逻辑分区的框,
在一个链接的扇区列表中找到描述符,每个扇区都在相应的逻辑分区之前。四个主分区,不管是否存在,都得到1-4号。逻辑分区从5开始编号。
In a DOS type partition table the starting offset and the size of each partition is stored in two ways: as an absolute number of sectors (given in 32 bits) and as
a Cylinders/Heads/Sectors triple (given in 10+8+6 bits). The former is OK - with 512-byte sectors this will work up to 2 TB. The latter has two different problems.
First of all, these C/H/S fields can be filled only when the number of heads and the number of sectors per track are known. Secondly, even if we know what these
numbers should be, the 24 bits that are available do not suffice. DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S.
在DOS类型的分区表中,每个分区的起始偏移量和大小以两种方式存储:作为扇区的绝对数(以32位表示)和作为柱面/磁头/扇区的三倍(以10+8+6位表示)。
前者是正常的-512字节的扇区将工作高达2 TB。后者有两个不同的问题。首先,这些c/h/s字段只能在知道磁头数目和每条磁道的扇区数目时填写。
其次,即使我们知道这些数字应该是什么,可用的24位也不够。DOS只使用C/H/S,Windows同时使用这两种,Linux从不使用C/H/S。
a Cylinders/Heads/Sectors triple (given in 10+8+6 bits). The former is OK - with 512-byte sectors this will work up to 2 TB. The latter has two different problems.
First of all, these C/H/S fields can be filled only when the number of heads and the number of sectors per track are known. Secondly, even if we know what these
numbers should be, the 24 bits that are available do not suffice. DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S.
在DOS类型的分区表中,每个分区的起始偏移量和大小以两种方式存储:作为扇区的绝对数(以32位表示)和作为柱面/磁头/扇区的三倍(以10+8+6位表示)。
前者是正常的-512字节的扇区将工作高达2 TB。后者有两个不同的问题。首先,这些c/h/s字段只能在知道磁头数目和每条磁道的扇区数目时填写。
其次,即使我们知道这些数字应该是什么,可用的24位也不够。DOS只使用C/H/S,Windows同时使用这两种,Linux从不使用C/H/S。
If possible, fdisk will obtain the disk geometry automatically. This is not necessarily the physical disk geometry (indeed, modern disks do not really have any-
thing like a physical geometry, certainly not something that can be described in simplistic Cylinders/Heads/Sectors form), but is the disk geometry that MS-DOS
uses for the partition table.
如果可能,fdisk将自动获取磁盘几何。这不一定是物理磁盘几何图形(实际上,现代磁盘没有物理几何图形,当然不是可以用简单的柱面/磁头/扇区形式描述的东西),
而是MS-DOS用于分区表的磁盘几何图形。
thing like a physical geometry, certainly not something that can be described in simplistic Cylinders/Heads/Sectors form), but is the disk geometry that MS-DOS
uses for the partition table.
如果可能,fdisk将自动获取磁盘几何。这不一定是物理磁盘几何图形(实际上,现代磁盘没有物理几何图形,当然不是可以用简单的柱面/磁头/扇区形式描述的东西),
而是MS-DOS用于分区表的磁盘几何图形。
Usually all goes well by default, and there are no problems if Linux is the only system on the disk. However, if the disk has to be shared with other operating
systems, it is often a good idea to let an fdisk from another operating system make at least one partition. When Linux boots it looks at the partition table, and
tries to deduce what (fake) geometry is required for good cooperation with other systems.
通常在默认情况下一切正常,如果Linux是磁盘上唯一的系统,那么就没有问题。但是,如果磁盘必须与其他操作系统共享,那么让另一个操作系统的fdisk至少创建一个分区通常是一个好主意。
当Linux引导时,它会查看分区表,并尝试推断出与其他系统良好合作所需的(假的)几何体。
systems, it is often a good idea to let an fdisk from another operating system make at least one partition. When Linux boots it looks at the partition table, and
tries to deduce what (fake) geometry is required for good cooperation with other systems.
通常在默认情况下一切正常,如果Linux是磁盘上唯一的系统,那么就没有问题。但是,如果磁盘必须与其他操作系统共享,那么让另一个操作系统的fdisk至少创建一个分区通常是一个好主意。
当Linux引导时,它会查看分区表,并尝试推断出与其他系统良好合作所需的(假的)几何体。
Whenever a partition table is printed out, a consistency check is performed on the partition table entries. This check verifies that the physical and logical
start and end points are identical, and that the partition starts and ends on a cylinder boundary (except for the first partition).
每当打印出分区表时,都会对分区表条目执行一致性检查。此检查验证物理和逻辑起点和终点是否相同,以及分区的起点和终点是否在柱面边界上(第一个分区除外)。
start and end points are identical, and that the partition starts and ends on a cylinder boundary (except for the first partition).
每当打印出分区表时,都会对分区表条目执行一致性检查。此检查验证物理和逻辑起点和终点是否相同,以及分区的起点和终点是否在柱面边界上(第一个分区除外)。
Some versions of MS-DOS create a first partition which does not begin on a cylinder boundary, but on sector 2 of the first cylinder. Partitions beginning in
cylinder 1 cannot begin on a cylinder boundary, but this is unlikely to cause difficulty unless you have OS/2 on your machine.
有些版本的MS-DOS创建的第一个分区不是从柱面边界开始,而是从第一个柱面的第2扇区开始。从柱面1开始的分区不能从柱面边界开始,但这不太可能导致困难,除非您的计算机上有OS/2。
cylinder 1 cannot begin on a cylinder boundary, but this is unlikely to cause difficulty unless you have OS/2 on your machine.
有些版本的MS-DOS创建的第一个分区不是从柱面边界开始,而是从第一个柱面的第2扇区开始。从柱面1开始的分区不能从柱面边界开始,但这不太可能导致困难,除非您的计算机上有OS/2。
A sync() and a BLKRRPART ioctl() (reread partition table from disk) are performed before exiting when the partition table has been updated. Long ago it used to be
necessary to reboot after the use of fdisk. I do not think this is the case anymore - indeed, rebooting too quickly might cause loss of not-yet-written data. Note
that both the kernel and the disk hardware may buffer data.
在更新分区表后退出之前,将执行sync()和blkrrpart ioctl()(从磁盘重新读取分区表)。很久以前,在使用fdisk之后需要重新启动。
我不认为这是事实了-事实上,重新启动太快可能导致尚未写入的数据丢失。注意,内核和磁盘硬件都可以缓冲数据。
necessary to reboot after the use of fdisk. I do not think this is the case anymore - indeed, rebooting too quickly might cause loss of not-yet-written data. Note
that both the kernel and the disk hardware may buffer data.
在更新分区表后退出之前,将执行sync()和blkrrpart ioctl()(从磁盘重新读取分区表)。很久以前,在使用fdisk之后需要重新启动。
我不认为这是事实了-事实上,重新启动太快可能导致尚未写入的数据丢失。注意,内核和磁盘硬件都可以缓冲数据。
DOS 6.x WARNING/2 6.X.warning
The DOS 6.x FORMAT command looks for some information in the first sector of the data area of the partition, and treats this information as more reliable than the
information in the partition table. DOS FORMAT expects DOS FDISK to clear the first 512 bytes of the data area of a partition whenever a size change occurs. DOS
FORMAT will look at this extra information even if the /U flag is given -- we consider this a bug in DOS FORMAT and DOS FDISK.
dos 6.x格式命令在分区的数据区域的第一个扇区中查找一些信息,并将这些信息视为比分区表中的信息更可靠的信息。DOS格式要求DOS fdisk在大小发生变化时清除分区数据区域的前512字节。
DOS格式将查看这些额外的信息,即使给出了/U标志——我们认为这是DOS格式和DOS fdisk中的一个错误。
The DOS 6.x FORMAT command looks for some information in the first sector of the data area of the partition, and treats this information as more reliable than the
information in the partition table. DOS FORMAT expects DOS FDISK to clear the first 512 bytes of the data area of a partition whenever a size change occurs. DOS
FORMAT will look at this extra information even if the /U flag is given -- we consider this a bug in DOS FORMAT and DOS FDISK.
dos 6.x格式命令在分区的数据区域的第一个扇区中查找一些信息,并将这些信息视为比分区表中的信息更可靠的信息。DOS格式要求DOS fdisk在大小发生变化时清除分区数据区域的前512字节。
DOS格式将查看这些额外的信息,即使给出了/U标志——我们认为这是DOS格式和DOS fdisk中的一个错误。
The bottom line is that if you use fdisk to change the size of a DOS partition table entry, then you must also use dd to zero the first 512 bytes of that partition
before using DOS FORMAT to format the partition. For example, if you were using disk to make a DOS partition table entry for /dev/sda1, then (after exiting fdisk
and rebooting Linux so that the partition table information is valid) you would use the command "dd if=/dev/zero of=/dev/sda1 bs=512 count=1" to zero the first 512
bytes of the partition.
底线是,如果使用fdisk更改DOS分区表条目的大小,那么在使用DOS格式格式化分区之前,还必须使用dd将该分区的前512个字节归零。例如,如果您使用磁盘为/dev/sda1创建DOS分区表条目,
那么(在退出fdisk并重新启动Linux以便分区表信息有效之后),您将使用命令“dd if=/dev/zero of=/dev/sda1 bs=512 count=1”将分区的前512个字节归零。
before using DOS FORMAT to format the partition. For example, if you were using disk to make a DOS partition table entry for /dev/sda1, then (after exiting fdisk
and rebooting Linux so that the partition table information is valid) you would use the command "dd if=/dev/zero of=/dev/sda1 bs=512 count=1" to zero the first 512
bytes of the partition.
底线是,如果使用fdisk更改DOS分区表条目的大小,那么在使用DOS格式格式化分区之前,还必须使用dd将该分区的前512个字节归零。例如,如果您使用磁盘为/dev/sda1创建DOS分区表条目,
那么(在退出fdisk并重新启动Linux以便分区表信息有效之后),您将使用命令“dd if=/dev/zero of=/dev/sda1 bs=512 count=1”将分区的前512个字节归零。
BE EXTREMELY CAREFUL if you use the dd command, since a small typo can make all of the data on your disk useless.
如果使用dd命令,请格外小心,因为一个小的打字错误会使磁盘上的所有数据无效。
如果使用dd命令,请格外小心,因为一个小的打字错误会使磁盘上的所有数据无效。
For best results, you should always use an OS-specific partition table program. For example, you should make DOS partitions with the DOS FDISK program and Linux
partitions with the Linux fdisk program.
为了获得最佳结果,您应该始终使用操作系统特定的分区表程序。例如,您应该使用dos fdisk程序进行dos分区,使用linux fdisk程序进行linux分区。
partitions with the Linux fdisk program.
为了获得最佳结果,您应该始终使用操作系统特定的分区表程序。例如,您应该使用dos fdisk程序进行dos分区,使用linux fdisk程序进行linux分区。
OPTIONS/选项
-b sectorsize
Specify the sector size of the disk. Valid values are 512, 1024, or 2048. (Recent kernels know the sector size. Use this only on old kernels or to override
the kernel?. ideas.)
-B扇区大小
指定磁盘的扇区大小。有效值为512、1024或2048。(最近的内核知道扇区大小。只在旧内核上使用它还是重写内核?想法。
-b sectorsize
Specify the sector size of the disk. Valid values are 512, 1024, or 2048. (Recent kernels know the sector size. Use this only on old kernels or to override
the kernel?. ideas.)
-B扇区大小
指定磁盘的扇区大小。有效值为512、1024或2048。(最近的内核知道扇区大小。只在旧内核上使用它还是重写内核?想法。
-C cyls
Specify the number of cylinders of the disk. I have no idea why anybody would want to do so.
-C循环
指定磁盘的柱面数。我不知道为什么会有人想这么做。
Specify the number of cylinders of the disk. I have no idea why anybody would want to do so.
-C循环
指定磁盘的柱面数。我不知道为什么会有人想这么做。
-H heads
Specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.) Reasonable values are 255 and 16.
-H 型封头
指定磁盘的磁头数。(当然不是物理数,而是用于分区表的数。)合理的值是255和16。
Specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.) Reasonable values are 255 and 16.
-H 型封头
指定磁盘的磁头数。(当然不是物理数,而是用于分区表的数。)合理的值是255和16。
-S sects
Specify the number of sectors per track of the disk. (Not the physical number, of course, but the number used for partition tables.) A reasonable value is
63.
-S 分支
指定磁盘每个磁道的扇区数。(当然不是物理数,而是用于分区表的数。)合理的值是 63。
Specify the number of sectors per track of the disk. (Not the physical number, of course, but the number used for partition tables.) A reasonable value is
63.
-S 分支
指定磁盘每个磁道的扇区数。(当然不是物理数,而是用于分区表的数。)合理的值是 63。
-l List the partition tables for the specified devices and then exit. If no devices are given, those mentioned in /proc/partitions (if that exists) are used.
-l 列出指定设备的分区表,然后退出。如果没有指定设备,则使用/proc/partitions(如果存在)中提到的设备。
-l 列出指定设备的分区表,然后退出。如果没有指定设备,则使用/proc/partitions(如果存在)中提到的设备。
-u When listing partition tables, give sizes in sectors instead of cylinders.
-u 列出分区表时,以扇区而不是柱面给出大小。
-u 列出分区表时,以扇区而不是柱面给出大小。
-s partition
The size of the partition (in blocks) is printed on the standard output.
-S 分区
分区的大小(以块为单位)打印在标准输出上。
The size of the partition (in blocks) is printed on the standard output.
-S 分区
分区的大小(以块为单位)打印在标准输出上。
-v Print version number of fdisk program and exit.
-v 打印fdisk程序的版本号并退出。
-v 打印fdisk程序的版本号并退出。
BUGS/漏洞
There are several *fdisk programs around. Each has its problems and strengths. Try them in the order parted, fdisk, sfdisk.
有几个fdisk项目。每个人都有自己的问题和优势。按parted、fdisk、sfdisk的顺序进行尝试。
There are several *fdisk programs around. Each has its problems and strengths. Try them in the order parted, fdisk, sfdisk.
有几个fdisk项目。每个人都有自己的问题和优势。按parted、fdisk、sfdisk的顺序进行尝试。
The IRIX/SGI type disklabel is currently not supported by the kernel. Moreover, IRIX/SGI header directories are not fully supported yet.
内核当前不支持IRIX/SGI类型的diskLabel。此外,还不完全支持IRIX/SGI头目录。
内核当前不支持IRIX/SGI类型的diskLabel。此外,还不完全支持IRIX/SGI头目录。
The option ?.ump partition table to file?.is missing.
选择权?.ump分区表到文件?不见了。
选择权?.ump分区表到文件?不见了。
SEE ALSO/参照
mkfs(8), parted(8), sfdisk(8)
mkfs(8), parted(8), sfdisk(8)
Linux 2.0 11 June 1998 /六月 FDISK(8)