Lsblk

From TheBestLinux.com
Jump to navigation Jump to search

lsblk stands for List Block Devices, which are storage devices connected to the system.

The first thing that comes to mind when thinking about Block Devices are Hard Drives, both the old school spinning magnetic disks type, be them hard disks or even Floppy Disks. Both are considered "Block Devices" when it comes to Linux systems. CD,DVD, Blue-Ray, and others are all considered Block Devices! Say you have an old DVD burner, and plug it into a USB port on your computer. On modern Linux distributions, the Device will be automatically detected and if there is a disk inserted, it will attempt to mount t hat disk.

From the command line is where "lsblk" is actually used, when usually when trying to identify a disk! There are a ton of flags that can be used with the "lsblk" command, 38 when I just used grep to count the flags, but I just discovered yet another new way to use a command after only 30+ years of using Linux! I love learning new stuff all the time, which is why I Love Linux!!! This new flag(at least new to me!) is the -f flag. WOW!!! is what I yelled when I saw it's output!!! Check it out! Try it on your system. Here's the command run on my main office desktop server:

[root@server.dawgland.com:~]# lsblk -f
NAME FSTYPE FSVER LABEL              UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                      
├─sda1
│    vfat   FAT32                    E4AB-4EF4                              45.3M    53% /boot/efi
├─sda2
│                                                                                        
├─sda3
│    ntfs                            D40A10740A1055B8                                    
├─sda4
│    ntfs                            2CAAEBCDAAEB921E                                    
├─sda5
│    ntfs                            2AF05AAEF05A804D                                    
├─sda6
│    ext4   1.0                      317c41c1-57f6-4e33-980c-5adbed46b7f8  543.7M    37% /boot
├─sda7
│    swap   1                        c7b8c882-479c-482e-8745-7f1873c9bfab                [SWAP]
├─sda8
│    btrfs        Fedora-40          cb541999-f1a7-4e06-bb10-8e9b581b5c2a  912.3G    26% /tmp
│                                                                                        /var
│                                                                                        /home
│                                                                                        /
└─sda9
     btrfs        Fedora-40          cb541999-f1a7-4e06-bb10-8e9b581b5c2a                
sdb  isw_ra 1.3.0                                                                        
├─md126
│ │                                                                                      
│ ├─md126p1
│ │  vfat   FAT32 ESP                541A-F54A                                           
│ ├─md126p2
│ │                                                                                      
│ ├─md126p3
│ │  ntfs         OS                 C0601CC7601CC656                                    
│ ├─md126p4
│ │  ntfs         WINRETOOLS         6CBC2177BC213CC8                                    
│ ├─md126p5
│ │  ntfs         Image              60F6222CF62202C0                                    
│ └─md126p6
│    ntfs         DELLSUPPORT        C4A6230DA622FF92                                    
└─md127
                                                                                         
sdc  isw_ra 1.3.0                                                                        
├─md126
│ │                                                                                      
│ ├─md126p1
│ │  vfat   FAT32 ESP                541A-F54A                                           
│ ├─md126p2
│ │                                                                                      
│ ├─md126p3
│ │  ntfs         OS                 C0601CC7601CC656                                    
│ ├─md126p4
│ │  ntfs         WINRETOOLS         6CBC2177BC213CC8                                    
│ ├─md126p5
│ │  ntfs         Image              60F6222CF62202C0                                    
│ └─md126p6
│    ntfs         DELLSUPPORT        C4A6230DA622FF92                                    
└─md127
                                                                                         
sdd  iso966 Jolie Fedora-KDE-Live-43 2025-10-23-04-17-29-00                              
├─sdd1
│    iso966 Jolie Fedora-KDE-Live-43 2025-10-23-04-17-29-00                     0   100% /run/media/jamie/Fedora-KDE-Live-43
└─sdd2
     vfat   FAT16 BOOT               BA0E-CF8F                                           
sr0                                                                                      
zram0
                                                                                         [SWAP]



The "NEW" part, to me, of the -f flag, it just giving the flag without any arguments. In the past, I have ALWAYS givent the -f flag the argument of the mount point of the block device I want to tet the UUID for. I never knew that the -f flag given without any arguments or mount points gives the mount point and the UUID of EVERY block device! So easy, and gives me the extra info I usually always need, other mount points with their UUID's! I am so happy to discover this new way to use the -f flag on the lsblk command! :)