LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Monitor USB keydrive for errors? (https://www.linuxquestions.org/questions/linux-software-2/monitor-usb-keydrive-for-errors-4175633856/)

littlebigman 07-12-2018 05:16 AM

Monitor USB keydrive for errors?
 
Hello,

I use a USB keydrive to run a Linux appliance.

Is there a way to monitor read/write errors and receive an e-mail, so that I know it's time to get a new keydrive?

Code:

~#  lshw -short
H/W path          Device    Class      Description
===================================================
                            system    Globalscale Technologies SheevaPlug
/0                          bus        Motherboard
/0/0                        processor  cpu
/0/1                        memory    501MiB System memory
/1                usb1      bus        EHCI Host Controller
/1/1              scsi0      storage    DataTraveler 2.0
/1/1/0.0.0        /dev/sda  disk      31GB DataTraveler 2.0
/1/1/0.0.0/0      /dev/sda  disk      31GB
/1/1/0.0.0/0/1    /dev/sda1  volume    243MiB Linux filesystem partition
/1/1/0.0.0/0/2    /dev/sda2  volume    28GiB EXT4 volume
/1/1/0.0.0/0/3    /dev/sda3  volume    489MiB Extended partition
/1/1/0.0.0/0/3/5  /dev/sda5  volume    489MiB Linux swap volume
/2                eth0      network    Ethernet interface

~#  lshw -C storage
  *-usb
      description: Mass storage device
      product: DataTraveler 2.0
      vendor: Kingston
      physical id: 1
      bus info: usb@1:1
      logical name: scsi0
      version: 1.00
      serial: C86000BDB8B9CE618A2D240C
      capabilities: usb-2.00 scsi emulated
      configuration: driver=usb-storage maxpower=200mA speed=480Mbit/s

Thank you.

michaelk 07-12-2018 08:34 AM

I assume that your exceeding the drives write cycle limit versus file system corruption or other errors. From my experience they either become read only or just die and not something that gets worse over time. How often do your drives fail?

Unfortunately, flash drives typically do not have SMART capabilities or most USB bridges do not pass those commands so there isn't any good method as far as I know to determine remaining life like a SSD. In addition cheap flash drives only have about 1000 cycle write limit or so which means if your writing/deleting lots of data you could wear one out fairly quickly.

Shadow_7 07-12-2018 10:18 AM

I've only had one fail so far. When it happened, it randomly turned off the computer, at least once, maybe twice (?kernel panic???, but it failed to a power OFF state). After which it doesn't even get recognized.

Typically I use a stick as my main OS drive for about six months, then I just swap in a new one out of paranoia. I tend to use 32GB sticks and by six months, I have enough cruft to need more space via a new stick and a minimal install.

I've had like 3x SDHC cards fail so far, mostly to read-only states. No real errors per say, just random oddness. The worst in the SDHC category failed after only 4 hours of use. But MOST of my flash devices are still functional.

I tend to dd zeros to the devices and use cmp to check that it is zeros. If it fails that at anything other than out of space / end of device, then I know it has failed.

jefro 07-12-2018 01:06 PM

I get the feeling that some usb drives do support smart.

However you are simply waiting for it's death. Might consider a usb mechanical/ssd drive instead.

kontzBern 07-17-2018 10:12 AM

Well, I had that issue with Ubuntu, the clear reinstallation of OS was the very thing resolved it

littlebigman 07-18-2018 07:06 AM

Quote:

Originally Posted by michaelk (Post 5878460)
How often do your drives fail?

The previous USB stick lasted about a year, with the appliance running 24/7.

Quote:

Originally Posted by michaelk (Post 5878460)
Unfortunately, flash drives typically do not have SMART capabilities or most USB bridges do not pass those commands so there isn't any good method as far as I know to determine remaining life like a SSD. In addition cheap flash drives only have about 1000 cycle write limit or so which means if your writing/deleting lots of data you could wear one out fairly quickly.

Considering it's used to host a couple of read-only web sites, is it possible + a good idea to move eg. /tmp to RAM to keep the write cycle to a minimum ?

At worst, it only takes about 30mn to install Debian on a new USB stick and restore data, though.

littlebigman 07-25-2018 04:00 PM

As an alternative to a USB stick, I could use a small SSD. I assume they are more reliable than USB keydrives.

The device has a regular, full-size USB port, and an SD card port.

Based on experience, which port do you suggest I use to connect the SSD?

Thank you.

jefro 07-25-2018 05:15 PM

I'd think that good ssd's are way more reliable than a usb flash drive.

Not sure I've seen a ssd that connects to a sd card port. You may mean a sd card that could be as good or better than a usb flash on some highest quality ones. An external mechanical or ssd would be usb (or fireware or esata or ssd or nas or iscsi or .....)

littlebigman 07-25-2018 05:41 PM

There are SSD-to-(USB|SD) adaptors.

Before ordering, I need to know which you would recommend, considering this is just a tiny, home appliance to handle a couple of brochure web sites.

--
Edit: According to Google, SSD-to-USB seems more common.


All times are GMT -5. The time now is 05:25 PM.