how do i read a block

Matthias Brugger matthias.bgg at gmail.com
Mon May 13 12:22:22 EDT 2013


El 13/05/2013 10:07, "shampavman" <shampavman.cg at gmail.com> va escriure:
>
> Hi all,
>
> Supposing i create a file of size 10K, it will occupy 2 blocks (4K each).
> Now if i want to read only 1 block from it how can i do it?
>
> read(fd, buf, 4096) ;
> would this mean i would read the first block and all its contents?

You actually might even read more, depending on your file system. The
dentrys and inodes are stored in blocks on the disk as well. You can try to
access your disk through /dev/sdX directly, but beware that when writing
you will most probably destroy your data on that disk.

Regards,
Matthias

>
> Thanks
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130513/2c2251a1/attachment.html 


More information about the Kernelnewbies mailing list