While installing a new computer (soon a post on my new arch-linux laptop) I’ve re-discovered a command that I don’t use frequently, but that can be really useful :
lsblk lists information about all or the specified block devices. The
lsblk command reads the
sysfs filesystem to gather information.
The command prints all block devices (except RAM disks) in a tree-like format by default.
This command can be very useful to check how the different partitions and/or disks are mounted in the system, this is an example on my desktop:
#lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465.8G 0 disk ├─sda1 8:1 0 46.6G 0 part / ├─sda2 8:2 0 1K 0 part ├─sda5 8:5 0 3.7G 0 part [SWAP] └─sda6 8:6 0 415.5G 0 part sdb 8:16 0 465.8G 0 disk └─sdb1 8:17 0 465.8G 0 part └─md0 9:0 0 465.7G 0 raid10 /data sdc 8:32 0 465.8G 0 disk └─sdc1 8:33 0 465.8G 0 part └─md0 9:0 0 465.7G 0 raid10 /data sdd 8:48 1 14.9G 0 disk └─sdd1 8:49 1 14.9G 0 part /media/linuxaria/KINGSTON sr0 11:0 1 1024M 0 rom
From this output you can see that on this desktop I’ve the following disks:
SDA the fist “scsi” disk, in my case a SATA disk.
On this disk the first partition is used for the / filesystem, the second partition it’s an extended partition, the third it’s my swap partition and the last one (sda6) is used for my /home, it’s a BTRFS filesystem and the command don’t recognize it,
SDB and SDC are the two disks that I use in RAID 10 and the filesystem is mounted as /data
SDD it’s an USB stick of 16GB mounted under the directory /media/linuxaria/KINGSTON
An output of a computer with LVM could be:
$ lsblk NAME MAJ:MIN RM SIZE RO MOUNTPOINT sda 8:0 0 298.1G 0 ├─sda1 8:1 0 500M 0 /boot └─sda2 8:2 0 297.6G 0 ├─vg_main-lv_swap (dm-0) 253:0 0 5.8G 0 [SWAP] ├─vg_main-lv_root (dm-1) 253:1 0 50G 0 / └─vg_main-lv_home (dm-2) 253:2 0 241.8G 0 └─home (dm-3) 253:3 0 241.8G 0 /home sr0 11:0 1 1024M 0
So as you can see this command it’s really easy to use and the output it’s really polish in its tree style, with a glance you can recognize partitions, logical volume and other useful information of your disks.
fdisk -l gives similar data. But, fdisk requires root privileges, and It does not understand dm or lvm partitions.
- The legacy of Mandrake Linux: Rosa Linux
- Linux Terminal: How to color the output in bash scripts
- Linux Terminal: Manage Processes with killall and kill
- Play your Music on Linux with Music Player Daemon
- How to measure memory usage in Linux
Find me on Google+