lsblk odd results

Ralf Mardorf silver.bullet at zoho.com
Fri Feb 22 07:32:17 UTC 2019


On Thu, 21 Feb 2019 20:43:20 -0000, Grizzly via ubuntu-users wrote:
>I have been trying to check (confirm) if some of my laptop drives are
>SSD's
>
>$ lsblk -d -o Name,Rota
>
>returns 1's for all drives (I take to mean all are Rotational drives
>not Solid State), I got curious as I was sure some had SSD's so I
>pluged in a pair of usb memory stick/flash drives they also return
>"1's" so something is not correct

Hi,

the output is correct, your reasoning isn't.

0 = true  or right
1 = false or wrong

$ lsblk --help | grep ROTA
        ROTA  rotational device

IOW an USB memory stick in _not_ a rotational device, so it returns
'rotational device = false'.

My PC is equipped with 4 internal SSDs and an internal DVD drive, so the
output I get is correct:

$ lsblk -d -o NAME,ROTA
NAME ROTA
sda     0
sdb     0
sdc     0
sdd     0
sr0     1

If you check the exit status of a command, you'll see the same,
0 = right, anything else is the status for something wrong, for example:

$ ls CDs/bad_brains-god_of_love/*Right*
CDs/bad_brains-god_of_love/04-Rights_of_a_Child.wav
$ echo $?
0
$ ls CDs/bad_brains-god_of_love/*Wrong*
ls: cannot access 'CDs/bad_brains-god_of_love/*Wrong*': No such file or directory
$ echo $?
2

Regards,
Ralf





More information about the ubuntu-users mailing list