Các lệnh dùng để kiểm tra dung lượng ổ đĩa trên VPS Linux

ID Topic: 34198 • Có 1,191 lượt xem
Hình đại diện của thành viên
#1 - @452601
21/09/2016 00:12
Trên internet bạn có thể tìm được rất nhiều công cụ kiểm tra dung lượng ổ cứng trên linux. Tuy nhiên, Linux được tích hợp một công cụ mạnh mẽ để thực hiện công việc này đó là “df”. Lệnh “df” viết tắt của “disk filesystem“, nó được dùng để lấy toàn bộ thông tin về lượng ổ cứng khả dụng và lượng ổ cứng đã dùng của các file hệ thống trên linux.

Các lệnh dùng để kiểm tra dung lượng ổ đĩa trên VPS Linux

Việc sử dụng “-h” trong lệnh “df -h” cho ta một cái nhìn trực quan hơn khi đọc các thông số ở chế độ chi tiết : bytes, mega bytes and giga bytes.

Sau đây là những lệnh “df” hay sử dụng khi quản trị hệ thống linux.


1. Kiểm tra dung lượng ổ cứng mà các file hệ thống sử dụng.
Mã:[root@vultr ~]# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       41283904 13990256  25196548  36% /
tmpfs            1962396      232   1962164   1% /dev/shm



2. Hiện thị thông tin ổ đĩa các file hệ thống sử dụng
Mã:[root@vultr ~]# df -a
Filesystem       1K-blocks     Used Available Use% Mounted on
/dev/vda1         41283904 13991596  25195208  36% /
proc                     0        0         0    - /proc
sysfs                    0        0         0    - /sys
devpts                   0        0         0    - /dev/pts
tmpfs              1962396      232   1962164   1% /dev/shm
none                     0        0         0    - /proc/sys/fs/binfmt_misc
gvfs-fuse-daemon         0        0         0    - /root/.gvfs



3. Hiện thị thông tin về thư mục Home
Mã:[root@vultr ~]# df -hT /home
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/vda1      ext4   40G   14G   25G  36% /



4. Hiển thị thông tin về các file hệ thống theo bytes
Mã:[root@vultr ~]# df -k
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       41283904 13994420  25192384  36% /
tmpfs            1962396      232   1962164   1% /dev/shm



5. Xem thông tin file hệ thống ở MB
Mã:[root@vultr ~]# df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/vda1          40317 13666     24603  36% /
tmpfs               1917     1      1917   1% /dev/shm



6. Xem thông tin file hệ thống ở GB
Mã:[root@vultr ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   14G   25G  36% /
tmpfs           1,9G  232K  1,9G   1% /dev/shm



7. Xem thông tin Inodes
Mã:[root@vultr ~]# df -i
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/vda1      2621440 150862 2470578    6% /
tmpfs           490599      7  490592    1% /dev/shm



8. Hiển thị thông tin định dạng file hệ thống
Mã:[root@vultr ~]# df -T
Filesystem     Type  1K-blocks     Used Available Use% Mounted on
/dev/vda1      ext4   41283904 13994384  25192420  36% /
tmpfs          tmpfs   1962396      232   1962164   1% /dev/shm



9. Xem các lệnh df
Mã:[root@vultr ~]#  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 dummy file systems
  -B, --block-size=SIZE  use SIZE-byte blocks
      --direct          show statistics for a file instead of mount point
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -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)
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -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).
 
SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
 
Report df bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'df invocation'



Trên đây là các lệnh “df” thường dùng.

Chúc các bạn thành công.

Nguồn: hostingaz.vn
(Cốc Cốc 56.3.120)
PM|Trích|Like|Sửa|Xóa|Báo cáo|Cảnh cáo
_______________
Diễn đàn chia sẻ kiến thức máy tính:
KETNOI123.COM

Ấn hiện ra để xem chữ ký của mình:
Trả lời nhanh

Chủ đề tương tự