Results 1 to 4 of 4

Thread: Verify if disk drive is flash

  1. #1
    Join Date
    Apr 2012
    Beans
    2

    Question Verify if disk drive is flash

    Hello,

    I am doing some project in which I need to check if my disk drive is flash or not (disk path will be input).

    I tried with some commands like

    lshw
    hdparm
    lspci

    But I'm not able to verify flash disk. I'm not understanding which specification (in th output of these commands) should I look into to check for flash memory.

    Can anyone please help me.

    Thanks and Regards,
    Sandeep P.

  2. #2
    Join Date
    May 2010
    Location
    Tewkesbury uk
    Beans
    7,655
    Distro
    Ubuntu Development Release

    Re: Verify if disk drive is flash

    Hi

    You can check if the drive is removable.

    Code:
    cat /sys/block/sda/removable
    Change sda is required.

    You can also test if it is a rotational drive

    Code:
    cat /sys/block/sda/queue/rotational
    Kind regards
    Join us on irc at #ubuntuforums. For web chat see here

    If you believe everything you read, you better not read. ~ Japanese Proverb

    Do not read newspapers on an empty stomach ~ Russian Proverb ~ BrunoLotse

  3. #3
    Join Date
    Apr 2012
    Beans
    2

    Re: Verify if disk drive is flash

    Thanks a lot for response!!

    But I am little confused is this information has any relation with disk being "flash".
    I'm mean there can be removable devices which are not flash.

    Regards,
    Sandeep.

  4. #4
    Join Date
    May 2010
    Location
    Tewkesbury uk
    Beans
    7,655
    Distro
    Ubuntu Development Release

    Re: Verify if disk drive is flash

    Hi

    * If the drive is not removable and not rotational then (presumably as i cannot test this) it an internal SSD drive.

    * If the drive if removable and not rotational then it is flash.

    * External rotational hard drives show up the same as internal ones but you can check the bus it is on i suspect.

    Take a look at this

    Code:
    matthew@matthew-Aspire-7540 ~ % ls -d /sys/block/sd?
    /sys/block/sda  /sys/block/sdb  /sys/block/sdc
    matthew@matthew-Aspire-7540 ~ %
    There are three drive on my system at the moment.

    * sda is the internal rotational drive
    Code:
    matthew@matthew-Aspire-7540 ~ % cat /sys/block/sda/{removable,queue/rotational}
    0
    1
    matthew@matthew-Aspire-7540 ~ %
    * sdb is an external rotational drive
    Code:
    matthew@matthew-Aspire-7540 ~ % cat /sys/block/sdb/{removable,queue/rotational}
    0
    1
    matthew@matthew-Aspire-7540 ~ %
    * sdc is an external flash drive.

    Code:
    matthew@matthew-Aspire-7540 ~ % cat /sys/block/sdc/{removable,queue/rotational}
    1
    0
    matthew@matthew-Aspire-7540 ~ %
    There is a load of information you can pull out of sysfs for information about the drives including which bus they are on. That can be used vto tell you if the drive is an internal or external drive.

    This is also only one method of doing this.

    Have you look at udevadm ? Change X below as required.

    Code:
    udevadm info --query=property --name /dev/sdX
    Or even udisks.

    Code:
    udisks --dump
    This will spit out a load of information about the connected drives and

    Code:
    udisks --show-info /dev/sdX
    for specific drives.

    You can the grep, sed, awk, or parameter substitute the output to your hearts content

    Check out the man pages for both.

    Kind regards
    Last edited by matt_symes; May 1st, 2012 at 06:57 PM. Reason: Fix typos and make the code sections easier to read.
    Join us on irc at #ubuntuforums. For web chat see here

    If you believe everything you read, you better not read. ~ Japanese Proverb

    Do not read newspapers on an empty stomach ~ Russian Proverb ~ BrunoLotse

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •