Search

Thursday, January 12, 2017

Mount Windows NTFS format external USB hard disk on Solaris 11 (SunOS 5.11 - Solaris 11.3)

mount ntfs on solaris 11 using ntfs-3g

Introduction

This post applies to openindiana Community-driven illumos Distribution only. To do this on the official Oracle Solaris 11.3 kernel please see my post on Oracle Solaris 11.3.


STEP 1


Install ntfs-3g with ntfsprogs and fuse file system packages.

The ntfs-3g related packages at SFE are old, buggy and crash-prone, causing kernel panics every time I tried to share my external NTFS drive over a Samba share. Do not intsall these from SFE. Rather, install the updated debugged packages for Solaris 11 from the NTFS-3G on OpenIndiana page which includes spot-on instructions.

Here is a quick summary of the steps to install ntfs-3g with ntfsprogs and fuse on 64-bit Solaris 11 on Intel processors from the above webpage:

a) Use wget or curl to download ntfs-3g_ntfsprogs-2016.2.22AR.2.pkg64.zip

b) If ntfs-3g was already installed :
pkg uninstall ntfs-3g

c) unzip -x ntfs-3g_ntfsprogs-2016.2.22AR.2.pkg64.zip

d) pkgadd -d ntfs-3g_ntfsprogs-2016.2.22AR.2.pkg64 all

Note: If a warning is displayed saying "The following files are already installed on the system and are being used by another package:" followed by the question "Do you want to install these conflicting files [y,n,?,q]", answer y for "yes" to install the conflicting files from the current package:

Processing package instance <ntfs-3g> from </export/home/xxxxx/ntfs-3g_ntfsprogs-2016.2.22AR.2.pkg64>

ntfs-3g(x86_64) 2016.2.22AR.2
## Processing package information.
## Processing system information.
   11 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.

The following files are already installed on the system and are being
used by another package:
* /usr/sbin/mkntfs
* /usr/sbin/ntfsclone
* /usr/sbin/ntfslabel
* /usr/sbin/ntfsresize
* /usr/sbin/ntfsundelete

* - conflict with a file which does not belong to any package.

Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.

Installing ntfs-3g as <ntfs-3g>

## Installing part 1 of 1.
/usr/bin/lowntfs <symbolic link>
/usr/bin/lowntfs-3g
/usr/bin/ntfs <symbolic link>
/usr/bin/ntfs-3g
/usr/bin/ntfs-3g.probe
/usr/bin/ntfsfix
/usr/bin/ntfsinfo
/usr/bin/ntfssecaudit
/usr/bin/ntfsusermap
/usr/bin/ntfswipe
/usr/lib/amd64/libntfs-3g.so <symbolic link>
/usr/lib/amd64/libntfs-3g.so.872 <symbolic link>
/usr/lib/amd64/libntfs-3g.so.872.0.0
/usr/lib/fs/lowntfs-3g/fstyp
/usr/lib/fs/lowntfs-3g/mount <symbolic link>
/usr/lib/fs/lowntfs/fstyp <symbolic link>
/usr/lib/fs/lowntfs/mount <symbolic link>
/usr/lib/fs/ntfs-3g/fstyp
/usr/lib/fs/ntfs-3g/mount <symbolic link>
/usr/lib/fs/ntfs/fstyp <symbolic link>
/usr/lib/fs/ntfs/mount <symbolic link>
/usr/lib/pkgconfig/libntfs-3g.pc
/usr/sbin/mkntfs
/usr/sbin/ntfsclone
/usr/sbin/ntfslabel
/usr/sbin/ntfsresize
/usr/sbin/ntfsundelete
/usr/share/doc/ntfs-3g/README
/usr/share/man/man8/mkntfs.8
/usr/share/man/man8/mount.lowntfs-3g.8 <symbolic link>
/usr/share/man/man8/mount.ntfs-3g.8 <symbolic link>
/usr/share/man/man8/ntfs-3g.8
/usr/share/man/man8/ntfsclone.8
/usr/share/man/man8/ntfsfix.8
/usr/share/man/man8/ntfsinfo.8
/usr/share/man/man8/ntfslabel.8
/usr/share/man/man8/ntfsresize.8
/usr/share/man/man8/ntfssecaudit.8
/usr/share/man/man8/ntfsundelete.8
/usr/share/man/man8/ntfsusermap.8
/usr/share/man/man8/ntfswipe.8
[ verifying class <System> ]

Installation of <ntfs-3g> was successful.

e) If a fuse kernel module was already installed :
pkg uninstall libfuse
pkg uninstall fusefs

reboot

f) Use wget or curl to download fuse-kernel-1.2AR.7.pkg.zip

g) unzip -x fuse-kernel-1.2AR.7.pkg.zip

h) pkgadd -d fuse-kernel-1.2AR.7.pkg all

Watch the output for something like this:


Processing package instance <fusefs> from </export/home/username/fuse-kernel-1.2AR.7.pkg>

fusefs(x86) 1.2AR.7
## Processing package information.
## Processing system information.
   4 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing fusefs as <fusefs>

## Installing part 1 of 1.
/usr/kernel/drv/amd64/fuse
/usr/kernel/drv/fuse
/usr/kernel/drv/fuse.conf
[ verifying class <System> ]

Installation of <fusefs> was successful.


i) If this is the first time a fuse kernel module is being installed:
add_drv -m 'fuse 0666 root sys' fuse
ln -s /devices/pseudo/fuse@0:fuse /dev/fuse

j) Reboot Solaris 11:
reboot

STEP 2

Find connected external USB drive and mount it using ntfs-3g.

a) Use the command

cfgadm | fgrep conn

to verify USB storage device is seen by Solaris 11 and connected, as in usb0/2 in the following example:

root@solaris11-3:~# cfgadm | fgrep conn
usb1/1                         usb-storage  connected    configured   ok


b) Use the command:

# rmformat

to get the raw disk device name for your external USB HDD, as in /dev/rdsk/c3t0d0p0 in the example below:

root@solaris11-3:~# rmformat
Looking for devices...
     1. Logical Node: /dev/rdsk/c1t1d0p0
        Physical Node: /pci@0,0/pci-ide@1,1/ide@0/sd@1,0
        Connected Device: VBOX     CD-ROM           1.0
        Device Type: DVD Reader
        Bus: IDE
        Size: <Unknown>
        Label: <Unknown>
        Access permissions: <Unknown>
     2. Logical Node: /dev/rdsk/c3t0d0p0
        Physical Node: /pci@0,0/pci8086,265c@b/storage@1/disk@0,0
        Connected Device: WD       My Book 1110     1030
        Device Type: Removable
        Bus: USB
        Size: 1430.1 GB
        Label: <Unknown>
        Access permissions: <Unknown>
     3. Logical Node: /dev/rdsk/c3t0d1p0
        Physical Node: /pci@0,0/pci8086,265c@b/storage@1/disk@0,1
        Connected Device: WD       Virtual CD 1110  1030
        Device Type: CD Reader
        Bus: USB
        Size: 668.0 MB
        Label: <None>
        Access permissions: <Unknown>

c) Confirm the device name (excuding the partition number) using the iostat -En command. For example, for an entry for /dev/rdsk/c3t0d0p0 returned by the rmformat command above, iostat -En should show the device c3t0d0:

# iostat -En
c1d0             Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: VBOX HARDDISK   Revision:  Serial No: VB4e58aa27-8952 Size: 33.55GB <33553981440 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c1t1d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: VBOX     Product: CD-ROM           Revision: 1.0  Serial No:
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 2 Predictive Failure Analysis: 0 Non-Aligned Writes: 0
c3t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 1
Vendor: WD       Product: My Book 1110     Revision: 1030 Serial No:
Size: 1499.60GB <1499598946304 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 45 Predictive Failure Analysis: 0 Non-Aligned Writes: 0
c3t0d1           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: WD       Product: Virtual CD 1110  Revision: 1030 Serial No:
Size: 0.70GB <700448768 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 13 Predictive Failure Analysis: 0 Non-Aligned Writes: 0



d) Figure out (maybe also write down) the device name to use with ntfs-3g. To do this, take the device name returned by rmformat in the previous step (/dev/rdsk/c3t0d0p0 in my case), and
  • replace rsdk with dsk
  • replace partition identifier 0 with 1 at the end, e.g. c3t0d1p0 with c3t0d1p1. I am not sure if this is needed because the Western Digital My Book USB HDD I am using has a virtual CD-ROM partition as well for WD Smartware; this partition is however successfully auto-mounted by Solaris 11.
As an example, for the rmformat reported raw disk device name /dev/rdsk/c3t0d0p0 which has only one partition, the device name to use with ntfs-3g is /dev/dsk/c3t0d0p1.

e) Mount the device identified in the prior step using the ntfs-3g command, like so:

# ntfs-3g  /dev/dsk/c3t0d0p1  /media
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.

Your NTFS format external USB hard disk is now mounted at the mount-point /media on your Solaris 11 system.



STEP 3

Make it permanent - mount at boot.

I first tried adding a  line to /etc/vfstab like so (note the device name with rdsk, not dsk, for the 2nd field, i.e. device to fsck):

/dev/dsk/c3t0d0p1 /dev/rdsk/c3t0d0p1 /media ntfs-3g - yes -

but it does not work! (I am not sure why.) The external USB drive is not mounted at boot time using the above line in vfstab, so I backed out and tried a more elaborate approach.

I created a file /etc/rc.local with the following contents

# ---
# Commands to execute at end of boot
# This is a linked from /etc/rc3.d/S99local
# Solaris 11 still supports this
# ---
/usr/bin/ntfs-3g /dev/dsk/c3t0d0p1 /media

and then placed a symbolic link from /etc/rc3.d/S99local to /etc/rc.local.

# chmod +x /etc/rc.local
# ln -s /etc/rc.local /etc/rc3.d/S99local
# ls -l /etc/rc.local /etc/rc3.d/S99local
-rwxr-xr-x   1 root     root         357 Jan 23 19:30 /etc/rc.local
lrwxrwxrwx   1 root     root          13 Jan 20 19:12 /etc/rc3.d/S99local -> /etc/rc.local


This worked. On reboot, the external USB drive came up mounted on /media.

root@sanyalnet-solaris:~# mount
/ on rpool/ROOT/solaris read/write/setuid/devices/rstchown/dev=4750002 on Thu Jan  1 00:00:00 1970
/devices on /devices read/write/setuid/devices/rstchown/dev=8a80000 on Thu Jan 12 21:43:39 2017
/dev on /dev read/write/setuid/devices/rstchown/dev=8ac0000 on Thu Jan 12 21:43:39 2017
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=8b80001 on Thu Jan 12 21:43:39 2017
/proc on proc read/write/setuid/devices/rstchown/dev=8b00000 on Thu Jan 12 21:43:39 2017
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=8bc0001 on Thu Jan 12 21:43:39 2017
/system/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=8c00001 on Thu Jan 12 21:43:39 2017
/system/object on objfs read/write/setuid/devices/rstchown/dev=8c40001 on Thu Jan 12 21:43:39 2017
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=8c80001 on Thu Jan 12 21:43:39 2017
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/rstchown/dev=4750002 on Thu Jan 12 21:43:56 2017
/dev/fd on fd read/write/setuid/devices/rstchown/dev=8d80001 on Thu Jan 12 21:43:56 2017
/var on rpool/ROOT/solaris/var read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750004 on Thu Jan 12 21:44:07 2017
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=8c00002 on Thu Jan 12 21:44:07 2017
/var/share on rpool/VARSHARE read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750005 on Thu Jan 12 21:44:08 2017
/export on rpool/export read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750006 on Thu Jan 12 21:44:18 2017
/export/home on rpool/export/home read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750007 on Thu Jan 12 21:44:19 2017
/rpool on rpool read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=4750009 on Thu Jan 12 21:44:22 2017
/system/zones on rpool/VARSHARE/zones read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000a on Thu Jan 12 21:44:22 2017
/var/share/pkg on rpool/VARSHARE/pkg read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000b on Thu Jan 12 21:44:23 2017
/var/share/pkg/repositories on rpool/VARSHARE/pkg/repositories read/write/setuid/devices/rstchown/nonbmand/exec/xattr/atime/dev=475000c on Thu Jan 12 21:44:24         2017
/media on /devices/pci@0 read/write/nosetuid/nodevices/rstchown/dev=4a00000 on Thu Jan 12 21:48:09 2017
root@sanyalnet-solaris:~#




No comments:

Post a Comment

"SEO" link builders: move on, your spam link will not get posted.

Note: Only a member of this blog may post a comment.

Recommended Products from Amazon