Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all
I want to know the basics of SATA driver and how the sata devices are communicated to the driver. In PATA we have ports to access the devices.is there anything for SATA.As in a beginner stage can anyone help me?
in linux it is loaded as a scsi and linux assigns the device a sda and for every partition it is
sda1 or 2 or 3 then the next drive is sdb. the modules are built into the kernel and are detected at boot up then are ported into the loop.after this I am out of my league.
Thanks Drakeo.
Suppose if i have SATA device connected to the system , in that i have installed Linux and i want to get the serial number of the hard disk. Usually in PATA we issue identify drive command to get the device details to the port address where it is connected. But incase of SATA how can issue the command ....what is the structure for sending the commands.
I have found site that tells about sending ATA commands to SATA device using sg ioctl. I have filled the sg structure with the below value.I am running this program in Fedora4
sg_io.interface_id = 'S';
sg_io.cmdp = cdb;
sg_io.cmd_len = sizeof(cdb);
sg_io.dxferp = data_in_buffer;
sg_io.dxfer_len = 512;//data_in_length; //
sg_io.dxfer_direction = SG_DXFER_FROM_DEV;
sg_io.sbp = sense;
sg_io.mx_sb_len = sizeof(sense);
sg_io.timeout = 15000;
and CDB structure is,
cdb[0] = 0x85; // ATA pass-through 12
cdb[1] = (4 << 1); // data-in
cdb[2] = 0x2e; // data-in
cdb[4] = 0x00; // ATA feature ID
cdb[6] = 1; // number of sector
cdb[7] = 0x00; //lba_low >> 8;
cdb[8] = 0x00; //lba_low;
cdb[9] = 0x00; //lba_mid >> 8;
cdb[10] = 0x00; //lba_mid;
cdb[11] = 0x00; //lba_high >> 8;
cdb[12] = 0x00; //lba_high;
cdb[14] = 0xEC; // ATA command ID
I have checked CDB values which i am passing with the document "ATA over scsi standard passthru implementation." I am creating the handle for /dev/sda. After passing the ioctl i am getting wrong values in sense buffer.
sense buffer[0]:0x70
sense buffer[1]:0x00
sense buffer[2]:0x05
sense buffer[3]:0x00
sense buffer[4]:0x00
sense buffer[5]:0x00
sense buffer[6]:0x00
sense buffer[7]:0x06
sense buffer[8]:0x00
sense buffer[9]:0x00
sense buffer[10]:0x00. As per program, these values are not valid. I dont know how they have defined like this. Can anyone help me regarding the sense buffer values.
cat /proc/ide/ide0/hda/model
this will tell you the name and model. if you want to know if your device smart that is old stuff but still used set it to smart. when you boot the bios will read out smart drive capable and using it . if the drive is smart drive when you boot you and is not set to smart. then it willread out smart drive but not enabled good luck.
sorry I do not have a sat drive but you can find the cat /proc/ / / comand very useful.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.