SPARCアーキテクチャでは、HDDの先頭にディスクラベルがあり、ディスクラベルに含まれるVTOCによりスライスが定義されている。
ディスクラベル
dklabel.hで以下のように定義されている
/* * Miscellaneous defines */ #define DKL_MAGIC 0xDABE /* magic number */ #define FKL_MAGIC 0xff /* magic number for DOS floppies */ #define DKMAP 8 /* # of logical partitions */ /* * Format of a Sun SMD disk label. * Resides in cylinder 0, head 0, sector 0. * * sizeof (struct dk_label) should be 512 (sector size) */ struct dk_label { char dkl_asciilabel[128]; /* for compatibility */ char dkl_pad[512-(128+NDKMAP*8+14*2)]; unsigned short dkl_rpm; /* rotations per minute */ unsigned short dkl_pcyl; /* # physical cylinders */ unsigned short dkl_apc; /* alternates per cylinder */ unsigned short dkl_obs1; /* obsolete */ unsigned short dkl_obs2; /* obsolete */ unsigned short dkl_intrlv; /* interleave factor */ unsigned short dkl_ncyl; /* # of data cylinders */ unsigned short dkl_acyl; /* # of alternate cylinders */ unsigned short dkl_nhead; /* # of heads in this partition */ unsigned short dkl_nsect; /* # of 512 byte sectors per track */ unsigned short dkl_obs3; /* obsolete */ unsigned short dkl_obs4; /* obsolete */ /* */ struct dk_map { /* logical partitions */ daddr_t dkl_cylno; /* starting cylinder */ daddr_t dkl_nblk; /* number of blocks */ } dkl_map[NDKMAP]; unsigned short dkl_magic; /* identifies this label format */ unsigned short dkl_cksum; /* xor checksum of sector */ };
ディスクラベルを読み出してみる
# dd if=/dev/rdsk/c0t0d0s2 of=disk_label count=1
読み出した実際のデータを定義に当てはめてみる
dkl_asciilabel = "ST320011A cyl 38790 alt 2 hd 16 sec 63" dkl_pad = ....... dkl_rpm = 0x1518 = 5400 dkl_pcyl = 0x9788 = 38792 dkl_apc = 0x0000 dkl_obs1 = 0x0000 dkl_obs2 = 0x0000 dkl_intrlv = 0x0001 dkl_ncyl = 0x9786 = 38790 dkl_acyl = 0x0002 dkl_nhead = 0x0010 = 16 dkl_nsect = 0x003F = 63 dkl_obs3 = 0x0000 dkl_obs4 = 0x0000 dkl_map[0].dkl_cylno = 0x00002DB1 = 11697 dkl_map[0].dkl_nblk = 0x01A0B6B0 = 27309744 dkl_map[1].dkl_cylno = 0x00000000 dkl_map[1].dkl_nblk = 0x000FFF00 = 1048320 dkl_map[2].dkl_cylno = 0x00000000 dkl_map[2].dkl_nblk = 0x02549FA0 = 39100320 dkl_map[3].dkl_cylno = 0x00000000 dkl_map[3].dkl_nblk = 0x00000000 dkl_map[4].dkl_cylno = 0x00000000 dkl_map[4].dkl_nblk = 0x00000000 dkl_map[5].dkl_cylno = 0x00000000 dkl_map[5].dkl_nblk = 0x00000000 dkl_map[6].dkl_cylno = 0x00000000 dkl_map[6].dkl_nblk = 0x00000000 dkl_map[7].dkl_cylno = 0x00000410 = 1040 dkl_map[7].dkl_nblk = 0x00A3E9F0 = 10742256 dkl_magic = 0xDABE dkl_cksum = 0x002A
prtvtocコマンドから得られる値
# prtvtoc /dev/rdsk/c0t0d0s2
* /dev/rdsk/c0t0d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 63 sectors/track
* 16 tracks/cylinder
* 1008 sectors/cylinder
* 38792 cylinders
* 38790 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 11790576 27309744 39100319 /
1 3 01 0 1048320 1048319
2 5 00 0 39100320 39100319
7 8 00 1048320 10742256 11790575 /export/home
実はVTOCはもうオワコン気味で、2TBを超えるHDDを扱う場合は下記を参照。
0 件のコメント:
コメントを投稿