Giter Club home page Giter Club logo

Comments (3)

narasimhan-v avatar narasimhan-v commented on August 30, 2024

@naveedus Can you please check this one ?

from avocado-misc-tests.

fkromer avatar fkromer commented on August 30, 2024

One could check for hard disks with sudo lshw -class disk which gives in case of a single ATA disk an output containing description: ATA Disk. Even if eMMC devices are present in the system they will not be contained in the output.

from avocado-misc-tests.

fkromer avatar fkromer commented on August 30, 2024

Improvement

If the system uses an eMMC the use of mmc-utils could be suitable to implement a health check (superuser - Check health of eMMC). badblocks (in package e2fsprogs) could possibly be used as well. In comparison with SMART badblocks it writes simple patterns to every block of a device and then reads and checks them searching for damaged areas instead of passively waiting for errors archlinux - badblocks.

Executing a non-destructive eMMC test could be executed with badblocks -nsv /dev/mmcblk0. Remotely executing a badblocks based eMMC check could be done as follows:

#!/usr/bin/env python
# execute with: python check_mmc.py

from pexpect import pxssh
import re

try:
    s = pxssh.pxssh()
    hostname = "<IP-ADDRESS>"
    username = "rc"
    password = "<PASSWORD>"
    s.login(hostname, username, password)
    rootprompt = re.compile('.*[$#]')
    s.sendline('sudo -s')
    i = s.expect([rootprompt,'assword.*: '])
    if i==0:
        print "didnt need password!"
        pass
    elif i==1:
        print "sending password"
        s.sendline(password)
        j = s.expect([rootprompt,'Sorry, try again'])
        if j == 0:
            print("password accepted")
            pass
        elif j == 1:
            raise Exception("bad password")
    else:
        raise Exception("unexpected output")
    s.set_unique_prompt()
    s.sendline('badblocks -nsv /dev/mmcblk0')
    s.prompt()
    print(s.before)
    s.logout()
except pxssh.ExceptionPxssh as e:
    print("pxssh failed on login.")
    print(e)

However this will only work for eMMC devices which are not in use. For devices in use you get an output like this:

$ python check_mmc.py 
sending password
password accepted
badblocks -nsv /dev/mmcblk0
/dev/mmcblk0 is apparently in use by the system; it's not safe to run badblocks!

from avocado-misc-tests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.