Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 1998 19:34:41 -0400
From:      Randall Hopper <rhh@ct.picker.com>
To:        Antonio Bemfica <bemfica@militzer.me.tuns.ca>, freebsd-questions@FreeBSD.ORG
Subject:   Re: how do I mount a DOS ZIP disk? - etc.
Message-ID:  <19980422193441.A29671@ct.picker.com>
In-Reply-To: <Pine.BSF.3.96.980414182106.22005B-100000@militzer.me.tuns.ca>; from Antonio Bemfica on Tue, Apr 14, 1998 at 06:33:20PM -0300
References:  <19980414133134.37930@ct.picker.com> <Pine.BSF.3.96.980414182106.22005B-100000@militzer.me.tuns.ca>

next in thread | previous in thread | raw e-mail | index | archive | help

--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=us-ascii

Antonio Bemfica:
 |> I tend to prefer putting my UFSs on my UFS ZIPs in slice 1, and leaving the
 |> DOS FAT FSs in slice 4.  Makes them easy to distinguish.  My "mountzip"
 |> script just tries to mount both slices, and succeeds on the correct one.
 |
 |Would you consider sharing your script? 

Sure.  It'll cook sliced and "dangerously dedicated" UFS ZIP disks (I
prefer sliced).  Doesn't do DOS FAT disks as I typically make those in DOS,
and I didn't know when I wrote it whether I could cook them in FreeBSD.

Sliced UFSs are put on the first slice, so mount sliced disks are mountable
as via /dev/sd0s1 and dedicated disks as /dev/sd0.

You'll want to tweak the vars at the top and probably scan over it to see
if you want to do everything it does.  For example, I like to chown/chgrp
the root dir so I can write to the FSs as myself (I use a setuid script for
mount/unmount).

Hope this helps.

Randall



--mP3DRpeJDSE+ciuQ
Content-Type: text/plain
Content-Disposition: attachment; filename="make-ufs-zip.sh"

#!/bin/sh
#
#  make-ufs-zip.sh - Create 96MB UFS Partition on a ZIP Disk in FreeBSD 2.x
#                  - Uses new fdisk mods in 2.2-CURRENT
#
#  ASSUMES 1st disklabel installed in /etc/disktab (for UFS as slice):
#
#  zip100slice|Iomega Zip 100, for disks w/ compat MBR/slice table (sector 0):\
#             :ty=removable:dt=SCSI:se#512:nc#95:nt#64:ns#32:\
#             :pa#194560:oa#0:ba#4096:fa#512:\
#             :pc#194560:oc#0:bc#4096:fc#512:
#
#  zip100|Iomega Zip 100:\
#             :ty=removable:se#512:nc#96:nt#64:ns#32:\
#             :pa#196608:oa#0:ba#4096:fa#512:\
#             :pb#196608:ob#0:bb#4096:fb#512:\
#             :pc#196608:oc#0:bc#4096:fc#512:
#     

DEVICE=sd0
ECHO=/bin/echo
ZIPUSER=rhh
ZIPGROUP=zip
as_slice=y
FREEBSD_MAJOR_VERSION=`uname -r | cut -f1 -d.`

$ECHO "make-ufs-zip - Install 96MB UFS on a ZIP Disk on ${DEVICE}/${DEVICE}s1"
$ECHO "----------------------------------------------------------------------"
$ECHO

$ECHO -n "Are you SURE you want to WIPE OUT '${DEVICE}'??? "
read ans
if [ `echo $ans | cut -c1 | tr "NY" "ny"` != y ]; then
   echo "Aborting..."
   exit 1
fi

$ECHO
$ECHO -n "Create compatibility MBR (UFS as slice, default=$as_slice)? "
read ans
if [ -n "$ans" ]; then
   if [ `echo $ans | cut -c1 | tr "NY" "ny"` != y ]; then
      ans=n
   fi
   as_slice=$ans
fi

$ECHO
$ECHO "----------------------------------------------------------------------"
$ECHO

#-----------------------------------------------------------------------
# FDISK a ZIP 100MB for a single UFS slice (sd?s1) that fills the disk
#-----------------------------------------------------------------------

if [ $as_slice = y ]; then
   if [ $FREEBSD_MAJOR_VERSION -lt 3 ]; then
      partition1=0
   else
      partition1=1
   fi

   fdisk -i -f - /dev/${DEVICE} << !EOF!
g c96 h64 s32
p $partition1 165 32 196576
!EOF!

else

   dd if=/dev/zero of=/dev/r${DEVICE} count=2
   disklabel /dev/r${DEVICE} | disklabel -B -R -r ${DEVICE} /dev/stdin

fi

if [ $? -ne 0 ]; then
   $ECHO
   $ECHO "fdisk FAILED!"
   $ECHO
   exit 1
fi

$ECHO
$ECHO "----------------------------------------------------------------------"
$ECHO

#-----------------------------------------------------------------------
# Now slap a FreeBSD disklabel on the sd?s1 slice
#-----------------------------------------------------------------------

if [ $as_slice = y ]; then
   disklabel -w -B /dev/${DEVICE}s1 zip100slice

   if [ $? -ne 0 ]; then
      $ECHO
      $ECHO "disklabel FAILED!"
      $ECHO
      exit 1
   fi
fi

#-----------------------------------------------------------------------
# Finally create the UFS file system on the slice
#-----------------------------------------------------------------------

#newfs -Tzip100 /dev/r${DEVICE}s1
newfs /dev/r${DEVICE}c 	            # Fewer superblock baks (more disk space!)

if [ $? -ne 0 ]; then
   $ECHO
   $ECHO "newfs FAILED!"
   $ECHO
   exit 1
fi

#-----------------------------------------------------------------------
# And change ownership of the top directory
#-----------------------------------------------------------------------
mkdir -p /zip
if [ $as_slice = y ]; then
   mount /dev/${DEVICE}s1 /zip
else
   mount /dev/${DEVICE}c /zip
fi
chown $ZIPUSER /zip
chgrp $ZIPGROUP /zip
umount /zip

--mP3DRpeJDSE+ciuQ--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980422193441.A29671>