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

📄 sfdisk.8

📁 Util-linux 软件包包含许多工具。其中比较重要的是加载、卸载、格式化、分区和管理硬盘驱动器
💻 8
📖 第 1 页 / 共 2 页
字号:
Of course one can only know where cylinder boundaries are whenone knows what geometry DOS will use for this disk.).TP.BR \-\-IBM " or " \-\-leave\-lastCertain IBM diagnostic programs assume that they can use thelast cylinder on a disk for disk-testing purposes. If you thinkyou might ever run such programs, use this option to tell.B sfdiskthat it should not allocate the last cylinder.Sometimes the last cylinder contains a bad sector table..TP.B \-nGo through all the motions, but do not actually write to disk..TP.B \-ROnly execute the BLKRRPART ioctl (to make the kernel re-readthe partition table). This can be useful for checking in advancethat the final BLKRRPART will be successful, and also when youchanged the partition table `by hand' (e.g., using dd from a backup).If the kernel complains (`device busy for revalidation (usage = 2)')then something still uses the device, and you still have to unmountsome file system, or say swapoff to some swap partition..TP.B \-\-no\-rereadWhen starting a repartitioning of a disk, sfdisk checks that this diskis not mounted, or in use as a swap device, and refuses to continueif it is. This option suppresses the test. (On the other hand, the \-foption would force sfdisk to continue even when this test fails.).TP.BI \-O " file"Just before writing the new partition, output the sectorsthat are going to be overwritten to.I file(where hopefully.I fileresides on another disk, or on a floppy)..TP.BI \-I " file"After destroying your filesystems with an unfortunate.B sfdiskcommand, you would have been able to restore the old situationif only you had preserved it using the \-O flag..SH THEORYBlock 0 of a disk (the Master Boot Record) contains amongother things four partition descriptors. The partitionsdescribed here are called.I primarypartitions..LPA partition descriptor has 6 fields:.br.nf.RSstruct partition {    unsigned char bootable;		/* 0 or 0x80 */    hsc begin_hsc;    unsigned char id;    hsc end_hsc;    unsigned int starting_sector;    unsigned int nr_of_sectors;}.RE.fi.LPThe two hsc fields indicate head, sector and cylinder of thebegin and the end of the partition. Since each hsc field onlytakes 3 bytes, only 24 bits are available, which does notsuffice for big disks (say > 8GB). In fact, due to the wastefulrepresentation (that uses a byte for the number of heads, whichis typically 16), problems already start with 0.5GB.However Linux does not use these fields, and problems can ariseonly at boot time, before Linux has been started. For moredetails, see the.B lilodocumentation..LPEach partition has a type, its `Id', and if this type is 5 or f.IR "" "(`" "extended partition" "')"the starting sector of the partitionagain contains 4 partition descriptors. MSDOS only uses thefirst two of these: the first one an actual data partition,and the second one again an extended partition (or empty).In this way one gets a chain of extended partitions.Other operating systems have slightly different conventions.Linux also accepts type 85 as equivalent to 5 and f - this can beuseful if one wants to have extended partitions under Linux pastthe 1024 cylinder boundary, without DOS FDISK hanging.(If there is no good reason, you should just use 5, which isunderstood by other systems.).LPPartitions that are not primary or extended are called.IR logical .Often, one cannot boot from logical partitions (because theprocess of finding them is more involved than just lookingat the MBR).Note that of an extended partition only the Id and the startare used. There are various conventions about what to writein the other fields. One should not try to use extended partitionsfor data storage or swap..SH "INPUT FORMAT".B sfdiskreads lines of the form.br.RS<start> <size> <id> <bootable> <c,h,s> <c,h,s>.REwhere each line fills one partition descriptor..LPFields are separated by whitespace, or comma or semicolon possiblyfollowed by whitespace; initial and trailing whitespace is ignored.Numbers can be octal, decimal or hexadecimal, decimal is default.When a field is absent or empty, a default value is used..LPThe <c,h,s> parts can (and probably should) be omitted -.B sfdiskcomputes them from <start> and <size> and the disk geometryas given by the kernel or specified using the \-H, \-S, \-C flags..LPBootable is specified as [*|\-], with as default not-bootable.(The value of this field is irrelevant for Linux - when Linuxruns it has been booted already - but might play a role forcertain boot loaders and for other operating systems.For example, when there are several primary DOS partitions,DOS assigns C: to the first among these that is bootable.).LPId is given in hex, without the 0x prefix, or is [E|S|L|X], whereL (LINUX_NATIVE (83)) is the default, S is LINUX_SWAP (82), Eis EXTENDED_PARTITION (5), and X is LINUX_EXTENDED (85)..LPThe default value of start is the first nonassigned sector/cylinder/....LPThe default value of size is as much as possible (until nextpartition or end-of-disk)..LPHowever, for the four partitions inside an extended partition,the defaults are: Linux partition, Extended partition, Empty, Empty..LPBut when the \-N option (change a single partition only) is given,the default for each field is its previous value..SH EXAMPLEThe command.RS.nf.if t .ft CWsfdisk /dev/hdc << EOF0,407,407;;EOF.if t .ft R.fi.REwill partition /dev/hdc just as indicated above.The command.RS.nf.if t .ft CWsfdisk /dev/hdb << EOF,3,L,60,L,19,S,,E,130,L,130,L,130,L,,LEOF.if t .ft R.fi.REwill partition /dev/hdb into two Linux partitions of 3 and 60cylinders, a swap space of 19 cylinders, and an extended partitioncovering the rest. Inside the extended partition there are fourLinux logical partitions, three of 130 cylinders and onecovering the rest.With the \-x option, the number of input lines must be a multiple of 4:you have to list the two empty partitions that you never wantusing two blank lines. Without the \-x option, you give one linefor the partitions inside a extended partition, instead of four,and terminate with end-of-file (^D).(And.B sfdiskwill assume that your input line represents the first of four,that the second one is extended, and the 3rd and 4th are empty.).SH "DOS 6.x WARNING"The DOS 6.x FORMAT command looks for some information in the firstsector of the data area of the partition, and treats this informationas more reliable than the information in the partition table.  DOSFORMAT expects DOS FDISK to clear the first 512 bytes of the data areaof a partition whenever a size change occurs.  DOS FORMAT will look atthis extra information even if the /U flag is given -- we considerthis a bug in DOS FORMAT and DOS FDISK..LPThe bottom line is that if you use sfdisk to change the size of aDOS partition table entry, then you must also use.B ddto zero the first 512 bytes of that partition before using DOS FORMAT toformat the partition.  For example, if you were using sfdisk to make a DOSpartition table entry for /dev/hda1, then (after exiting sfdisk andrebooting Linux so that the partition table information is valid) youwould use the command "dd if=/dev/zero of=/dev/hda1 bs=512 count=1" to zerothe first 512 bytes of the partition..B BE EXTREMELY CAREFULif you use the.B ddcommand, 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 tableprogram.  For example, you should make DOS partitions with the DOS FDISKprogram and Linux partitions with the Linux sfdisk program..SH "DRDOS WARNINGS"Stephen Tweedie reported (930515): `Most reports of superblockcorruption turn out to be due to bad partitioning, with one filesystemoverrunning the start of the next and corrupting its superblock.I have even had this problem with the supposedly-reliable DRDOS.  Thiswas quite possibly due to DRDOS-6.0's FDISK command.  Unless I createda blank track or cylinder between the DRDOS partition and theimmediately following one, DRDOS would happily stamp all over thestart of the next partition.  Mind you, as long as I keep a littlefree disk space after any DRDOS partition, I don't have any otherproblems with the two coexisting on the one drive.'A. V. Le Blanc writes in README.efdisk: `Dr. DOS 5.0 and 6.0 has beenreported to have problems cooperating with Linux, and with this versionof efdisk in particular.  This efdisk sets the system typeto hexadecimal 81.  Dr. DOS seems to confusethis with hexadecimal 1, a DOS code.  If you use Dr. DOS, use theefdisk command 't' to change the system code of any Linux partitionsto some number less than hexadecimal 80; I suggest 41 and 42 forthe moment.'A. V. Le Blanc writes in his README.fdisk: `DR-DOS 5.0 and 6.0are reported to have difficulties with partition ID 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.'In fact, it seems that only 4 bits are significant for the DRDOS FDISK,so that for example 11 and 21 are listed as DOS 2.0. However, DRDOSitself seems to use the full byte. I have not been able to reproduceany corruption with DRDOS or its fdisk..SH BUGSA corresponding interactive.B cfdisk(with curses interface) is still lacking..LPThere are too many options..LPThere is no support for non-DOS partition types..SH AUTHORA. E. Brouwer (aeb@cwi.nl).SH "SEE ALSO".BR cfdisk (8),.BR fdisk (8),.BR mkfs (8),.BR parted (8)

⌨️ 快捷键说明

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