LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 06-28-2010, 01:06 AM   #1
aneeshcav
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Rep: Reputation: 0
Hard disk data transfer accessing error...


Hi,
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.

Regards,
Aneesh
 
Old 06-28-2010, 04:54 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,564

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
If you can actually write, and you are using something embedded, have you investigated yaffs and the other formats aimed at such machines?
 
Old 06-28-2010, 05:06 AM   #3
aneeshcav
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Hi,
Thanks for the reply.

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.

Regards,
Aneesh
 
Old 06-29-2010, 05:32 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,564

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
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.
 
Old 06-29-2010, 08:54 AM   #5
aneeshcav
LQ Newbie
 
Registered: Feb 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Oh ok. I will do some searching for the same. If you have came across any link for the same, please share the same. Thanks.

Regards,
Aneesh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to transfer data from one hard drive to another? xpus04 Linux - Hardware 3 10-04-2009 04:43 AM
Copy of IBM Server hard disk data to Another USB External Hard disk mazharcdn Linux - Server 2 09-02-2009 01:41 AM
Hard Disk Failure: How do I move data to a new hard disk drive? spyros Linux - Software 2 10-31-2008 04:01 PM
Error while copying data to other Hard disk fa_khan50 Linux - Newbie 6 03-24-2008 07:46 AM
estimating the data transfer rate between hard disk sharathksin Programming 1 02-27-2006 10:25 PM


All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration