⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sfdisk.8

📁 Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器
💻 8
📖 第 1 页 / 共 2 页
字号:
.\" Copyright 1995 Andries E. Brouwer (aeb@cwi.nl).\" May be distributed under the GNU General Public License.\" The `DOS 6.x Warning' was taken from the old fdisk.8, which says.\" -- Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu).\" -- May be distributed under the GNU General Public License.\" The `DRDOS Warning' was taken from a net post by Stephen Tweedie..\".TH SFDISK 8 "1 September 1995" "Linux" "Linux Programmer's Manual".SH NAMEsfdisk \- Partition table manipulator for Linux.SH SYNOPSIS.BR sfdisk " [options] device".br.BR "sfdisk \-s " [partition].SH DESCRIPTION.B sfdiskhas four (main) uses: list the size of a partition, list the partitionson a device, check the partitions on a device, and - very dangerous -repartition a device..SS "List Sizes".BI "sfdisk \-s " partitiongives the size of.I partitionin blocks. This may be useful in connection with programs like.B mkswapor so. Here.I partitionis usually something like.I /dev/hda1or.IR /dev/sdb12 ,but may also be an entire disk, like.IR /dev/xda ..br.RS.nf.if t .ft CW% sfdisk \-s /dev/hda981599%.if t .ft R.fi.REIf the partition argument is omitted,.B sfdiskwill list the sizes of all disks, and the total:.br.RS.nf.if t .ft CW% sfdisk \-s/dev/hda: 208896/dev/hdb: 1025136/dev/hdc: 1031063/dev/sda: 8877895/dev/sdb: 1758927total: 12901917 blocks%.if t .ft R.fi.RE.SS "List Partitions"The second type of invocation:.BI "sfdisk \-l " "[options] device"will list the partitions on this device.If the device argument is omitted, the partitions on all hard disksare listed..br.nf.if t .ft CW% sfdisk \-l /dev/hdcDisk /dev/hdc: 16 heads, 63 sectors, 2045 cylindersUnits = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0   Device Boot Start     End   #cyls   #blocks   Id  System/dev/hdc1          0+    406     407\-   205096+  83  Linux native/dev/hdc2        407     813     407    205128   83  Linux native/dev/hdc3        814    2044    1231    620424   83  Linux native/dev/hdc4          0       \-       0         0    0  Empty%.if t .ft R.fiThe trailing \- and + signs indicate that rounding has taken place,and that the actual value is slightly less (more).To see the exact values, ask for a listing with sectors as unit..SS "Check partitions"The third type of invocation:.BI "sfdisk \-V " devicewill apply various consistency checks to the partition tables on.IR device .It prints `OK' or complains. The \-V option can be used togetherwith \-l. In a shell script one might use.BI "sfdisk \-V \-q " devicewhich only returns a status..SS "Create partitions"The fourth type of invocation:.BI "sfdisk " devicewill cause.B sfdiskto read the specification for the desired partitioning of.I devicefrom its standard input, and then to change the partition tableson that disk. Thus, it is possible to use.B sfdiskfrom a shell script. When.B sfdiskdetermines that its standard input is a terminal, it will beconversational; otherwise it will abort on any error..LPBE EXTREMELY CAREFUL - ONE TYPING MISTAKE AND ALL YOUR DATA IS LOST.LPAs a precaution, one can save the sectors changed by.BR sfdisk :.RS.nf.if t .ft CW% sfdisk /dev/hdd \-O hdd-partition-sectors.save\&...%.if t .ft R.fi.RE.LPThen, if you discover that you did something stupid before anythingelse has been written to disk, it may be possible to recoverthe old situation with.RS.nf.if t .ft CW% sfdisk /dev/hdd \-I hdd-partition-sectors.save%.if t .ft R.fi.RE.LP(This is not the same as saving the old partition table:a readable version of the old partition table can be savedusing the \-d option. However, if you create logical partitions,the sectors describing them are located somewhere on disk,possibly on sectors that were not part of the partition tablebefore. Thus, the information the \-O option saves is not a binaryversion of the output of \-d.)There are many options..SH OPTIONS.TP.BR \-v " or " \-\-versionPrint version number of.B sfdiskand exit immediately..TP.BR \-? " or " \-\-helpPrint a usage message and exit immediately..TP.BR \-T " or " \-\-list\-typesPrint the recognized types (system Id's)..TP.BR \-s " or " \-\-show\-sizeList the size of a partition..TP.BR \-g " or " \-\-show\-geometryList the kernel's idea of the geometry of the indicated disk(s)..TP.BR \-l " or " \-\-listList the partitions of a device..TP.BR \-dDump the partitions of a device in a format useful as inputto sfdisk. For example,.br.nf.if t .ft CW    % sfdisk -d /dev/hda > hda.out    % sfdisk /dev/hda < hda.out.if t .ft R.fiwill correct the bad last extended partition that the OS/2fdisk creates..TP.BR \-V " or " \-\-verifyTest whether partitions seem correct. (See above.).TP.BR \-i " or " \-\-incrementNumber cylinders etc. starting from 1 instead of 0..TP.BI \-N " number"Change only the single partition indicated. For example:.br.nf.if t .ft CW    % sfdisk /dev/hdb \-N5    ,,,*    %.if t .ft R.fiwill make the fifth partition on /dev/hdb bootable (`active')and change nothing else. (Probably this fifth partitionis called /dev/hdb5, but you are free to call it something else,like `/my_equipment/disks/2/5' or so)..TP.BI \-A "number"Make the indicated partition(s) active, and all others inactive..TP.BI \-c "\fR or " \-\-id " number [Id]"If no Id argument given: print the partition Id of the indicatedpartition. If an Id argument is present: change the type (Id) ofthe indicated partition to the given value.This option has the two very long forms \-\-print\-id and \-\-change\-id.For example:.br.nf.if t .ft CW    % sfdisk --print-id /dev/hdb 5    6    % sfdisk --change-id /dev/hdb 5 83    OK.if t .ft R.fifirst reports that /dev/hdb5 has Id 6, and then changes that into 83..TP.BR \-uS " or " \-uB " or " \-uC " or " \-uMAccept or report in units of sectors (blocks, cylinders, megabytes,respectively). The default is cylinders, at least when the geometryis known..TP.BR \-x " or " \-\-show\-extendedAlso list non-primary extended partitions on output,and expect descriptors for them on input..TP.BI \-C " cylinders"Specify the number of cylinders, possibly overriding what the kernel thinks..TP.BI \-H " heads"Specify the number of heads, possibly overriding what the kernel thinks..TP.BI \-S " sectors"Specify the number of sectors, possibly overriding what the kernel thinks..TP.BR \-f " or " \-\-forceDo what I say, even if it is stupid..TP.BR \-q " or " \-\-quietSuppress warning messages..TP.BR \-L " or " \-\-LinuxDo not complain about things irrelevant for Linux..TP.BR \-D " or " \-\-DOSFor DOS-compatibility: waste a little space.(More precisely: if a partition cannot contain sector 0,e.g. because that is the MBR of the device, or containsthe partition table of an extended partition, then.B sfdiskwould make it start the next sector. However, when thisoption is given it skips to the start of the next track,wasting for example 33 sectors (in case of 34 sectors/track),just like certain versions of DOS do.)Certain Disk Managers and boot loaders (such as OSBS, but notLILO or the OS/2 Boot Manager) also live in this empty space,so maybe you want this option if you use one..TP.BR \-E " or " \-\-DOS\-extendedTake the starting sector numbers of "inner" extended partitionsto be relative to the starting cylinder boundary of the outer one,(like some versions of DOS do) rather than to the starting sector(like Linux does).(The fact that there is a difference here means that one shouldalways let extended partitions start at cylinder boundaries ifDOS and Linux should interpret the partition table in the same way.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -