Mount Solaris Partition in Linux

filesystemsmountsolaris

I have a USB disk which when connected to a CentOS 6.5 system shows this as the output in fdisk -l.

Disk /dev/sdn: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00113504

   Device Boot      Start         End      Blocks   Id  System
/dev/sdn1   *           5      243200  1953471870   bf  Solaris    

I want to mount this file system on the system and so far it has been a nightmare. This is what I have tried.
1. Installed UFS support using elrepo. Tried all the options that ufs provides (various ufstypes).
2. Installed ZFS support. Did not really understand if I could do anything further with it.

Some of the mount commands that I tried are below. I am not listing all of them as the permutations are far too many.

mount -t ufs -oro,ufstype=ufs2 /dev/sdn1 /mnt
mount -t ufs -oro,ufstype=sunx86 /dev/sdn1 /mnt
mount -t ufs -oro,ufstype=sun /dev/sdn1 /mnt
mount -t ufs -oro,ufstype=old /dev/sdn1 /mnt

All these commands report the UFS kernel module reporting as bad magic number in dmesg.

Can anyone help? How could I mount the filesystem in Linux. Read-Only mount would be good enough.

Replies to comments:

  1. dmesg | grep -i solaris does not show anything. However, both parted and fdisk show only one partition which is sdn1.
  2. zpool status and zpool list both show "no pools available".

Best Answer

As you stated in your last comment, if I understand it correctly, that the partition mounts fine on both SPARC and x86 running Solaris 11, you can be sure this is not UFS. Big endian UFS used on SPARC hardware doesn't mount on x86 hardware and reciprocally.

That leaves hsfs, pcfs and ZFS as potential contenders, and perhaps udf too.

The simpler way would be to check on Solaris what is the file system type with either the mount or fstyp commands.

Linux should be able to mount hsfs (isofs), pcfs (vfat) and udf.

If ZFS, only zpool version 28/zfs version 5 or older can be imported/mounted on the Linux side (and possibly only zpool 23/zfs 4 if ZFS fuse).


Edit:

After you stated the file system is UFS on x86, the file system to use should ufs with ufstype=sunx86 or ufstype=sun. However, you are not using the right device.

/dev/sdn1 is the primary partition used by Solaris but this partitions is normally subdivided in underlying partitions, named slices in Solaris terminology. This is similar to logical partitions.

You should then identify what names were given to the slices by the Linux kernel by running dmesg | grep solaris and mount the right one (example if slice 5 is reported) :

mount -t ufs -oro,ufstype=sunx86 /dev/sdn5 /mnt

Note that not all slices contains file systems, they might be used as raw devices like the swap.

Related Question