加入星計劃,您可以享受以下權益:

  • 創(chuàng)作內(nèi)容快速變現(xiàn)
  • 行業(yè)影響力擴散
  • 作品版權保護
  • 300W+ 專業(yè)用戶
  • 1.5W+ 優(yōu)質(zhì)創(chuàng)作者
  • 5000+ 長期合作伙伴
立即加入
  • 正文
  • 相關推薦
  • 電子產(chǎn)業(yè)圖譜
申請入駐 產(chǎn)業(yè)圖譜

Linux的df命令

10/02 11:25
567
閱讀需 8 分鐘
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點資訊討論

幫助文檔

openailab@openailab-System-Product-Name:~/oaldata$ df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include pseudo, duplicate, inaccessible file systems
  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes;
                           see SIZE format below
  -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)
  -H, --si              print sizes in powers of 1000 (e.g., 1.1G)
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
      --output[=FIELD_LIST]  use the output format defined by FIELD_LIST,
                               or print all fields if FIELD_LIST is omitted.
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
      --total           elide all entries insignificant to available space,
                          and produce a grand total
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).

FIELD_LIST is a comma-separated list of columns to be included.  Valid
field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',
'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/df>
or available locally via: info '(coreutils) df invocation'

有個疑惑

在這里插入圖片描述
如圖,我的Linux系統(tǒng),有1T固態(tài)硬盤和3.6T機械硬盤,我想知道“/home/openailab/oaldata/datasets”路徑使用哪個磁盤進行存儲。我該怎么做?

Linux文件存儲在哪里?

一個想法

從掛載情況來看,根目錄掛載在固態(tài)硬盤上,也就是所有路徑的起點 “/”。如果這樣的話,目測路徑“/home/openailab/oaldata/datasets”的存儲,使用的就是固態(tài)硬盤。

一個實踐

為了驗證這個想法,我們往這個路徑下存東西,先存他一個T。

在這里插入圖片描述

結果沒到1個T,固態(tài)硬盤就滿了。這也就驗證了我的想法,該路徑使用的是固態(tài)硬盤存儲。

兩個需求

1、我該如何判斷該路徑使用的是哪個磁盤?

通過幫助文檔,df命令帶了一個參數(shù)file:df [OPTION]… [FILE]…

所以,可以把這個file加上,來查看掛載目錄:

df -h /home/openailab/oaldata

在這里插入圖片描述

2、我想讓該路徑使用機械硬盤,我該如何做?

因為這個路徑下面已經(jīng)存有東西,如果直接掛載的話,將會導致該目錄下的文件直接丟失。因此,我們需要進行備份,請看我下一篇博客:mount命令。

相關推薦

電子產(chǎn)業(yè)圖譜