The easy way to do this is with the -o option to losetup, as
several people pointed out. I'm summarizing my experiences below for
the archive, in case it turns out to be useful to someone in the
future. Thanks to all who responded.
1. The drive in question is an ATAPI Zip 250MB drive.
2. I've only used it with 100MB media (cartridges, but 250MB
should yield to similar efforts.
3. The module stack that I'm using, under a recent 2.4 Linux
kernel (that which ships on the original release of RedHat 9.0) is:
pf -> on26 -> paride. Obviously, you replace on26 with the protocol
driver suitable to your adapter. The paride documentation files in
the kernel source are most helpful.
4. The drive is not accessible using the pd module, but the
pf module understands the hardware just fine.
5. Now it's time to figure out how far into /dev/pf0 the
partition begins. Run 'fdisk /dev/pf0'. Use the x command to enter
"expert" mode. Use the p command to print the partition table. Yes,
there is a p command to print the partition table in non-expert mode,
but it doesn't give you the same collection of information.
The header printed tells you how many sectors, heads, and
cylinders you have on the media, 32, 64, and 95 for the 100MB media.
The partition line tells you, among other things, which sector, using
which head, on which cylinder, the partition begins. In the case of
the 100MB media it was sector 1, head 1, cylinder 0.
At this point you must remember that disk blocks here are 512
bytes, no matter than many of your Linux tools report in 1k "blocks".
(I can remember disks with different physical block sizes, but I've
never run across them in the PC world. Probably fdisk would tell me
about that too.) You must also remember that while cylinder and head
numbering starts with 0, sector numbering starts with 1.
Then, if H is the total number of heads, h is the head on which
the partition starts, S is the total number of sectors, s is the sector
at which the partition starts, c is the cylinder on which the partition
starts, and B is the number of bytes per block, then the necessary
B * (s - 1 + (S * (h + (H * c))))
or, in my case:
512 * (1 - 1 + (32 * (1 + (64 * 0)))) == 16384
Use q to exit fdisk.
6. Set up a loop back device to let you read and write pf0
with the offset calculated in item 5, above, and mount the loop back
losetup -o 16384 /dev/loop0 /dev/pf0
mount -t auto /dev/loop0 /mnt/mnt
Read and write the drive as any VFAT filesystem.
7. These may not be completely necessary, but when finished, I
did the following:
losetup -d /dev/loop0
If you want, you can remove the modules at this point
(assuming that you dynamically loaded them, rather than building them
into your kernel).
8. I've pretty much decided that this is easy enough that I'm
not going to sign up to "upgrade" the pf driver to handle partitions.
I originally wrote:
> I have an external prallel port generic IDE drive box that
> works with on26. Using a normal IDE disk and pd things are just fine.
> I'd like to use it with an ATAPI Zip drive. Using pf, fdisk
> can see it just fine, and I can, for example, eject the disk with
> But, since pf was apparently written with non-partitioned
> disks (LS-120, CDs) in mind. Zip disks, however, are partitioned.
> Is there something short of reworking the pf driver to support
> partitioning that will get me around this?
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Tue Apr 29 2003 - 17:06:29 EDT