How to access a Solaris partition from Windows or Linux

by Bernd Schemmer, Last Update: December 2008

17.04.2012/bs: Checked and corrected the links

Homepage: http://www.bnsmb.de/

Table of contents

  1. How to access a Solaris partition from Windows or Linux
    1. Overview
    2. Part 1 - Accessing the Solaris partition from within Windows
    3. Part 2 - Accessing the Solaris partition from within Linux

Overview

This article discusses a method to read and write data from Solaris partitions from within Windows or Linux.

Part 1 - Accessing the Solaris partition from within Windows

Unfortunately Windows can not read Solaris partitions. Therefore you can not read the data from a Solaris partition from within Windows on a PC with dual boot (Solaris and Windows) configuration .

To get around this you can use the Virtual PC Emulator Qemu and the Milax Live CD.

Download the Qemu binary for Windows from

http://homepage3.nifty.com/takeda-toshiya/qemu/

(The Qemu homepage is http://wiki.qemu.org/Index.html)

and the Milax Live CD from

http://www.milax.org/?page_id=9

unpack the Qemu archive (there's no installation neccessary for Qemu), copy the Milax ISO image, milax03.iso, to the directory with Qemu and start a Virtual machine for Milax with the command

cd <directory_with_the_qemu_binary>

qemu.exe  -L ".\bios" -m 256 -localtime  -boot d -cdrom ./milax03.iso  -hda \\\\.\\physicaldrive0 -net user -net nic,model=rtl8139 -redir tcp:1135::22 -name "Milax_(ssh_port:_1135)" -snapshot


Notes:

The parameter "-snapshot" means "write to temporary files instead of disk image files". That means that Qemu does NOT write to the harddisk. If you want to write Added by bnsmb, last edited by bnsmb on Nov 08, 2009 your changes to the harddisk to can switch to the Qemu CLI with the key combination ctrl-alt-2 and issue the Qemu command "commit ide0-hd0" any time you like (see the Qemu documentation for details). To switch back to the Virtual Machine use the key combination ctrl-alt-1. You should NEVER use Qemu with access to real harddisks WITHOUT the parameter -snapshot!

You must use a double backslash for a backslash for Qemu 0.9.1

The number in the parameter "\\\\.
physicaldrive0" specifies the disk to use - if Solaris is not on the first harddisk replace 0 with the approbiate number.

This syntax works on Windows XP (tested) and should work Windows 2000 also. There are messages in the Qemu forum that this syntax does not work in Vista - I can not check this because I do not have Vista.

Now you can access the files on the SolarisAdded by bnsmb, last edited by bnsmb on Nov 08, 2009 partition in the Virtual Machine.

To access the Virtual Machine from your Windows host use

ssh -l alex -p 1135 localhost

or with scp

scp -p 1135  alex@localhost:/etc/release .

Notes:

I've only tested this with Qemu 0.9.1 - this may or may not work with older Qemu Versions.

Part 2 - Accessing the Solaris partition from within Linux

In Linux the workaround described above is not neccessary for Solaris slices with UFS filesystem because most Linux distributions have at least read-only access for Solaris partitions and UFS builtin:

Example:

Use dmesg to list the device names for the Solaris slices:

root@tp61p:~# dmesg | grep sdaAdded by bnsmb,
      last edited by bnsmb on Nov 08, 2009 

[   23.652384] sd 2:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

[   23.652393] sd 2:0:0:0: [sda] Write Protect is off

[   23.652394] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00

[   23.652403] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[   23.652434] sd 2:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

[   23.652439] sd 2:0:0:0: [sda] Write Protect is off

[   23.652441] sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00

[   23.652449] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[   23.652451]  sda:sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray

[   23.677465]  sda1 sda2 sda3 sda4 < sda5 sda6 sda7 >

[   23.705547]  sda1: <solaris: [s0] sda8 [s1] sda9 [s2] sda10 [s3] sda11 [s4] sda12 [s6] sda13 [s7] sda14 >

[   23.706865] sd 2:0:0:0: [sda] Attached SCSI disk

[   28.739904] Adding 4128664k swap on /dev/sda6.  Priority:-1 extents:1 across:4128664k

[   28.945181] EXT3 FS on sda3, internal journal

[   30.894480] EXT3 FS on sda5, internal journal

root@tp61p:~#

In this example the slices on the Solaris partition can be accessed by the Linux device names

Slice 	Linux device name

--------------------------------------------

s0 		sda8

s1 		sda9

s2 		sda10

s3 		sda11

s4 		sda12

s6 		sda13

s7 		sda14

There's no Linux device for the slice 5 here because this slice is not used in Solaris (the size of the slice is 0)

To mount the slice use:


root@tp61p:~# mount -t ufs -o ro /dev/sda8 /mnt
root@tp61p:~# df -k /mnt

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda8             11098457   9442316   1545157  86% /mnt
root@tp61p:~# ls /mnt

alternate_root  Desktop    home        milax03.usb         mnt21                   pool           test_root
bin             dev        kernel      milax.compressed    modinfo.out             proc           tmp
boot            devices    lib         milax.uncompressed  nautilus-debug-log.txt  root           usbcopy
BSITscite.pkg   Documents  lost+found  mnt                 net                     sbin           usr
cdrom           etc        media       mnt1                opt                     sol10hvm.save  var
data            export     milax       mnt2                platform                system         xen



If you need write access to the Solaris slices (and your Linux distribution does not support write access for UFS) or if you're using ZFS under Solaris you can start Qemu in Linux to access the data on the Solaris partition:

qemu -net user -net nic -usb -usbdevice tablet -L "/usr/local/share/qemu"  -boot d \

                        -m 512 -net nic,model=rtl8139 -redir tcp:1135::22 \

			-name "Milax_(user_network)_(ssh_port:_1135)" \

                        -hda /dev/sda -cdrom ./milax03.iso -snapshot

Notes

/dev/sda is the disk (not the partition!) with the Solaris partition

The parameter "-snapshot" means "write to temporary files instead of disk image files". That means that Qemu does NOT write to the harddisk. If you want to write your changes to the harddisk to can switch to the Qemu CLI with the key combination ctrl-alt-2 and issue the Qemu command "commit ide0-hd0" any time you like (see the Qemu documentation for details). To switch back to the Virtual Machine use the key combination ctrl-alt-1. You should NEVER use Qemu with access to real harddisks WITHOUT the parameter -snapshot!