Formatting disks for Solaris

This applies to Qemu and real SPARC’s… Anyways, every disk that Solaris uses has to be tagged with a special ‘format’ and disk label for use. When you buy disks from SUN they did this at the factory. However if you go ahead with a 3rd party disk, you’ll have to do this yourself.

Luckily it’s not all that hard.

So in this quick example we’ll add a 36GB disk to Qemu for use with Solaris 2.6

Now I’ve had issues with Solaris 2.6’s format program so I also use a Solaris 8 CD for that portion. I’m going to assume you’ve got all the bits to make Solaris on Qemu work.

The first step is to create the hard disk.

$ ./qemu-img create -f qcow2 36GB.disk 36GB
Formatting ’36GB.disk’, fmt=qcow2 size=38654705664 encryption=off cluster_size=0

I’m running this on OS X, however the steps are all the same for Linux & Windows users.

Now the next step is to fire up Qemu with the Solaris 8 CDROM.

$ ./qemu-system-sparc -bios ss5.bin -nographic -L . -hda 36GB.disk -m 256 -M SS-5 -cdrom sol-8-u7-install-sparc.iso

Then the ROM will initialize:

Power-ON Reset

$$$$$ WARNING: No Keyboard Detected! $$$$$
MMU Context Table Reg Test
MMU Context Register Test
MMU TLB Replace Ctrl Reg Tst
MMU Sync Fault Stat Reg Test
MMU Sync Fault Addr Reg Test
MMU TLB RAM NTA Pattern Test
ERROR : Address= 000000fc, exp= 07ffffdc, obs= 00000000, xor= 07ffffdc
initializing TLB
initializing cache

Allocating SRMMU Context Table
Setting SRMMU Context Register
Setting SRMMU Context Table Pointer Register
Allocating SRMMU Level 1 Table
Mapping RAM
Mapping ROM

ttya initialized
Probing Memory Bank #0 32 Megabytes
Probing Memory Bank #1 32 Megabytes
Probing Memory Bank #2 32 Megabytes
Probing Memory Bank #3 32 Megabytes
Probing Memory Bank #4 32 Megabytes
Probing Memory Bank #5 32 Megabytes
Probing Memory Bank #6 32 Megabytes
Probing Memory Bank #7 32 Megabytes
Incorrect configuration checksum;
Setting NVRAM parameters to default values.
Setting diag-switch? NVRAM parameter to true
Probing CPU FMI,MB86904
Probing /iommu@0,10000000/sbus@0,10001000 at 5,0 espdma esp sd st SUNW,bpp ledma le
Probing /iommu@0,10000000/sbus@0,10001000 at 4,0 SUNW,CS4231 power-management
Probing /iommu@0,10000000/sbus@0,10001000 at 1,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 2,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 3,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 0,0 Nothing there
screen not found.
Can’t open input device.
Keyboard not present. Using tty for input and output.
Probing Memory Bank #0 32 Megabytes
Probing Memory Bank #1 32 Megabytes
Probing Memory Bank #2 32 Megabytes
Probing Memory Bank #3 32 Megabytes
Probing Memory Bank #4 32 Megabytes
Probing Memory Bank #5 32 Megabytes
Probing Memory Bank #6 32 Megabytes
Probing Memory Bank #7 32 Megabytes
Incorrect configuration checksum;
Setting NVRAM parameters to default values.
Setting diag-switch? NVRAM parameter to true
Probing CPU FMI,MB86904
Probing /iommu@0,10000000/sbus@0,10001000 at 5,0 espdma esp sd st SUNW,bpp ledma le
Probing /iommu@0,10000000/sbus@0,10001000 at 4,0 SUNW,CS4231 power-management
Probing /iommu@0,10000000/sbus@0,10001000 at 1,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 2,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 3,0 Nothing there
Probing /iommu@0,10000000/sbus@0,10001000 at 0,0 Nothing there

SPARCstation 5, No Keyboard
ROM Rev. 2.15, 256 MB memory installed, Serial #0.
Ethernet address 52:54:0:12:34:56, Host ID: 80000000.

Boot device: /iommu/sbus/ledma@5,8400010/le@5,8c00000 File and args:
Internal loopback test — Wrong packet length; expected 36, observed 64

Can’t open boot device

Type help for more information
ok

Now we boot off the CD-ROM, but into single user mode, with the verbose flag…

ok boot disk2:d -vs

Now the kernel will boot up, and dump us into single user mode. Take note about the disk having a “corrupt label – wrong magic number’ error.

Boot device: /iommu/sbus/espdma@5,8400000/esp@5,8800000/sd@2,0:d File and args: -vs
Size: 259712+54162+47510 Bytes
SunOS Release 5.8 Version Generic_108528-13 32-bit
Copyright 1983-2001 Sun Microsystems, Inc. All rights reserved.
Ethernet address = 52:54:0:12:34:56
Using default device instance data
vac: enabled in write through mode
mem = 262144K (0x10000000)
avail mem = 258383872
root nexus = SUNW,SPARCstation-5
iommu0 at root: obio 0x10000000
sbus0 at iommu0: obio 0x10001000
dma0 at sbus0: SBus slot 5 0x8400000
dma0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000
/iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000 (esp0):
esp-options=0x46
esp0 at dma0: SBus slot 5 0x8800000 sparc ipl 4
esp0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000
sd0 at esp0: target 0 lun 0
sd0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0
WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks
sd2 at esp0: target 2 lun 0
sd2 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@2,0
root on /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@2,0:b fstype ufs
obio0 at root
obio0 at obio0: obio 0x100000, sparc ipl 12
zs0 is /obio/zs@0,100000
obio1 at obio0: obio 0x0, sparc ipl 12
zs1 is /obio/zs@0,0
cpu0: FMI,MB86904 (mid 0 impl 0x0 ver 0x4 clock 1200 MHz)
Configuring /dev and /devices
pseudo-device: devinfo0
devinfo0 is /pseudo/devinfo@0
ledma0 at sbus0: SBus slot 5 0x8400010
le0 at ledma0: SBus slot 5 0x8c00000 sparc ipl 6
le0 is /iommu@0,10000000/sbus@0,10001000/ledma@5,8400010/le@5,8c00000
pseudo-device: fssnap0
fssnap0 is /pseudo/fssnap@0
sbusmem0 at sbus0: SBus slot 0 0x0
sbusmem0 is /iommu@0,10000000/sbus@0,10001000/sbusmem@0,0
sbusmem1 at sbus0: SBus slot 1 0x0
sbusmem1 is /iommu@0,10000000/sbus@0,10001000/sbusmem@1,0
sbusmem2 at sbus0: SBus slot 2 0x0
sbusmem2 is /iommu@0,10000000/sbus@0,10001000/sbusmem@2,0
sbusmem3 at sbus0: SBus slot 3 0x0
sbusmem3 is /iommu@0,10000000/sbus@0,10001000/sbusmem@3,0
sbusmem4 at sbus0: SBus slot 4 0x0
sbusmem4 is /iommu@0,10000000/sbus@0,10001000/sbusmem@4,0
sbusmem5 at sbus0: SBus slot 5 0x0
sbusmem5 is /iommu@0,10000000/sbus@0,10001000/sbusmem@5,0
NOTICE: SBus clock frequency out of range.
pseudo-device: winlock0
winlock0 is /pseudo/winlock@0
pseudo-device: lockstat0
lockstat0 is /pseudo/lockstat@0
pseudo-device: llc10
llc10 is /pseudo/llc1@0
NOTICE: audiocs0:Couldn’t set value (../../sun/io/audio/sada/drv/audiocs/audio_4231.c, Line #1738 0x00 0x88)
audiocs0:audio may not work correctly until it is stopped and restarted
audiocs0 at sbus0: SBus slot 4 0xc000000 SBus level 5 sparc ipl 9
audiocs0 is /iommu@0,10000000/sbus@0,10001000/SUNW,CS4231@4,c000000
pseudo-device: lofi0
lofi0 is /pseudo/lofi@0
pseudo-device: fcp0
fcp0 is /pseudo/fcp@0
Using RPC Bootparams for network configuration information.
/sbin/rcS: manual_find_and_mount_cdrom: not found

INIT: SINGLE USER MODE
#

I now issue the drvconfig/disks commands. This is more useful for adding disks to a live system..

# drvconfig
NOTICE: SBus clock frequency out of range.
inst_sync failed for /etc/path_to_inst.66: Read-only file system
drvconfig: WARNING: failed to update /etc/path_to_inst
# disks
disks: mkdir failed for /dev 0x1ed: Read-only file system

Now for the fun part of ‘formatting’ the disk. Looking at this page, they give the geometry of a SCSI disk with a capacity of 36 GB as:

24,622 cylinders
27 heads
107 sectors

As a note the format program likes to reserve the last 2 cylinders, so you must answer this appropriately.

So using the above information, I run the format command like this:

# format
Searching for disks…WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks
done

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0
Specify disk (enter its number): 0

AVAILABLE DRIVE TYPES:
0. Auto configure
1. Quantum ProDrive 80S
2. Quantum ProDrive 105S
3. CDC Wren IV 94171-344
4. SUN0104
5. SUN0207
6. SUN0327
7. SUN0340
8. SUN0424
9. SUN0535
10. SUN0669
11. SUN1.0G
12. SUN1.05
13. SUN1.3G
14. SUN2.1G
15. SUN2.9G
16. Zip 100
17. Zip 250
18. other
Specify disk type (enter its number): 18
Enter number of data cylinders: 24620
Enter number of alternate cylinders[2]:
Enter number of physical cylinders[24622]:
Enter number of heads: 27
Enter physical number of heads[default]:
Enter number of data sectors/track: 107
Enter number of physical sectors/track[default]:
Enter rpm of drive[3600]:
Enter format time[default]:
Enter cylinder skew[default]:
Enter track skew[default]:
Enter tracks per zone[default]:
Enter alternate tracks[default]:
Enter alternate sectors[default]:
Enter cache control[default]:
Enter prefetch threshold[default]:
Enter minimum prefetch[default]:
Enter maximum prefetch[default]:
Enter disk type name (remember quotes): Qemu36GB
selecting c0t0d0
[disk formatted]

FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
inquiry – show vendor, product and revision
volname – set 8-character volume name
! – execute , then return
quit
format>

Finally we just slap down a label and we should be good to go. I run the command twice to make sure that it took, as it should only mention the corrupt number one more time, then it’ll be ok.

format> label
Ready to label disk, continue? y

WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
corrupt label – wrong magic number

Vendor ‘QEMU’, product ‘QEMU’, 75497472 512 byte blocks

format> l
Ready to label disk, continue? y

format>

Now we can quit, and reboot the VM.

format> q
# reboot
syncing file systems… done
rebooting…
Resetting …

And that’s it!

I’ve since then booted it up under Solaris 2.6, and now in the bootup it shows up like this:

sd0 at esp0: target 0 lun 0
sd0 is /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0

And even in the Solaris 2.6 install…

Disk Device (Size) Available Space
=============================================
[X] c0t0d0 (34730 MB) 34730 MB (F4 to edit)

Total Selected: 34730 MB
Suggested Minimum: 487 MB

And that’s about it.

This entry was posted in qemu, solaris by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I’ve loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX… I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since…!

One thought on “Formatting disks for Solaris

  1. I was referred to this page by Artom Tarasenko.

    I am trying, ultimately, to run Solaris 2.5.1 with Qemu 1.0.1 in Xubuntu 12.04. I am having issues with creating a proper disk image. I try to format the disk image with Solaris 2.5.1 (outside of 10,11 which do not load in Qemu, this is the only version of Solaris I have, however I *may* be able to pull some strings and get 8). The disk formatting fails.

    I launch qemu as such:
    qemu-system-sparc -M SS-5 -m 256 -startdate “2009-12-13” -nographic -hdb Solaris251.iso -hdc 32GB.disk

    Then, I boot into single user mode and run the format command, following the above steps. An interesting thing to note is that, when given the option to select a disk, it seems the 32GB disk is listed twice. I then follow the steps listed above. Before the label is applied, a message is given saying “No defined partition tables.” and when I do try to apply the label, it fails. The error message is:

    Illegal request during read: block 0 (0x0) (0/0/0)
    ASC: 0x21 ASCQ: 0x0
    Warning: error reading backup label.
    WARNING: /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@0,0 (sd0):
    Error for Command: read(10) Error Level: Fatal
    Requested Block: 0 Error Block: 0
    Vendor: QEMU Serial Number:
    Sense Key: Illegal Request
    ASC: 0x21 (logical block address out of range), ASCQ: 0x0, FRU: 0x0

    How can I fix this? Is another version of Solaris (such as 8, like you have demonstrated) required to do this or can I do it with 2.5.1? Is there yet another way to format this disk image?

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.