Bug 78114 - [geom] [patch] Solaris/x86 label structures for GEOM (sect 0 attached)
Summary: [geom] [patch] Solaris/x86 label structures for GEOM (sect 0 attached)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 5.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-26 13:40 UTC by Wojciech A. Koszek
Modified: 2017-12-31 22:32 UTC (History)
1 user (show)

See Also:


Attachments
sunx86label.tar.gz (7.81 KB, text/plain)
2005-02-26 13:40 UTC, Wojciech A. Koszek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wojciech A. Koszek 2005-02-26 13:40:12 UTC
At the time of writing this text, there is no way to read Solaris/x86 labels on FreeBSD.
There is support for Solaris disks partitioned on Sparc, but none for x86.
I've decided to trace this problem, and results are placed here. Attached
archive [sunx86label.tar.gz] contains:
+ file geom_sunx86label_enc.c which may be used by
  either kernel or user land software. It contains two functions for
  encoding/decoding label inforamtion, and 2 for debugging (which may be removed, of
  course).
+ corrected /sys/sys/sun_disklabel.h (and patch [diff.0.sun_disklabel.h] for
  existing one) which makes it possible to map label sector to structure.
+ sample program readsunlabel.c for reading sector with label information
  (on slice with Solaris/x86 it's 2nd sector).
+ example of sector [BOOT] with label information (as far as I remember, requested
  by phk@.. on freebsd-geom@..).
+ Makefile to build sample code and test it.

I hope you'll find it useful. Comments needed.

Fix: Attached patch [diff.0.sun_disklabel.h] should add structures to
/sys/sys/sun_disklabel.h needed by geom_sunx86label_enc.c.
geom_sunx86label_enc.c might be useful while writing GEOM support for
Solaris/x86 labels.

How-To-Repeat: Unpack sunx86label.tar.gz from attachment:
	$ tar xzf sunx86label.tar.gz
Build application:
	$ cd sunx86label
	$ make
Run it:
	$ ./readsunlabel
              Sanity: 0x600ddeee
       Label version: 1
         Volume name: <'XYXYXYXY'>
         Sector size: 512
Number of pertitions: 16
          ASCII name: 'DEFAULT cyl 10157 alt 2 hd 64 sec 63'
  Label magic number: '0xdabe'
      Label checksum: '0x75eb'
--
(pcyl = 10159, ncyl = 10157, acyl = 2, bcyl = 0)
(tracks = 64, sectors = 63, interleave = 1, alterc = 0)
(rpm = 3600, skipwrites = 0, skipreads = 0)
Partitions:
Number	Tag	Flag	Cylinder offset		Number of sectors
0	0	0	0			0
1	0	0	0			0
2	5	0	0			40953024
3	2	0	12096			40940928
4	0	0	0			0
5	0	0	0			0
6	0	0	0			0
7	0	0	0			0
8	1	1	0			4032
9	9	1	4032			8064
10	0	0	0			0
11	0	0	0			0
12	0	0	0			0
13	0	0	0			0
14	0	0	0			0
15	0	0	0			0
Magic: 0, t->magic = dabe
Magic: dabe, t->magic = dabe
              Sanity: 0x600ddeee
       Label version: 1
         Volume name: <'XYXYXYXY'>
         Sector size: 512
Number of pertitions: 16
          ASCII name: 'DEFAULT cyl 10157 alt 2 hd 64 sec 63'
  Label magic number: '0xdabe'
      Label checksum: '0x75eb'
--
(pcyl = 10159, ncyl = 10157, acyl = 2, bcyl = 0)
(tracks = 64, sectors = 63, interleave = 1, alterc = 0)
(rpm = 3600, skipwrites = 0, skipreads = 0)
Partitions:
Number	Tag	Flag	Cylinder offset		Number of sectors
0	0	0	0			0
1	0	0	0			0
2	5	0	0			40953024
3	2	0	12096			40940928
4	0	0	0			0
5	0	0	0			0
6	0	0	0			0
7	0	0	0			0
8	1	1	0			4032
9	9	1	4032			8064
10	0	0	0			0
11	0	0	0			0
12	0	0	0			0
13	0	0	0			0
14	0	0	0			0
15	0	0	0			0
(disk doesn't contain swap space). 

Here is an example how can you fetch needed information from Solaris slice.
[..]
dunstan@dunstan:~:% fdisk -3 ad3
[..]
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 3 is:
sysid 130 (0x82),(Linux swap or Solaris x86)
    start 1987776, size 40961088 (20000 Meg), flag 0
	        beg: cyl 1022/ head 254/ sector 63;
	        end: cyl 1022/ head 254/ sector 63
[..]

dunstan@dunstan:~:% dd if=/dev/ad3s3 bs=512 count=1 skip=1 of=BOOT
1+0 records in
1+0 records out
512 bytes transferred in 0.026144 secs (19584 bytes/sec)

Now running readsunlabel should show your label layout.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2005-04-03 09:36:48 UTC
Responsible Changed
From-To: freebsd-bugs->phk

Over to maintainer.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2011-09-24 18:44:18 UTC
Responsible Changed
From-To: phk->freebsd-bugs

return to the pool (approved by phk)
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:25 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped