C-Program to read the SMART-log of a SATA drive

Every SATA drive provides some basic health and statistics information; That information is called SMART(SELF-MONITORING, ANALYSIS AND REPORTING TECHNOLOGY). Information like Number of Bad Blocks, Height of Read/Write Head(in HDD), Host Pages Written, Flash Pages Written(in SSD) etc are sent in SMART log command. Here in this article, we will see how to launch a … Continue reading C-Program to read the SMART-log of a SATA drive

C-Program to Write an LBA of ATA-based Drive using SCSI generic driver

Please, study and know, how to read an LBA before you attempt to write otherwise how would you verify¬†that you have successfully written onto the drive. Just like the READ, we will here also use the generic SCSI driver. Program for Write will be quite similar to Read. We will use the WRITE(16 bytes) SCSI … Continue reading C-Program to Write an LBA of ATA-based Drive using SCSI generic driver

C-Program to Read an LBA from Storage Drives(ATA-based) using SCSI GENERIC driver

Let me first answer the question why are we using SCSI driver to read a drive which uses ATA protocol for communication. We will employ the environment of Linux to read an LBA from the drive. In Linux, even the ATA drives register itself as SCSI drives. So SCSI is used to communicate with ATA … Continue reading C-Program to Read an LBA from Storage Drives(ATA-based) using SCSI GENERIC driver

NATIVE COMMAND QUEUEING(NCQ)in SATA DRIVES

Native Command Queueing(NCQ) allows 32 commands to be queued inside the drives, which are then sorted to reduce Seek Time and Rotational Latency, considering the LBAs of commands and present position of the Head. Let's first understand how HDD works. HDD stores the data on magnetic platters which are attached to a motor that rotates … Continue reading NATIVE COMMAND QUEUEING(NCQ)in SATA DRIVES

Understanding malloc() and free() with their implementation on an array in C

malloc() function is used for getting memory allocated from Heap section of memory. Heap is a memory section, beside Stack, that is used to store the application/process data at run time. The Stack is at top of memory area allocated to a process whereas Heap is below the Stack; The stack grows downward while Heap … Continue reading Understanding malloc() and free() with their implementation on an array in C