Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Accessing VFAT from Linux

    I'm new to this place and dont bother if my query is a little wierd.I wanted to know whether direct disk access(low level;at CHS level)is possible in Linux.I wanted to develop an app for myself that could give me access to FAT32 filesystems.I know I can mount the VFAT devices,but I donot want to use the option.Kindly let me know any/all possibilities.

  2. #2
    Linux Newbie
    Join Date
    Feb 2004


    As far as i know you will have to mount them, but this can be done at boot up to save you having to type in the command everytime

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    Sorry to bring up old posts like this, but I just couldn't help myself, since it's so incredibly simple. Just open the device file and access it like any other file. You won't get CHS-style access, but who'd want to anyway when you get linear access instead?

    For example, if your VFAT partition is hda3, just something like this will do it:
    #include <unistd.h>
    #include <fcntl.h>
    int main&#40;int argc, char **argv&#41;
        int fd;
        fd = open&#40;"/dev/hda3", O_RDWR&#41;;
        /* Use normal lseek&#40;&#41;, read&#40;&#41;, write&#40;&#41;, etc. operations on fd */
    I think there's some ioctl that you can use to query the CHS geometry of the drive as well if you feel you need it. Naturally, the user running the program will need access to the device file.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts