LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Get files from a disk image ? (How do I recover a floppy using Linux ?) (https://www.linuxquestions.org/questions/linux-software-2/get-files-from-a-disk-image-how-do-i-recover-a-floppy-using-linux-453079/)

me3 06-09-2006 03:19 AM

Get files from a disk image ? (How do I recover a floppy using Linux ?)
 
OK, I need to recover the contents of a DOS 360K 5.25" floppy disk written in 1988. Yeah, you read that right.

So... I found a 5.25" drive (harder than it sounds these days...) and set it up on my computer. After a bit of tweaking with the BIOS, I had it reading floppy disks. It read several disks fine, but I ran into a problem with one, as follows...

# mount /dev/fd0
mount: wrong fs type, bad option, bad superblock on /dev/fd0,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

So...

# dmesg | tail
VFS: Can't find a valid FAT filesystem on dev fd0.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev fd0.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev fd0.
SELinux: initialized (dev fd0, type msdos), uses genfs_contexts
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev fd0.
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev fd0.


Hmmm.... lets check this out:

#/sbin/fsck -r /dev/fd0
fsck 1.38 (30-Jun-2005)
dosfsck 2.10, 22 Sep 2003, FAT32, LFN
Logical sector size is zero.

Interesting.

Lets see how bad it really is:

#dd if=/dev/fd0 of=./floppyImage bs=512
720+0 records in
720+0 records out

So that is where I sit right now. I opened the image file up in khexeditor and it it doesn't seem to be totally scrambled. To the best of my knowledge the floppy has a few text files on it and a few little applications. I want the applications.

So how does one separate the files out of the image or how should I approach this problem ?

Thanks in advance.

kilgoretrout 06-09-2006 11:06 AM

Did you try mounting the floppy image with loop:

# mount <path to floppyImage> <mount point> -o loop

and try reading the image through the above mount point:

# ls <mount point>

me3 06-09-2006 06:53 PM

I didn't try using loop. What does it do ? How does it help ?

Thanks.

syg00 06-09-2006 08:13 PM

Quote:

Originally Posted by me3
So how does one separate the files out of the image or how should I approach this problem ?

I'd be inclined to mkdosfs on it. With luck it'll just (re-)build the f/s meta-data, and let you see the files.
Without luck you'll have an empty floppy ... :cool:
In that case dd the image back and wait for better suggestions to pour in ... :p

me3 06-10-2006 01:01 PM

"I'd be inclined to mkdosfs on it. With luck it'll just (re-)build the f/s meta-data, and let you see the files."

I thought making a new filesystem would wipe the existing FAT clean and thus remove the existing files ? (Do floppies have a FAT ?)

How would mkdosfs recognize the existing files and not wreck them ? (I don't know much about DOS floppies...)

How do I know that the current floppy read process is recognizing the floppy disk as the right media type, ie 360K ?

Thanks.

syg00 06-10-2006 07:03 PM

I don't know - but you have the perfect opportunity to answer some of those questions.
Do it and find out.

If it all goes to hell, you'll still have learned something - then dd the image back, and try something else.

me3 06-11-2006 01:48 PM

I'd be happy to test a bunch of stuff and report back.

Will a dd back onto the diskette give me exactly what I started with ?

syg00 06-11-2006 06:28 PM

All whopping 360k of it... ;)
I've done some terrible things to disks (not 5 1/4 admittedly), and never had an issue restoring them. So long, of course, that the media is good. May not be the case here, so you need to consider that.

You said you had some other disks you could read - maybe you could back them up the same way, and restore this dodgy image onto one of those.
See if you can read it then - eliminates media as the problem.

I like to play around a bit when I have a problem - have fun.


All times are GMT -5. The time now is 03:47 AM.