Checking Disks in Linux

To provide a little background: a few months back I accidentally washed a 32 GB flash drive. I waited a few weeks for it to completely dry out and then did not use it for almost four months. I formatted it recently in Windows and it did not seem to exhibit any issues, but I wanted to know with more assurance that it was reliable. In order to test it I did the following steps:

F3 (Fight Flash Fraud)

This small utility verifies whether a flash drive has the actual amount of flash storage the drive advertises. There is only one true way to do this, write and then read that amount of data on the flash drive. This is a great command line utility. Here is the procedure:

  1. Insert flash drive
  2. Install F3, if not already installed
    sudo apt-get install f3
  3. Write test data to the drive
    f3write /media/{userName}/{driveName}/
  4. Read test data from the drive
    f3read /media/{userName}/{driveName}/

After the read test, if there is no corrupt, slightly changed, or overwritten data, you should be good to go with the flash drive. If you do encounter issues, you might have a bad flash drive or a knock-off drive. The output will also tell you the average read and write speed.

Source: https://askubuntu.com/a/666926 (User: bmaupin)

DDRescue

This utility is usually meant for rescuing files from a failing disk, but it can also be used to verify the integrity of a disk. Here is the procedure:

  1. Insert flash drive
  2. Enumerate disks available and look for flash drive name (sda, sdb, sdc, etc…)
    lsblk
  3. Install DDRescue
    sudo apt-get install gddrescue
  4. Erase beginning of disk (optional)
    sudo dd if=/dev/zero of=/dev/{diskName} bs=16M count=100
  5. Synchronize disk caches
    sync
  6. Check disk
    sudo ddrescue --force /dev/{diskName} /dev/null /home/{profileName]/file.log
  7. Check output log file
    nano /home/{profileName]/file.log

Check the output file to see if there were any error listed. If there are none, your drive should be good to go. Our work is done here.

Source: Jon Jeffels (Twitter | LinkedIn | Blog | Email)

Leave a Reply

Your email address will not be published. Required fields are marked *