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

📄 hd.4

📁 Unix操作系统minix 2.0源码
💻 4
字号:
.TH HD 4.SH NAMEhd \- winchester hard disk.SH DESCRIPTIONThe.B hd*family of devices refer to the Winchester hard disk drivers forthe IBM XT, AT and PS/2 machines, but may also refer to the generic (andslower) BIOS based hard disk driver.  These disks are arrays of 512 bytesectors, although Minix always works with two sectors at a time due to its1024 byte block size.  You can read or write any number of bytes however,Minix takes care of cutting and pasting incomplete blocks together..PPThe devices may be divided into three classes:.sp.RSThe devices with a minor device number that is a multiple of 5, i.e..B hd0or.BR hd5 ,refer to the whole hard disk 0 and 1.  Through these devices one has accessto any block on the hard disk.  Most notably the partition table, that canbe found in the first sector of the disk..spThe devices with a minor device number that is not a multiple of 5, i.e..BR hd1 ,.BR hd2 ,\&...,.BR hd6 ,\&..., refer to primary partitions of the lower numbered whole hard diskdevice.  These devices normally contain MS-DOS or Minix file systems./dev/hd1 is often the MS-DOS C: drive..spMinor devices from 128 up may refer to Minix subpartitions within primarypartitions if a subpartition table has been placed in a Minix primarypartition.  The subpartitions of.B hd3for instance, are named.B hd3athrough.BR hd3d .Their minor device numbers may be calculated as128 + 16*drive + 4*partition + subpartition, counting the partitionsfrom zero..PPIf a primary partition is an extended partition then up to four logicalpartitions can be accessed as subpartitions of that extended partition.This allows one to access foreign file systems of other operating systems,Minix file systems are not normally placed in logical partitions..SH PARTITIONINGThe first sector of a drive (or partition for subpartitioning) contains thepartition table at byte offset 446.  This is what each of the four entrieslooks like as defined in <ibm/partition.h>:.sp.nf.ta +2n +29n +37n/* Description of entry in the partition table.  */struct part_entry {	unsigned char bootind;	/* boot indicator 0/ACTIVE_FLAG	*/	unsigned char start_head;	/* head value for first sector	*/	unsigned char start_sec;	/* sector value + high 2 cyl bits	*/	unsigned char start_cyl;	/* low 8 cylinder bits	*/	unsigned char sysind;	/* system indicator	*/	unsigned char last_head;	/* h/s/c for the last sector	*/	unsigned char last_sec;	unsigned char last_cyl;	unsigned long lowsec;	/* logical first sector	*/	unsigned long size;	/* size of partition in sectors	*/};.ta +24n +7n +37n#define ACTIVE_FLAG	0x80	/* value for active in bootind field	*/#define NR_PARTITIONS	4	/* number of entries in table	*/#define PART_TABLE_OFF	0x1BE	/* offset of table in boot sector	*//* Partition types (sysind). */#define MINIX_PART	0x81	/* Minix partition type */#define NO_PART	0x00	/* unused entry */#define OLD_MINIX_PART	0x80	/* created before 1.4b, obsolete */#define EXT_PART	0x05	/* extended partition */.fi.PPThe cylinder numbers are encoded in a very strange way, bits 8 and 9 arein the high two bits of the sector number.  The sector numbers count from 1,not 0!  More useful are the lowsec and size fields however, they simply givethe location of the partition as an absolute sector offset and length withinthe drive..PPThe partition table entry defined above is specific to IBM type disks.  Thedevice drivers use another partition entry structure to pass information ona partition.  This is what <minix/partition.h> looks like:.sp.nf.ta +2n +25nstruct partition {	u64_t base;	/* byte offset to the partition start */	u64_t size;	/* number of bytes in the partition */	unsigned cylinders;	/* disk geometry for partitioning */	unsigned heads;	unsigned sectors;};.fi.PPThe base and size fields are the byte offset and length of a partition.(These are 64 bit numbers under Minix-vmd, but only 32 bit numbers understandard Minix.)  The geometry of the disk is also given for the benefit ofpartition table editors.  This information can be obtained from an open diskdevice with the call:.sp.RS.ft Bioctl(\fIfd\fP, DIOCGETP, &\fIentry\fP);.ft R.RE.spOne can change the placement of the device to the lowsec and size fields of.I entryby using the.B DIOCSETPcall instead.  Only the base and size fields are used for.BR DIOCSETP ..PPThe partition tables when read from disk by the driver are checked andtruncated to fit within the primary partition or drive.  The first sectorshould be left free for the partition table..PPThe partition tables are read when the in-use count (opens and mounts)changes from 0 to 1.  So an idle disk is automatically repartitioned on thenext access.  This means that repartitioning programs only have effect if adisk stays in use, unless they reload a changed partition table..SH FILES/dev/hd[0\-9], /dev/hd[1\-46\-9][a\-d].SH "SEE ALSO".BR ioctl (2),.BR int64 (3),.BR part (8),.BR repartition (8)..SH BUGSThe subpartitioning is incompatible with the MS-DOS method of extendedpartitions.  The latter does not map well to the sparse minor device numberspace..PPThe primary partition table is sorted by lowsec like MS-DOS does, subpartitiontables are not.  Just think about what happens when you delete a partition inthe MS-DOS scheme..PPDon't move a partition that is mounted or kept open by some process.  Thefile system may write cached blocks to the new location..PPThe BIOS driver is not slow at all on a buffered disk..PPSome IDE disks send an interrupt when they spin down under hardware powermanagement.  The driver acknowledges the interrupt as it is supposed to do byreading the status register.  The disk then spins up again...  You have todisable the spin down in the computer setup to fix the problem..SH AUTHORKees J. Bot (kjb@cs.vu.nl)

⌨️ 快捷键说明

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