12

In my case i see:

~$ sudo lsblk 
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                     7:0    0 367,3M  1 loop  /snap/clion/69
loop1                     7:1    0    44M  1 loop  /snap/ffmpeg/206
loop2                     7:2    0  14,8M  1 loop  /snap/gnome-characters/258
loop3                     7:3    0 141,8M  1 loop  /snap/skype/60
loop4                     7:4    0  14,8M  1 loop  /snap/gnome-characters/206
loop5                     7:5    0   518M  1 loop  /snap/libreoffice/117
loop6                     7:6    0  45,4M  1 loop  /snap/ffmpeg/403
loop7                     7:7    0 134,3M  1 loop  /snap/icq-im/21
loop8                     7:8    0  53,7M  1 loop  /snap/core18/941
loop9                     7:9    0 169,4M  1 loop  /snap/gimp/113
loop10                    7:10   0 154,6M  1 loop  /snap/chromium/705
loop11                    7:11   0 225,1M  1 loop  /snap/webstorm/90
loop12                    7:12   0   3,7M  1 loop  /snap/gnome-system-monitor/77
loop13                    7:13   0   372M  1 loop  /snap/pycharm-professional/125
loop14                    7:14   0 150,2M  1 loop  /snap/opera/35
loop15                    7:15   0  91,1M  1 loop  /snap/core/6531
loop16                    7:16   0   127M  1 loop  /snap/code/6
loop17                    7:17   0 222,2M  1 loop  /snap/webstorm/86
loop18                    7:18   0 456,4M  1 loop  /snap/wine-platform/128
loop19                    7:19   0 218,1M  1 loop  /snap/gimp/130
loop20                    7:20   0 300,4M  1 loop  /snap/datagrip/45
loop21                    7:21   0   151M  1 loop  /snap/gnome-

...

loop84                    7:84   0  53,7M  1 loop  /snap/core18/731
loop85                    7:85   0 140,7M  1 loop  /snap/gnome-3-26-1604/74
loop86                    7:86   0 150,2M  1 loop  /snap/opera/36
loop87                    7:87   0   368M  1 loop  /snap/clion/70
sda                       8:0    0 931,5G  0 disk  
├─sda1                    8:1    0    80G  0 part  
├─sda2                    8:2    0    68G  0 part  
└─sda4                    8:4    0 783,5G  0 part  

... 

nvme0n1                 259:0    0 238,5G  0 disk  
├─nvme0n1p1             259:1    0   512M  0 part  /boot/efi
├─nvme0n1p2             259:2    0   732M  0 part  /boot
└─nvme0n1p3             259:3    0 237,3G  0 part  
  └─nvme0n1p3_crypt     253:0    0 237,3G  0 crypt 
    ├─ubuntu--vg-root   253:1    0 236,3G  0 lvm   /
    └─ubuntu--vg-swap_1 253:2    0   976M  0 lvm   [SWAP]

But useful for me is physical disks like sda*, nvme*..

Is it possible with some params temporary hide loop* virtual devices? Or recommend me please another command for watch my devices.

17

Since the major node type of a loop block device is 7 (as shown in /proc/devices), you can use the -e or --exclude command line switch to exclude them by major type:

   -e, --exclude list
          Exclude the devices specified by  the  comma-separated  list  of
          major  device  numbers.   Note  that  RAM  disks  (major=1)  are
          excluded by default.  The filter is  applied  to  the  top-level
          devices only.

Ex.

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop1    7:1    0  17.9M  1 loop /snap/pdftk/1
loop2    7:2    0  89.3M  1 loop /snap/core/6673
loop3    7:3    0  91.1M  1 loop /snap/core/6531
loop4    7:4    0    20K  1 loop /snap/hello-world/27
loop5    7:5    0  50.7M  1 loop /snap/p7zip-desktop/163
loop6    7:6    0    20K  1 loop /snap/hello-world/29
loop7    7:7    0  17.9M  1 loop /snap/pdftk/9
loop8    7:8    0  89.4M  1 loop /snap/core/6818
sda      8:0    0 238.5G  0 disk
├─sda1   8:1    0   9.8G  0 part
├─sda2   8:2    0 164.7G  0 part
├─sda3   8:3    0  31.1G  0 part /
├─sda4   8:4    0     1K  0 part
├─sda5   8:5    0  15.3G  0 part /usr/local
└─sda6   8:6    0  17.7G  0 part /home
sr0     11:0    1  1024M  0 rom

but

$ lsblk -e7
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238.5G  0 disk
├─sda1   8:1    0   9.8G  0 part
├─sda2   8:2    0 164.7G  0 part
├─sda3   8:3    0  31.1G  0 part /
├─sda4   8:4    0     1K  0 part
├─sda5   8:5    0  15.3G  0 part /usr/local
└─sda6   8:6    0  17.7G  0 part /home
sr0     11:0    1  1024M  0 rom
4

You could use grep to filter the output:

lsblk | grep -v '^loop'

This will remove lines that start with loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.