From: Bela Lubkin <belal@sco.com> Subject: Re: How to read differnt formated floppies Date: Tue, 15 Jul 2003 00:18:20 GMT References: <612ogv06j0dcdgi4i8edgqfhe2otgvqp1d@4ax.com>
<Xns93B67C5AE1845jajii1netscape@205.188.138.161>
<HHzCDD.11u8@wjv.com>
<kt15hv05h7s2r2cabaklu3ftqif36q36ci@4ax.com> Peter Michel wrote: > >>> i have floppydisks written by a tar, but they are formated with 17 > >>> sectors/track and with 77 tracks per surface, each sector has 512 > >>> bytes on a 5.25" media. > >>> How can i set parameters of the diskettes drivers to read (and perhaps > >>> write) it, this stupid format? > > the diskettes where written by an Xenix derivat on normal 5.25" Floppy > media. The HW had a programmable device under /dev, which also was > possible to use with the old ecma formats. > Yes, they wrote it with 2*77*17*512 Bytes on a 5.25" HD disc 8-[:] > But, the old HW isn't longer available :-(( and on the medias is > source code we needed. > Will try and see what will go.
The floppy driver isn't terribly picky about actual physical formats; at least, not if the sector numbers written in the sector headers make sense. What happens if you: dd if=/dev/rfd0135ds18 bs=512 count=1 of=/dev/null Do you get an I/O error or not? If not, the physical sectors are probably readable. You just need to be sure to only read the sectors that are actually present. Let me digress for a moment about device names. I used the "r" device (raw) because it doesn't go into the buffer cache, and doesn't attempt to do readahead. If you try to read from the block device, readahead will attempt to read sectors you didn't actually ask for (and which aren't actually present), leading to failure. I used the device name "fd0135ds18" because that refers to an 80-track, 18-sector format. Both of those parameters are larger than your actual format. The benefit is that every sector that exists on _your_ format also exists somewhere in this format. (As do a few which don't exist on your format.) I used "fd0" but you'll probably actually be using "fd1" (whichever position your 5.25" drive is on.) "96" vs. "135" isn't important, they're actually the same thing inside the driver. So. The trick is to request all the blocks that _do_ exist, while avoiding the ones that don't. When you read linearly from the 135ds18 format, you get:
track 0 head 0 sectors 1..18
track 0 head 1 sectors 1..18
track 1 head 0 sectors 1..18
track 1 head 1 sectors 1..18
track 2 head 0 sectors 1..18
track 2 head 1 sectors 1..18
...
track 79 head 0 sectors 1..18
track 79 head 1 sectors 1..18
and what you want is:
track 0 head 0 sectors 1..17
track 0 head 1 sectors 1..17
track 1 head 0 sectors 1..17
track 1 head 1 sectors 1..17
track 2 head 0 sectors 1..17
track 2 head 1 sectors 1..17
...
track 76 head 0 sectors 1..17
track 76 head 1 sectors 1..17
A "C" program to extract just those sectors wouldn't be too difficult.
But it can also be done in the shell (maybe with a bit of awk). For
instance:
awk 'BEGIN {
dev = "/dev/rfd0135ds18"
for (tk = 0; tk < 77; tk++)
for (hd = 0; hd < 2; hd++)
printf "dd if=%s bs=512 count=17 iseek=%d\n", dev,
(tk * 2 + hd) * 18
}' > /tmp/get-image
sh /tmp/get-image > /tmp/image
tar tvf /tmp/image
If you look at /tmp/get-image, you'll see a bunch of separate `dd`
statements. If this works partially but gets some I/O errors, you can
fiddle around with the specific contents of /tmp/get-image to work
around whatever goes wrong. Of course if you can't read a single sector
then this isn't going to help...
>Bela<
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar