How to install lsblk on CentOS 5

24,734

It's in the following package. You can use this command to install it on CentOS 6+:

$ sudo yum install util-linux-ng

Example

$ lsblk 
NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0                          11:0    1 1024M  0 rom  
vda                         252:0    0   10G  0 disk 
├─vda1                      252:1    0  500M  0 part /boot
└─vda2                      252:2    0  9.5G  0 part 
  ├─vg_mungr-lv_root (dm-0) 253:0    0  8.6G  0 lvm  /
  └─vg_mungr-lv_swap (dm-1) 253:1    0  992M  0 lvm  [SWAP]

You can see what package a program is in with this command:

$ which lsblk
/bin/lsblk

$ rpm -qf /bin/lsblk
util-linux-ng-2.17.2-12.9.el6_4.3.x86_64

Other ways to find its package

$ yum whatprovides */lsblk
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.tds.net
 * epel: fedora-epel.mirror.lstn.net
 * extras: centos.someimage.com
 * updates: mirror.beyondhosting.net
76 packages excluded due to repository priority protections
util-linux-ng-2.17.2-12.9.el6.i686 : A collection of basic system utilities
Repo        : base
Matched from:
Filename    : /bin/lsblk
...

You can also use repoquery to look for packages that provide a particular executable, search by filename aka. -f:

$ repoquery -f */lsblk
util-linux-ng-0:2.17.2-12.9.el6_4.2.i686
util-linux-ng-0:2.17.2-12.9.el6_4.3.x86_64
util-linux-ng-0:2.17.2-12.9.el6_4.2.x86_64
util-linux-ng-0:2.17.2-12.9.el6_4.3.i686
util-linux-ng-0:2.17.2-12.9.el6.i686
util-linux-ng-0:2.17.2-12.9.el6.x86_64

Or you can do it using this:

$ repoquery --whatprovides */lsblk
util-linux-ng-0:2.17.2-12.9.el6_4.2.i686
util-linux-ng-0:2.17.2-12.9.el6_4.3.x86_64
util-linux-ng-0:2.17.2-12.9.el6_4.2.x86_64
util-linux-ng-0:2.17.2-12.9.el6.x86_64
util-linux-ng-0:2.17.2-12.9.el6.i686
util-linux-ng-0:2.17.2-12.9.el6_4.3.i686

Notice that the argument in most of the above examples is */lsblk. This allows repoquery to search for any matches whose path can vary, i.e. the */.

Share:
24,734

Related videos on Youtube

Tensigh
Author by

Tensigh

Updated on September 18, 2022

Comments

  • Tensigh
    Tensigh almost 2 years

    I'm more used to Debian so yum and CentOS is a little new to me.

    Apparently, lsblk is not available on this system. I'm trying to install it via yum with no luck. I just get "nothing to do".

    I updated the CentOS-Base.repo file and ran yum clean all. It still doesn't find the package.

    What should be my next step?

    • Ignacio Vazquez-Abrams
      Ignacio Vazquez-Abrams almost 11 years
      What does this program do?
    • Bratchley
      Bratchley almost 11 years
      If you ever want to know what package contains a given file on a Red Hat-based distro, use the whatprovides subcommand to yum. In this case you would do a yum whatprovides */lsblk
  • Tensigh
    Tensigh almost 11 years
    Thank you for all of your help. I think my problem is with the repos. None of those commands work.
  • Tensigh
    Tensigh almost 11 years
    <Hit return too soon> When I tried "yum install util-linux-ng", I still got "Nothing to Do".
  • slm
    slm almost 11 years
    @Tensigh - notice I said this is only available in CentOS 6+. It's not easily available for CentOS 5.
  • slm
    slm almost 11 years
    @Tensigh - it doesn't appear to be available in a CentOS 5 repository.