自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

fdisk 中文man頁面

系統(tǒng)
硬盤可以被分成一個或多個邏輯磁盤,稱為 分區(qū)。 這些分區(qū)信息都存放在硬盤0扇區(qū)的 分區(qū)表 中。

NAME

fdisk - Linux分區(qū)表操作工具軟件  

總覽

fdisk [-u]設備名

fdisk -l [-u] [設備名 ...]

fdisk -s分區(qū) ...

fdisk -v  

描述

硬盤可以被分成一個或多個邏輯磁盤,稱為 分區(qū)。 這些分區(qū)信息都存放在硬盤0扇區(qū)的 分區(qū)表 中。

在 BSD 風格中,分區(qū)被稱為“磁盤片”和“磁盤標簽”

Linux 至少需要一個分區(qū),即用做它的 root 文件系統(tǒng)。 Linux 可以使用交換文件和/或交換分區(qū),交換分區(qū)更有效。因此,通常用戶會創(chuàng)建第二個 Linux 分區(qū)供交換分區(qū)使用。在 Intel 兼容的硬件上,啟動系統(tǒng)的 BIOS 往往只能訪問 1024 柱面之前的硬盤。因此,使用大硬盤的用戶通常創(chuàng)建第三個只有幾兆大小的小分區(qū),通常用來裝配在 /boot ,用來存放內(nèi)核映象和一些其它啟動時需要的附屬文件,所以應確保此分區(qū)必須是在BIOS可訪問的部分。出于安全方面的考慮、管理方面的原因、備份的需要或為了某些測試,也可以將一個硬盤分成更多的分區(qū)使用。

fdisk (以第一種形式調(diào)用)是一個以菜單問答形式出現(xiàn)的用來創(chuàng)建和修改分區(qū)的程序。它可以辯認 DOS 類型的分區(qū)表和 BSD 或 SUN 類型的磁盤標簽。

設備 通常是下列之一:
 

/dev/hda /dev/hdb /dev/sda /dev/sdb

(/dev/hd[a-h] 指 IDE 硬盤,/dev/sd[a-p] 指 SCSI 硬盤, /dev/ed[a-d] 指 ESDI 硬盤,/dev/xd[ab] 指 XT 硬盤)。設備名指整個硬盤設備。

分區(qū) 是在 設備名 后跟一個分區(qū)號。例如: /dev/hda1 是指系統(tǒng)在第一個 IDE 硬盤上的第一個分區(qū)。 IDE 硬盤可以最多創(chuàng)建 63 個分區(qū),SCSI 可以創(chuàng)建 15 個。又見 /usr/src/linux/Documnetation/devices.txt。

一個 BSD/SUN 風格的磁盤標簽可以描述 8 個分區(qū),其中第三個應該是“整個磁盤”分區(qū)。不要在零柱面使用那些的確使用其第一扇區(qū)的分區(qū),(比如交換分區(qū))因為這將損壞磁盤標簽。

一個 IRIX/SGI 風格的磁盤標簽可以描述 16 個分區(qū),其中第十一個應該是完整“卷標”分區(qū),而第九個應該被標成“卷標頭”。卷標頭將覆蓋分區(qū)表,即,它從零塊開始并缺省時延伸 5 個柱面。卷標頭中余下的空間可以用來存放頭部目錄記錄信息。不要有任何分區(qū)與此卷標頭重疊。同樣,也不要改變它的類形和在其中創(chuàng)建任何文件系統(tǒng),因為這樣做將丟失分區(qū)表信息。只有當將 Linux 安裝在 IRIX/SGI 機器上或在 Linux 中使用 IRIX/SGI 磁盤時才會使用這種類形的標簽。

一個 DOS 風格的分區(qū)表可以描述無限的分區(qū)。零扇區(qū)用來存放 4 個分區(qū)(稱為主分區(qū))的描述信息。其中可以有一個分區(qū)是擴展分區(qū);此擴展分區(qū)也就是存儲各邏輯分區(qū)地方,是一個在組成鏈表的扇區(qū)里存放的描述符,每個描述符都是一個對應分區(qū)的開頭.四個主分區(qū),不管是否存在,都用數(shù)字 1-4 編號,而邏輯分區(qū)以 5 開始。

在 DOS 風格的分區(qū)表中,開始地址偏移量和每個分區(qū)的大小是以兩種不同的方式來存放的:以扇區(qū)數(shù)的絕對值來描述(占 32 位)和以柱面、磁頭、扇區(qū)三個一組的形式(占 10+8+6 個位)來描述。前一種描述很好 - 如果每扇區(qū) 512 個字節(jié)的情況,這種方式可描述到 2TB 的大小。后一種方式有兩個不同的問題。第一個是這種 C/H/S 方式必須是在磁頭數(shù)和每磁道扇區(qū)數(shù)都已知的情況下才能使用。第二個是就算我們已經(jīng)知道了這些數(shù)字,而只用 24 位來描述這些信息也是不夠的。 DOS 只使用這種 C/H/S 的方式,Windows 則兩個都用,Linux 則不使用 C/H/S 的方式。

如果可能, fdisk 會自動獲得磁盤的幾何結構。這不一定是磁盤的物理結構(當然,現(xiàn)在的磁盤沒有真正的物理結構,同樣也不能以簡單的柱面/磁頭/扇區(qū)的形式來描述),而是 MS-DOS 用來供分區(qū)表使用的幾何結構。

通常,缺省時這些都將工作得很好,而且,如果磁盤上只有一個 Linux 操作系統(tǒng)時也不會有任何問題。然而,如果磁盤上還有其它操作系統(tǒng),那么,用其它操作系統(tǒng)的 fdisk 來生成其自身使用的至少一個分區(qū)是比較好的選擇。當Linux啟動的時侯,它會掃描分區(qū)表,并由此推出和其它共存操作系統(tǒng)友好合作所需的(偽)幾何結構。

當打印一個分區(qū)表時,系統(tǒng)會對分區(qū)表進行一次一至性檢查。這些檢查會驗證磁盤幾何結構和物理地址的開始、結束、指向和標識,同時在柱面的邊界檢查分區(qū)的開始和結束。(除了第一個分區(qū))

一些版本的 MS-DOS 在創(chuàng)建第一個分區(qū)時并不是從柱面邊界的開始處,而是從第一柱面的第 2 扇區(qū)處開始。從柱面 1 開始的分區(qū)不能直接從柱面邊界開始,但這未必會造成困難,除非你在你的機器上安裝了 OS/2 操作系統(tǒng)。

當執(zhí)行了對分區(qū)表的更新后退出時,程序會運行一次 sync() 和 BLKRRPART ioct1() (從磁盤上重讀分區(qū)表信息)。以前,在使用完 fdisk 后需要重啟系統(tǒng)。我認為現(xiàn)在不需要這樣了 -- 太快的重起可能導致未寫入磁盤的數(shù)據(jù)丟失。注意,內(nèi)核和磁盤硬件都可能緩存數(shù)據(jù)。

DOS6.x WARNING

DOS6.x 的 FORMAT 命令會在分區(qū)的第一扇區(qū)的數(shù)據(jù)區(qū)查找一些信息,并認為這些信息比分區(qū)表中的信息更可靠。 DOS 的 FORMAT 命令認為 DOS 的 FDISK 命令會在分區(qū)變化時自動清除分區(qū)數(shù)據(jù)區(qū)的前 512 字節(jié)區(qū)域。 DOS 的 FORMAT 將查看這些額外的信息,甚至在給出了 /U 這個參數(shù)后也是如此。我們認為這是 DOS FORMAT 和 DOS FDISK 的臭蟲。

如果你使用 cfdisk 或 fdisk 更改了 DOS 分區(qū)表的條目,你必須同時使用 dd 命令將該分區(qū)的前512個字節(jié)清零,之后,你才能使用 DOS 的 FORMAT 命令對這個分區(qū)進行格式化。例如:如果你使用 cfdisk 去創(chuàng)建一個 DOS 分區(qū)表項目,即分區(qū) /dev/hda1,然后(在退出 fdisk 或 cfdisk 后重啟 Linux 使分區(qū)表合法化)你就有必要使用如下命令 “dd if=/dev/ero of=/dev/hda1 bs=512 count=1” 來將分區(qū)的前 512 個字節(jié)清零。

當你使用 dd 命令時請 務必萬分小心 , 由于任何小的打印錯誤都將造成磁盤數(shù)據(jù)的失效。

最好你還是使用由操作系統(tǒng)指定的分區(qū)工具軟件。例如,當你創(chuàng)建 DOS 分區(qū)時應使用 DOS FDISK,而創(chuàng)建 Linux 分區(qū)時則使用 Linux 的 fdisk 或 cfdisk。

選項

-v
打印 fdisk 的版本信息并退出.
-l
列出指定設備的分區(qū)表信息并退出。如果沒有給出設備,那么使用那些在 /proc/partitions (如果存在)提到的.
-u
以扇區(qū)數(shù)而不是以柱面數(shù)的形式顯示分區(qū)表中各分區(qū)的信息. -s 分區(qū) 將分區(qū)的 大小 (單位為塊)信息輸出到標準輸出

#p#

NAME

fdisk - Partition table manipulator for Linux  

SYNOPSIS

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.

In the BSD world one talks about `disk slices' and a `disklabel'.

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.

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.

The device is usually one of the following:
 

/dev/hda /dev/hdb /dev/sda /dev/sdb

(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks). A device name refers to the entire disk.

The partition is a device name followed by a partition number. For example, /dev/hda1 is the first partition on the first IDE hard disk in the system. Disks can have up to 15 partitions. See also /usr/src/linux/Documentation/devices.txt.

A BSD/SUN type disklabel can describe 8 partitions, the third of which should be a `whole 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.

An IRIX/SGI type disklabel can describe 16 partitions, the eleventh of which should be an entire `volume' partition, while the ninth should be labeled `volume 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 system 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.

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 `primary'). 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.

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.

If possible, fdisk will obtain the disk geometry automatically. This is not necessarily the physical disk geometry (indeed, modern disks do not really have anything 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.

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.

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).

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.

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.

DOS 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.

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/hda1, 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/hda1 bs=512 count=1" to zero the first 512 bytes of the partition.

BE EXTREMELY CAREFUL if you use the dd command, since a small typo can make all of the data on your disk useless.

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.

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's ideas.)
-C cyls
Specify the number of cylinders of the disk. I have no idea why anybody would want to do so.
-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.
-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.
-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.
-u
When listing partition tables, give sizes in sectors instead of cylinders.
-s partition
The size of the partition (in blocks) is printed on the standard output.
-v
Print version number of fdisk program and exit.
責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-15 15:02:31

usleep中文man

2011-09-23 13:59:40

find中文man

2011-08-12 09:17:57

deallocvt中文man

2011-08-25 17:24:54

puts中文man

2011-07-15 16:58:36

ac中文man

2011-08-11 18:32:21

cp中文man

2011-08-23 11:34:26

ipcs中文man

2011-08-25 10:16:02

lmhosts中文man

2011-08-24 15:29:06

grant中文man

2011-08-25 17:32:40

setbuffer中文man

2011-08-25 16:50:08

getc中文man

2011-08-25 16:52:54

getchar中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 16:22:29

fputc中文man

2011-08-25 16:28:50

fread中文man

2011-08-25 17:27:58

rewind中文man
點贊
收藏

51CTO技術棧公眾號