Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am using an embedded platform in which i have connected an external harddisk (/dev/sda). The SCSI driver is present and i am using the SG_IO interface for performing the SMART commands with the Hard Disk. (Unfortunately not all the HDIO ioclts are present. So i opted for the SG_IO ioctl).
But the data transfer (reading/write data from/to sector) is not working with the SG_IO ioctls. So i searched for some other options.
Later in one of the places, i found that we can actually mount the /dev/sda to some mount point in /mnt and then make a XFS file system (mkfs.xfs) of this. And then we can create the directories and do file operations on this mounted directory. Here the simple read/write systems calls can be used for this.
I was thinking about this implementation. But i am confused how i can map the actual LBA (Logical Block Address) to the device file offset. I mean if i want to write to the sector 5, there will be a LBA for it. So i can do lseek on my device and then write the data there. So how the mapping between LBA and device file offset can be calculated.
Please let me know if you need any clarification on the query.
No. I have not yet tried out YAFFS. But I have seen that the XFS allows the read/write operations successfully. But my main problem is mapping the Device File Offset with the LBA. ie, instead of writing to the mounted directories/files i want to access the particular HDD sectors.
No small task, as the drives lie blind all the time. There is a history to it, in that dos (and bios) allowed a max of 1024 tracks and 63 sectors. People quickly started using first 63, then 255 heads to accomodate the extra space beyond whet the standard makers ever imagined. Now it's gone ape altogether, with zillions of tracks & sectors. There is bound to be gpl code out there doing this already. I suggest you go there.