如何查找安装了OS的磁盘的大小


-2

如何验证磁盘大小(安装操作系统的磁盘)

我们有redhat 7.2

我会举个例子

# disk_os_size=` lsblk | grep sda `
sda                8:0    0   150G  0 disk
├─sda1             8:1    0   500M  0 part /boot
└─sda2             8:2    0 149.5G  0 part


# disk_os_size=` lsblk | grep sda | awk '{print $4}' `
# echo $disk_os_size
150G 500M 149.5G

所以在这种情况下效果不好,因为我们还获得了OS分区

我们想要的只是操作系统磁盘的大小,应该是150G

Answers:



0

如何df -h /findmnt -D /findmnt -P / | sed -nr -e 's~.* SOURCE="([^"]*)" .*~\1~p' | xargs lsblk

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.