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 11:52

the dd read test sounds good, and obviously a write test can't be anything but destructive so i guess i'm screwed on that one

the badblocks.c file for linsux was completely useless, it's not even for unix and it's based on fsck and mkfs which both check the filesystem, you can even see it include ext2fs specific headers

i was hoping my mac would have bsd manuals but i'll have to look vfs and vnode up on my freebsd thinkpad, thanks for the tip

if it's that fs dependant then i'll just cancel this whole project before it even begins, i was hoping to learn more about accessing disk blocks with this

opening the actual disk device file seems like the closest i'll come to my original idea but i have no idea how to read raw data like that, i have a friend who has written some midi drivers for freebsd before so maybe he can tell me more

if anyone has info on where to start for a programmer who wants to learn about reading and writing raw data to disk devices, please provide it

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