View Source

!http://www.sun.com/bigadmin/home/images/bigadminHeaderWikiThumb.jpg!

{section:border=false}
{column:width=20%}

{include:TOC for Tech Tips}

{column}
{column:width=55%}

h1. How to access a Solaris partition from Windows or Linux

by Bernd Schemmer, Last Update: December 2008

Homepage: [http://www.bnsmb.de/|http://www.bnsmb.de/]

*Table of contents*
{toc}

h1. Overview

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

h1. 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://www1.interq.or.jp/~t-takeda/qemu/]

(The Qemu homepage is [http://fabrice.bellard.free.fr/qemu/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
\\
{code}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


{code}{*}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 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 Solaris partition in the Virtual Machine.

To access the Virtual Machine from your Windows host use
{code}ssh -l alex -p 1135 localhost
{code}or with scp
{code}scp -p 1135 alex@localhost:/etc/release .
{code}{*}Notes:*

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

h1. 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:
{code}root@tp61p:~# dmesg | grep sda

[ 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:~#
{code}In this example the slices on the Solaris partition can be accessed by the Linux device names
{noformat}Slice Linux device name

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

s0 sda8

s1 sda9

s2 sda10

s3 sda11

s4 sda12

s6 sda13

s7 sda14
{noformat}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:
\\
\\
\\
{code}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
{code}\\
\\

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:
{code}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
{code}{*}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\!
\\


{column}
{column:width=25%}

{include:Links for Tech Tips by Technology}


{column}

{section}

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact