I am developing a low level SATA driver for an FPGA based embedded system. The driver is running fine.
When I read sectors from the disk using dd command, I can see that the SCSI read(10) command (opcode 0x28) is recived by my low level driver, which is I think correct. But, when I write sectors to the disk using dd command, the SCSI driver sends first read(10) command (opcode 0x28) for several times and then few write(10) commands (opcode 0x2A).
Can someone explain me, that why does SCSI driver send read() command during the write operation?
Edited: During a file write operation I can see that the driver first reads (DMA mode) from LBA 0 upto some 8 sectors. Then it writes (DMA) sg blocks and then it reads (PIO) disk specific information. After that it takes some random LBAs and performs several reads(DMA) finally it stops by reading device specific data read(PIO). This is a sequence for dd'ing 1KB file. The disk has no partition table and no file system (verified from fdisk utility ).
Is it a normal behaviour of driver? If yes then is it not decreasing the speed of operation? As overall file reading is faster than writing due to extra reads in write operation.
Thank you
Confusion in disk write operation using DD command
533 views Asked by Ganesh Kalbhor At
1
There are 1 answers
Related Questions in LINUX-DEVICE-DRIVER
- Linux support for parallel Pixel data Image sensor
- Linux to QNX USB driver convert
- IRQ interrupt obtaining abnormal possibilities
- Error compiling dts (Device Tree source) file for dtb
- How to write the external interrupt callback function of Linux kernel v3.10?
- Does traffic control (tc) command have a rate limit?
- The module first installed the alarm when it started
- How does the Linux kernel now what to put in platform_data?
- How to reduce cached memory used by Linux kernel on embedded linux platform
- Notifying Linux MMC subsystem about power loss
- Linux kernel 6.6 from block_device how to find out if it has mounted file system
- Linux SPI read and write may occasionally be slow?
- gettimeofday calculates the runtime, with occasional significant deviations?
- uImage is not supported in kexec_file
- Linux of_platform_depopulate() does not remove drivers
Related Questions in DD
- Bash script that goes trough folder and uses dd
- Cleanest way skip bytes in .RAW image file
- How to prove the accuracy of an OS files burn with dd from my PC to flash disk (for very old system)?
- How to extract img disk image from zip file, write to disk and show detailed progress?
- Where does Laravel DD() and Dump() output write to?
- Is it possible to convert a machine image to raw and pipe to `dd` at same time?
- HTML dd empty cell is not taking the equal space
- How set dd(dump and die) in yii2 framework?
- Stop DD when records out = 0+1 records in
- Write disk image to device, alike linux dd command
- The image dumped by dd are different with the origin image in Android
- dd is writing my image wrong resulting in kernel panic
- What does `_` do, in `printf (_("abc"));`, present in gnu-dd's code, but gcc giving me errors, and warning
- How to get unfolded array in browser with dump in Laravel (by default)
- the file should be not saved after ctrl C?
Related Questions in SCSI
- ISCSI and MaxOutstandingR2T
- On Linux, for a scsi device, how to make an inquiry call (sg_ll_inquiry()) to page code 00 and check which other pages are supported?
- Functions of IOUserSCSIPeripheralDeviceType00 class in SCSIPeripheralsDriverKit always return kIOReturnUnsupported (0xe00002c7)
- libaums threw IOException: unsupported PeripheralQualifier or PeripheralDeviceType
- SCSI commands that can benefit from a full duplex SAS connection
- How to send a generic SCSI command to a USB drive under MACOS
- DEXT. How to set property for SCSI device created by UserCreateTargetForId()
- 53C94 SCSI IC as target - Cannot handle WRITE(10) command from Initiator
- SCSIControllerDriverKit: Process gets stuck on UserCreateTargetForID
- When should I use REQ_OP_FLUSH in a kernel blockdev driver? (Do REQ_OP_FLUSH bio's flush dirty RAID controller caches?)
- How do I pass SCSI (CDB) commands through a USB connection
- how does Linux get the max_hw_sectors_kb value?
- Why physical disk connected to the same HBA port may have different paths?
- How to access physical address from a DriverKit driver?
- Read a sector from physical drive
Related Questions in SATA
- HDD Storage with AHCI configuration is taking long time to respond to ATA commands
- SCSI commands that can benefit from a full duplex SAS connection
- CPU, Disk, RAM, Ethernet Data Flow
- How do I send commands to NVMe drive over USB bridge?
- SATA controller
- print_req_error: critical target error, dev sdb, sector 0
- Does Linux 3.1 support Intel Optane?
- Linux scsi ata cmd write or read sometimes work and sometimes didn't work when transfer length is over 1345
- Is there a way to override libata.force during runtime?
- Accessing block device data beyond reported capacity
- Writing binary files (~12MB) consecutively very fast (30 per second) from a C++ program in Linux
- How to emulate a SATA disk drive in QEMU
- Need Script To Automatically Restart Mac Until Negotiated SATA Link Speed is SATA II
- Folder is empty while data transfer Sata Hard Drive From Laptop Into USB External Enclosure
- SATA driver; AHCI port initialisation; Start (ST) command list;
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
It's hard to say concretely without knowing more about your system. Two possibilities come to mind:
Linux is looking for partition tables. This is likely the case if the reads are to LBA 0 and the first few logical blocks, or if the reads are to the very end of the device, where there is a secondary GPT header.
You're dd'ing a file on a filesystem, and the filesystem is reading in uncached metadata.