Partitioning [SOLVED]: How to clean '/dev/sdx' cache?

Partitioning [SOLVED]: How to clean '/dev/sdx' cache?

Home Forums Partitioning Partitioning [SOLVED]: How to clean '/dev/sdx' cache?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #35525



    I’m facing a problem in my ubuntu system, as it is for testing, I usually issue the command:

    echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi

    I’m just using the ata1 port.

    When I finish the tests I just issue:

    echo "scsi remove-single-device 0 0 0 0" > /proc/scsi/scsi

    But, as I started using ata commands, this process no longer works, as it attached to the system.

    For example,


    This commands always returned the /dev/sdb mounted, and the other command simply unmounted the drive, not attaching it to the system.


    This commands I mentioned, seem to work, but continue to fill the cache with the next letter for every drive I test, say:

    First test: /dev/sdb

    Second test: /dev/sdc

    and so on until I run out of letters because the system cannot issue past the dev/sdz

    Can someone tell me how to flush the cache or how to workaround this issue?

    I would REALLY appreciate any help.



    Accepted AnswerAnswer

    I have found the problem with the actual “cache”.

    I had a piece of code that was letting a file descriptor open in each drive test until the program filled up all remaining spaces for fd allocation. The error was in the python call open() as it was opening it with the argument os.O_RDWR instead of os.O_RDONLY.

    os.O_RDWR was letting all file descriptors opened after issuing an ATA command. After changing it to os.O_RDONLY the memory buffer was readable and the file descriptor was closed properly.

    Hope this helps anybody in a pinch.

    Author: xedge
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.