Lsblk

lsblk 在某些分區上不顯示大小

  • December 29, 2020

(Ubuntu 20.04)

lsblk -f顯示:

NAME        FSTYPE     LABEL             UUID                                 FSAVAIL FSUSE% MOUNTPOINT
---
nvme0n1                                                                                      
├─nvme0n1p1 ntfs       Recovery          A6F8B146F8B11611                                    
├─nvme0n1p2 vfat                         B6B1-83C2                              62,5M    34% /boot/efi
├─nvme0n1p3                                                                                  
├─nvme0n1p4 ntfs                         EA9CC7CA9CC7900D                       77,9G    60% /media/az/EA9CC7CA9CC7900D
├─nvme0n1p5 ntfs                         8EFE5BB7FE5B9675                                    
├─nvme0n1p6 ext4                         30c2e908-17b9-47a2-b68a-5a0df3f62f8e  513,5G    23% /
└─nvme0n1p7 swap                         7c366bb0-c008-4285-8a67-1acae6e25d2d                [SWAP]

它沒有顯示其中一些分區的大小,例如nvme0n1p1, nvme0n1p3, nvme0n1p5, nvme0n1p7。也許是因為它無法提取該資訊。

但是獲取分區的絕對大小應該總是有效的。

所以我嘗試了lsblk --output NAME,FSTYPE,LABEL,UUID,FSSIZE,FSAVAIL,FSUSE%,MOUNTPOINT

NAME        FSTYPE     LABEL             UUID                                 FSSIZE FSAVAIL FSUSE% MOUNTPOINT
...
nvme0n1                                                                                             
├─nvme0n1p1 ntfs       Recovery          A6F8B146F8B11611                                           
├─nvme0n1p2 vfat                         B6B1-83C2                               95M   62,5M    34% /boot/efi
├─nvme0n1p3                                                                                         
├─nvme0n1p4 ntfs                         EA9CC7CA9CC7900D                     194,3G   77,9G    60% /media/az/EA9CC7CA9CC7900D
├─nvme0n1p5 ntfs                         8EFE5BB7FE5B9675                                           
├─nvme0n1p6 ext4                         30c2e908-17b9-47a2-b68a-5a0df3f62f8e   714G  513,5G    23% /
└─nvme0n1p7 swap                         7c366bb0-c008-4285-8a67-1acae6e25d2d                       [SWAP]

但它仍然沒有顯示出來。為什麼?我怎樣才能lsblk顯示這些資訊?

sudo fdisk -l /dev/nvme0n1比較得到資訊:

Disk /dev/nvme0n1: 931,53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 970 EVO Plus 1TB            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4B824D75-DA39-42FF-815F-87DF7ADB2401

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048     923647     921600   450M Windows recovery environment
/dev/nvme0n1p2     923648    1126399     202752    99M EFI System
/dev/nvme0n1p3    1126400    1159167      32768    16M Microsoft reserved
/dev/nvme0n1p4    1159168  408538890  407379723 194,3G Microsoft basic data
/dev/nvme0n1p5  408539136  409597951    1058816   517M Windows recovery environment
/dev/nvme0n1p6  409597952 1933035519 1523437568 726,4G Linux filesystem
/dev/nvme0n1p7 1933035520 1948659711   15624192   7,5G Linux swap

(順便說一句,相關問題,因為我正在尋找一個很好的工具來列印有關我所有磁碟的資訊:herehere

我剛剛發現:FSSIZE是錯誤的標誌。我需要的只是SIZE

lsblk --output NAME,FSTYPE,LABEL,UUID,SIZE,FSAVAIL,FSUSE%,MOUNTPOINT給出:

NAME        FSTYPE     LABEL             UUID                                   SIZE FSAVAIL FSUSE% MOUNTPOINT
...
nvme0n1                                                                       931,5G                
├─nvme0n1p1 ntfs       Recovery          A6F8B146F8B11611                       450M                
├─nvme0n1p2 vfat                         B6B1-83C2                               99M   62,5M    34% /boot/efi
├─nvme0n1p3                                                                      16M                
├─nvme0n1p4 ntfs                         EA9CC7CA9CC7900D                     194,3G   77,9G    60% /media/az/EA9CC7CA9CC7900D
├─nvme0n1p5 ntfs                         8EFE5BB7FE5B9675                       517M                
├─nvme0n1p6 ext4                         30c2e908-17b9-47a2-b68a-5a0df3f62f8e 726,4G  513,5G    23% /
└─nvme0n1p7 swap                         7c366bb0-c008-4285-8a67-1acae6e25d2d   7,5G                [SWAP]

引用自:https://unix.stackexchange.com/questions/626607