
==========================================================================
Wrappers for mounting pcfs(7FS) bigdisks via vold(1M) on SPARC Solaris 2.6
==========================================================================

WHAT IS THIS?
=============

You can mount DOS filesystem ZIPs and MOs via vold(1M).


INSTALLATION
============

Before you install this package, go up to a point that you can 
format, mount, read and write a ufs (mount_ufs(1M)) ZIP or MOs 
via vold. Be sure the hardware/setup bugs are eliminated.

Three methods are provided. The Recommended is Method 3, but for 
those who want minimal quirks installed, Method 1 and 2 is here.

DO NOT install all of them; only one method should be installed.

Method 1: Only wrap /usr/lib/fs/pcfs/mount

	This wrapper mounts pcfs with ":c" appended, then 
	deletes ":c" from /etc/mnttab after the mount succeeded.

	Installation:
	Use "make install-method1". Files affected:
		/usr/lib/fs/pcfs/mount

	Pros: Only one file is patched.
	Cons: /etc/mnttab is lacking ":c", so it's hard to know afterwards 
	      whether it is mounted with or without ":c".

Method 2: Wrap /usr/lib/fs/pcfs/mount and /usr/sbin/rmmount

	The pcfs/mount wrapper just appends ":c" to the device file string. 
	The rmmount wrapper deletes ":c" from /etc/mnttab and passes on 
	if it was an eject request.

	Installation:
	Use "make install-method2". Files affected:
		/usr/lib/fs/pcfs/mount
		/usr/sbin/rmmount

	Pros: ":c" remains on /etc/mnttab, so you know it :)
	      You can have aliases other than "rmscsi%d" in vold.conf 
	      and have no trouble.
	Cons: Two commands are wrapped. Ugly.

Method3: Create a new filesystem identifier "fdiskfs"

	- /usr/lib/fs/pcfs/ident_pcfs.so only recognizes superfloppy 
	  formatted disk, and the logic is rather loose. 
	- pcfs(7FS) can only mount FAT12 floppy and FAT16 FDISK. 

	This difference may cause 

	- FDISK disks not mounted even if it could, or
	- mount a FAT16 superfloppy in FAT12 mode and corrupt it.

	So, install a new filesystem identifier "ident_fdiskfs.so" and 
	enable this in the rmmount.conf(4) "ident" chain.

	Installation:
	Use "make install-method3". Files affected:
		/usr/lib/fs/fdiskfs/ident_fdiskfs.so.1
		/usr/lib/fs/fdiskfs/mount
		/usr/lib/fs/pcfs/ident_pcfs.so.1
		/usr/sbin/rmmount

		Then add following to /etc/rmmount.conf before pcfs line:
			ident fdiskfs ident_fdiskfs.so rmscsi
		and modify the last line of the /etc/vold.conf to
			unsafe ufs hsfs pcfs fdiskfs
		Finally, restart vold.

	Pros: Additional to Method2, you can mount FDISK disks 
	      without any kludge to make it look like a superfloppy format.
	      FAT16 superfloppys (which cannot be mounted) are 
	      properly rejected to prevent corruption.
	      (If you want to mount the superfloppys, fake a FDISK info 
	       on it by "fdiskize" utility)
	      These configuration are the best for the novice user.
	Cons: /usr is rather polluted.

Some Sun official patches may also replace the files affected by this package.
When applying official patches, it is strongly recommended to first 
uninstall this package by "make uninstall", then apply the patch and 
then reinstall.
(At the date of writing no conflicts with Recommended patches)


UNINSTALL
=========

"make uninstall" .
If you're switching between methods, uninstall them first.


PLATFORM SUPPORTED
==================

Yes, further success report is greatly appreciated. 
Dunno whether this works on x86.

	UltraSPARC-1/170 (Sbus,SCSI) + Solaris 2.6 + 
	SCSI ZIP100 + SCSI 230MB MO(Fujitsu MCB3023SS)

640MB MOs are NOT supported. (540MB probably works, but not confirmed)


WHAT THIS DOES
==============

Not only x86, but SPARC Solaris also could mount FDISK partitioned 
bigdisks commonly seen on ZIP and Magneto-Optical(MO). 
But the device file string needs ":c" appended, like
	mount -F pcfs /vol/dev/dsk/c0t4d0/no_name:c /rmscsi/no_name
which vold(1M) (actually rmmount(1M)) does not do.

Even by only minor setup, which means just enabling the "dev_rmscsi.so" line 
in /etc/vold.conf, vold(1M) does mount some MOs by insertion. 
But it lacks ":c". This makes pcfs(7FS) assume that the filesystem is 
FAT12(!), and CORRUPTS IT ON THE VERY FIRST WRITE. 
(This won't be a problem on filesystems below 16MB, such as floppys)

So I made a wrapper around /usr/lib/fs/pcfs/mount to forcibly 
add ":c" for rmscsi devices, and then pass it to original 
/usr/lib/fs/pcfs/mount.

Just adding ":c" causes another problem. ":c"-suffixed path is recorded 
in /etc/mnttab. And rmmount(1M) seems to scan and stat(2) each device 
spec in /etc/mnttab on eject. 
As device file like "/vol/dev/dsk/c0t4d0/no_name:c" usually doesn't 
exist, unmounting/ejecting fails. To get around this, the ":c" suffix 
should be deleted from /etc/mnttab line somewhere before the eject.
(This is ugly but without the rmmount source code we can't fix it)


DISK FORMATS
============

Magneto-Opticals comes in two formats; FDISK format and Superfloppy format. 
ZIPs are always FDISK.

FDISK resembles IBM-PC harddisk format. It can have up to 
four primary partitions on a single medium.
(though pcfs(7FS) seems to use the only first one) 
MOs formatted by WindowsNT is in this form. ZIPs are always FDISK.

Superfloppy does not have a partition; the whole disk is a whole disk, 
which corresponds to a single partition image of a harddisk.
(In FreeBSD terms the whole disk is a slice image.)
MOs used by Windows95 comes in this format.

pcfs(7FS) seems to understand only FDISK format when you need FAT16. 
But the filesystem resolver, ident_pcfs.so, invoked by rmmount(1M), 
seems to only detect superfloppy, so vold(1M) does not always mount the media. 
(To check for yourself, fstyp(1M) is something close, but actually 
/usr/lib/fs/pcfs/ident_pcfs.so.1 is used; they use different logic)

So, for automatic mount, the disk should be formatted in superfloppy 
(to make ident_pcfs.so happy) with a fake FDISK partition information 
(to mount it in FAT16) and a hooked /usr/lib/fs/pcfs/mount to add ":c" 
to the device path (to mount it in FAT16). This is Method 1,2.

Another way is to separate FDISK and superfloppy detection/mount; 
this is Method 3, which you don't need any superfloppy things on the disk.
For mounting superfloppy disks, you still need fake FDISK information 
as this is the restriction of the pcfs(7FS). There is an `fdiskize' tool 
included to create it.

You can't use fdformat(1) for formatting in pcfs. You may need mformat(1) 
included in mtools distribution. In mtools language, 
superfloppy will mean a config line without a "partition=" clause.
mformat(1) produces a `fake' FDISK partition info even if without 
"partition=", so the disk formatted by mformat(1) could be 
detected & mounted by vold(1M) after installation.

Occasionally a pcfs(7FS) disk is erroneously mounted as ufs, 
especially when the disk is previously formatted in ufs.
Before formatting, something like 
	dd if=/dev/zero of=/vol/dev/aliases/rmscsi0 bs=18k count=10 
	(or just  cp /kernel/genunix /vol/dev/aliases/rmscsi0)
to get rid of the previous filesystem trace, is recommended.


--
kabe@sra-tohoku.co.jp
$Id: README,v 1.7 2000-07-27 01:59:21+09 kabe Exp $
