Wednesday, August 10, 2011

How to mount a removable media on Solaris 10?

bash-3.00# cat /etc/release
                        Solaris 10 5/09 s10x_u7wos_08 X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 30 March 2009


Mounting the removable media CD-ROM, DVD-ROM  and USB media can be preformed either by running Volume Management daemon (vold)  or by mounting it manually by executing ‘mount’ command.
Here we discuss both the ways to mount a USB media with pcfs  (PCFS – Personal Computer File System.  Allows read and write access to data and programs on DOS-formatted disks that are written for DOS-based personal computers.) file system.

Before performing the task of mounting removable media make sure that those media are recognized by the Solaris Operating System.

To view the instance name of the media execute the following:

bash-3.00# iostat -en
  ---- errors ---
  s/w h/w trn tot device
    0   0   0   0 c0d0
    0   0   0   0 fd0
    2   0   0   2 c1t0d0
    0   0   0   0 c3t0d0


bash-3.00# iostat -En | more
c0d0             Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: VMware Virtual  Revision:  Serial No: 000000000000000 Size: 8.59GB <8589611520 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c1t0d0           Soft Errors: 2 Hard Errors: 0 Transport Errors: 0
Vendor: NECVMWar Product: VMware IDE CDR10 Revision: 1.00 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
c3t0d0           Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: Kingston Product: DataTraveler 2.0 Revision: 1.00 Serial No:
Size: 8.01GB <8005787648 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0


To know the instance name of the media is very important as it’s required to mount the media manually.

NOTE: 
1.       For people working with VMWare Solaris 10 box, to make the removable media on the virtual host have  to enable the options on VMWare. Please ref to the picture posted.

Choose: VM ->Removable Devices -> choose the devices accordingly which is required at the virtual host.


2.       If the removable devices are accessed on virtual host, those devices cannot be accessed on the  physical host until its disconnected from the virtual host.

3.       To use USB media to the Virtual host, Edit settings of the Virtual host.  Also it’s very vital to keep in memory that, these edited settings come into existence only after reboot of the virtual host.



bash-3.00# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.6G   3.3G   1.3G    73%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.0G   920K   1.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.3G   1.3G    73%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G    52K   1.0G     1%    /tmp
swap                   1.0G    32K   1.0G     1%    /var/run
/dev/dsk/c0d0s7        2.7G   2.8M   2.7G     1%    /export/home
/hgfs                   16G   4.0M    16G     1%    /hgfs
/tmp/VMwareDnD           0K     0K     0K     0%    /var/run/vmblock


The above command df –h displays what are the devices mounted on the host.


First let’s discuss how to mount the USB removable media by running Volume Management.

bash-3.00# /etc/init.d/volmgt start
volume management starting.

The above script starts the Volume Management daemon vold.

The above script refers and read the file /etc/vold.conf.

1.       The file lists out the action to be performed by vold daemon when it get started and stopped.
2.       The file lists out the file system supported by the vold daemon.
3.       The file refers and execute the script  /usr/sbin/rmmount  (The rmmount utility is a removable  media  mounter  that  is executed  by  Volume Management whenever a removable medium  such as a CD-ROM  or  a  floppy,  is  inserted.  ‘rmmount’ command can also be executed to mount removable media, which refers to the file /etc/rmmount.conf ).


bash-3.00# vi /etc/vold.conf

"/etc/vold.conf" [Read only] 36 lines, 1123 characters
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)vold.conf  1.27    06/01/20 SMI"
#
# Volume Daemon Configuration file
#

# Database to use (must be first)
db db_mem.so

# Volfs support of removable media devices
support nomedia

# Labels supported
label cdrom label_cdrom.so cdrom
label dos label_dos.so floppy rmdisk pcmem
label sun label_sun.so floppy rmdisk pcmem

# Devices to use
use cdrom drive /dev/rdsk/c*s2 dev_cdrom.so cdrom%d
use floppy drive /dev/rdiskette[0-9] dev_floppy.so floppy%d
use pcmem drive /dev/rdsk/c*s2 dev_pcmem.so pcmem%d forceload=true
use rmdisk drive /dev/rdsk/c*s2 dev_rmdisk.so rmdisk%d

# Actions
eject dev/diskette[0-9]/* user=root /usr/sbin/rmmount
eject dev/dsk/* user=root /usr/sbin/rmmount
insert dev/diskette[0-9]/* user=root /usr/sbin/rmmount
insert dev/dsk/* user=root /usr/sbin/rmmount
notify rdsk/* group=tty user=root /usr/lib/vold/volmissing -p
remount dev/diskette[0-9]/* user=root /usr/sbin/rmmount
remount dev/dsk/* user=root /usr/sbin/rmmount

# List of file system types unsafe to eject
unsafe ufs hsfs pcfs udfs



bash-3.00# cat /etc/rmmount.conf
# ident "@(#)rmmount.conf       1.12    00/08/29 SMI"
#
# Removable Media Mounter configuration file.
#

# File system identification
ident hsfs ident_hsfs.so cdrom
ident ufs ident_ufs.so cdrom floppy rmdisk pcmem
ident pcfs ident_pcfs.so floppy rmdisk pcmem
ident udfs ident_udfs.so cdrom floppy rmdisk

# Actions
action cdrom action_filemgr.so
action floppy action_filemgr.so
action rmdisk action_filemgr.so

# Mount
mount * hsfs udfs ufs -o nosuid



To know whether the Volume Management Daemon – vold get started, execute the following:

bash-3.00# ps -ef | grep -i vold*
    root  1036  1035   0 19:47:38 ?           0:00 gnome-volcheck -i 30 -z 3 -m cdrom,floppy,zip,jaz,dvdrom --sm-client-id default
    root  1035     1   0 19:47:37 ?           0:00 gnome-volcheck -i 30 -z 3 -m cdrom,floppy,zip,jaz,dvdrom --sm-client-id default
    root  1265     1   0 19:59:03 ?           0:00 /usr/sbin/vold -f /etc/vold.conf



Now to view the mounted devices:

bash-3.00# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.6G   3.3G   1.3G    73%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.0G   928K   1.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.3G   1.3G    73%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G    52K   1.0G     1%    /tmp
swap                   1.0G    32K   1.0G     1%    /var/run
/dev/dsk/c0d0s7        2.7G   2.8M   2.7G     1%    /export/home
/hgfs                   16G   4.0M    16G     1%    /hgfs
/tmp/VMwareDnD           0K     0K     0K     0%    /var/run/vmblock
/vol/dev/dsk/c3t0d0/unnamed_rmdisk:c
                       7.4G   4.6G   2.9G    62%    /rmdisk/unnamed_rmdisk



Lists out the contents of the removable media:
bash-3.00# ls /rmdisk/unnamed_rmdisk/
Big Admins  Solaris Zones Cheat Sheet.htm    faq_files/
Big Admins  Solaris Zones Cheat Sheet_files/ fwdkutralammm.zip
FAQ.HTM                                        lines_lines_lines.txt
MKDIR.DOC                                      solaris_zones_cs.html
New Folder/                                    solaris_zones_cs_files/


To view the devices mounted with specified file system:
bash-3.00# df -h -F pcfs
Filesystem             size   used  avail capacity  Mounted on
/vol/dev/dsk/c3t0d0/unnamed_rmdisk:c
                       7.4G   4.6G   2.9G    62%    /rmdisk/unnamed_rmdisk

bash-3.00# df -h -F hsfs
Filesystem             size   used  avail capacity  Mounted on
/vol/dev/dsk/c1t0d0/vmwaretools
                        19M    19M     0K   100%    /cdrom/vmwaretools

For example to know the file system of the removable media:
bash-3.00# fstyp /vol/dev/dsk/c1t0d0/vmwaretools
hsfs

Option:
-h = Displays the total size, used size, available size in human readable format.
-F = Follows with the file system, displays only the devices mounted with specified file system.


To stop the Volume Management daemon:

bash-3.00# /etc/init.d/volmgt stop
Once the Volume Management daemon is stopped, the removable media gets unmounted automatically.



bash-3.00# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.6G   3.3G   1.3G    73%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.0G   928K   1.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.3G   1.3G    73%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G    52K   1.0G     1%    /tmp
swap                   1.0G    32K   1.0G     1%    /var/run
/dev/dsk/c0d0s7        2.7G   2.8M   2.7G     1%    /export/home
/hgfs                   16G   4.0M    16G     1%    /hgfs
/tmp/VMwareDnD           0K     0K     0K     0%    /var/run/vmblock


NOTE:
1.       CD-ROM/DVD-ROM can be ejected whilst vold daemon is running, if its not accessed.
2.       If the removable media is mounted manually through ‘mount’ command, CD-ROM/DVD-ROM cannot be ejected. Devices have to be unmounted manually.
3.       Once the vold daemon is started, even after the reboot the system, the daemon keeps running until it’s stopped manually.



Secondly, to mount the devices manually,
1.       Know the instance name of the device to be mounted.
2.       Know the file system of the removable device to be mounted.
3.       Create and know the mount point for the device to be mounted.

The following command mounts the USB removable media:
bash-3.00# mount -F pcfs /vol/dev/dsk/c3t0d0/unnamed_rmdisk:c  /Desktop/pen_drive

Option:
-F  =  followed by file system, is used to mount the device with the specified file system.
/vol/dev/dsk/c3t0d0/unnamed_rmdisk:c  =  removable device to be mounted
/Desktop/pen_drive  =  mount point

bash-3.00# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.6G   3.3G   1.3G    73%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.0G   928K   1.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.3G   1.3G    73%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G    52K   1.0G     1%    /tmp
swap                   1.0G    32K   1.0G     1%    /var/run
/dev/dsk/c0d0s7        2.7G   2.8M   2.7G     1%    /export/home
/hgfs                   16G   4.0M    16G     1%    /hgfs
/tmp/VMwareDnD           0K     0K     0K     0%    /var/run/vmblock
/vol/dev/dsk/c3t0d0/unnamed_rmdisk:c
                       7.4G   4.6G   2.9G    62%    /Desktop/pen_drive
bash-3.00# df -h -F pcfs
Filesystem             size   used  avail capacity  Mounted on
/vol/dev/dsk/c3t0d0/unnamed_rmdisk:c
                       7.4G   4.6G   2.9G    62%    /Desktop/pen_drive

Lists out the contents of the mount point/removable media:
bash-3.00# ls /Desktop/pen_drive/
Big Admins  Solaris Zones Cheat Sheet.htm    ch13lev1sec5_files
Big Admins  Solaris Zones Cheat Sheet_files  faq_files
FAQ.HTM                                        fwdkutralammm.zip
MKDIR.DOC                                      lines_lines_lines.txt
New Folder                                     solaris_zones_cs.html

To unmount the removable device manually:
bash-3.00# umount /Desktop/pen_drive
bash-3.00# df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0d0s0        4.6G   3.3G   1.3G    73%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   1.0G   920K   1.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                       4.6G   3.3G   1.3G    73%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   1.0G    52K   1.0G     1%    /tmp
swap                   1.0G    32K   1.0G     1%    /var/run
/dev/dsk/c0d0s7        2.7G   2.8M   2.7G     1%    /export/home
/hgfs                   16G   4.0M    16G     1%    /hgfs
/tmp/VMwareDnD           0K     0K     0K     0%    /var/run/vmblock


Accessing the removable media made simple.

No comments:

Post a Comment