了解磁碟空間分割區

了解磁碟空間分割區

我有一台配備 Ubuntu Server 18.04 的專用伺服器(256 RAM,2x 240 GB SSD),現在磁碟空間分配如下:

Filesystem      Size  Used Avail Use% Mounted on
udev            126G     0  126G   0% /dev
tmpfs            26G  1.7M   26G   1% /run
/dev/md2        219G  145G   64G  70% /
tmpfs           126G   12K  126G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           126G     0  126G   0% /sys/fs/cgroup
/dev/loop0       90M   90M     0 100% /snap/core/7917
/dev/loop1      8.7M  8.7M     0 100% /snap/canonical-livepatch/88
/dev/md1        487M  146M  312M  32% /boot
tmpfs            26G     0   26G   0% /run/user/1000
Disk /dev/loop0: 89.1 MiB, 93454336 bytes, 182528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 8.5 MiB, 8941568 bytes, 17464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
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: dos
Disk identifier: 0xe5bc9ccf

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         4096   1050623   1046528   511M fd Linux raid autodetect
/dev/sda2         1050624 467808255 466757632 222.6G fd Linux raid autodetect
/dev/sda3       467808256 468854783   1046528   511M 82 Linux swap / Solaris


Disk /dev/sdb: 223.6 GiB, 240057409536 bytes, 468862128 sectors
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: dos
Disk identifier: 0xd0864b40

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1  *         4096   1050623   1046528   511M fd Linux raid autodetect
/dev/sdb2         1050624 467808255 466757632 222.6G fd Linux raid autodetect
/dev/sdb3       467808256 468854783   1046528   511M 82 Linux swap / Solaris


Disk /dev/md1: 511 MiB, 535756800 bytes, 1046400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md2: 222.6 GiB, 238979842048 bytes, 466757504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

df -h我對 中顯示的設備名稱與中的設備名稱不匹配這一事實感到有點困惑fdisk -l。目前,我只能存取 1 個 SSD (/dev/md2),我不明白第二個 SSD 的用途以及是否(以及如何)可以使用其上的磁碟空間。

答案1

您正在使用具有兩個鏡像硬碟(sda 和 sdb)的 RAID1 系統。其中fdisk -l顯示真實的實體磁碟及其分割區,df -h顯示系統使用的 raid 設備和分割區。

即由和/dev/md1組成,兩者俱有相同的內容。如果任一驅動器發生故障,另一個驅動器上的資料也是安全的。/dev/sda1/dev/sdb1

要獲取有關 raid 設備的更多詳細信息,請使用mdadm(假設是這樣完成的):

mdadm --detail /dev/md1

答案2

根據man df

If  no file name is given, the space available on all
currently mounted file systems is shown. 

並在man fdisk

-l, --list
    List the partition tables for the specified devices and then exit. If  no  devices are given, 
those mentioned in /proc/partitions (if that file exists) are used.

所以差別在於df顯示已安裝系統同時fdisk -l(不含參數)顯示列出的分區/proc/partitions

相關內容