Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Direct disk block access in UNIX

Name: Anonymous 2008-10-14 11:47

if one were to write a program to check disk blocks in unix, could you make it FS independent and what do you need to do this?

i'm used to programming in c on unix but i've never done any low level hardware stuff like this, i could check the fsck source but i'd rather ask you guys

also i believe fsck checks the filesystem, not the blocks on the disk. i want to write a program that is FS independent and can for example check a FFS disk or an externally mounted NTFS disk in the same way

i don't know enough about hardware to get started on this project without some help, first of all, how do you check the sectors or blocks? do you have to force a read/write to them or can you check them without affecting the data? read test would be easy but how do you verify data? i guess the test will only fail if the read fails but what about writing?

also i'm thinking i can't run this from inside the OS so i plan to run it from a bootable cd, all i really need is the disk to show up in /dev so i can access the physical device for read/write operations

i know there probably already are tools like this but this is just for fun

Name: Anonymous 2008-10-15 17:06

Though in the write case you'd have to make sure somehow that no one writes the smallest atomic quantity in the time when your "write" has completed, but you haven't yet submitted your "read". And exclusive access to block devices is something that POSIX doesn't specify, as far as I remember.

That, or some sort of a recovery procedure, or a tolerance for false positives. That's probably a bitch and a half.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List