disk filesystem的縮寫,查看已掛載磁盤的總容量、使用容量、剩餘容量信息。node
[root@centos01 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 27043944 885972 26157972 4% / devtmpfs 499848 0 499848 0% /dev tmpfs 505428 0 505428 0% /dev/shm tmpfs 505428 6792 498636 2% /run tmpfs 505428 0 505428 0% /sys/fs/cgroup /dev/sda1 201388 76016 125372 38% /boot
帶tmpfs說明該文件系統是臨時文件系統
/dev/shm爲內存分區,默認大小爲物理內存的一半
free 命令能夠查看swap分區linux
[root@centos01 ~]# free total used free shared buffers cached Mem: 1010860 231640 779220 6796 692 81600 -/+ buffers/cache: 149348 861512 Swap: 4194300 0 4194300
-h: 表示使用合適的單位顯示容量信息centos
[root@centos01 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 26G 866M 25G 4% / devtmpfs 489M 0 489M 0% /dev tmpfs 494M 0 494M 0% /dev/shm tmpfs 494M 6.7M 487M 2% /run tmpfs 494M 0 494M 0% /sys/fs/cgroup /dev/sda1 197M 75M 123M 38% /boot
-k、-m:分別表示以KB和MB單位顯示磁盤容量信息ide
-i: 查看磁盤inodes使用狀況,若已使用100%,即便有剩餘的磁盤空間,也會提示磁盤已滿。
inodes大小是在磁盤格式化時肯定的,是根據磁盤分區決定其大小。ui
disk useage. 用來查看一個文件或目錄所佔的空間大小。
當一個文件小於4k時,也會顯示爲4k。由於磁盤會劃分爲多個小塊,文件都存到這些小塊裏,不夠4k時,也佔用着這個4k的塊,每一個小塊只能有一個文件。
-s 只列出總和大小。
-h 表示使用合適的單位顯示容量信息。
通常使用: du -sh 目錄/文件code
fdisk -l 列出系統全部的磁盤
虛擬機添加磁盤後須要重啓系統(reboot)
默認選擇硬盤後,一直「下一步」
到這裏,單擊「完成」磁盤添加完成
blog
經過上面操做重啓後系統後內存
[root@centos01 ~]# fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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 label type: dos Disk identifier: 0x000b933a Device Boot Start End Blocks Id System /dev/sda1 * 2048 411647 204800 83 Linux /dev/sda2 411648 8800255 4194304 82 Linux swap / Solaris /dev/sda3 8800256 62914559 27057152 83 Linux Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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/sdb爲新磁盤,尚未進行分區 [root@centos01 ~]# [root@centos01 ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xbe968c4c. Command (m for help): p # 打印當前磁盤的分區信息 Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 label type: dos Disk identifier: 0xbe968c4c Device Boot Start End Blocks Id System Command (m for help): n # 分區 Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p # 選擇主分區 Partition number (1-4, default 1): 1 # 分區號 First sector (2048-10485759, default 2048): 2048 # 開始的扇區 Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759): +2G # 大小 Partition 1 of type Linux and of size 2 GiB is set Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): e # 擴展分區 Partition number (2-4, default 2): 2 First sector (4196352-10485759, default 4196352): Using default value 4196352 Last sector, +sectors or +size{K,M,G} (4196352-10485759, default 10485759): +1G Partition 2 of type Extended and of size 1 GiB is set Command (m for help): p Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 label type: dos Disk identifier: 0xbe968c4c Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 83 Linux /dev/sdb2 4196352 6293503 1048576 5 Extended Command (m for help): n Partition type: p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): p Partition number (3,4, default 3): 3 First sector (6293504-10485759, default 6293504): Using default value 6293504 Last sector, +sectors or +size{K,M,G} (6293504-10485759, default 10485759): +2G Value out of range. Last sector, +sectors or +size{K,M,G} (6293504-10485759, default 10485759): Using default value 10485759 Partition 3 of type Linux and of size 2 GiB is set Command (m for help): p Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 label type: dos Disk identifier: 0xbe968c4c Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 83 Linux /dev/sdb2 4196352 6293503 1048576 5 Extended /dev/sdb3 6293504 10485759 2096128 83 Linux Command (m for help): p Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 label type: dos Disk identifier: 0xbe968c4c Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 83 Linux /dev/sdb2 4196352 6293503 1048576 5 Extended /dev/sdb3 6293504 10485759 2096128 83 Linux Command (m for help): d # 刪除分區 Partition number (1-3, default 3): 2 #刪除的分區號 Partition 2 is deleted Command (m for help): p Disk /dev/sdb: 5368 MB, 5368709120 bytes, 10485760 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 label type: dos Disk identifier: 0xbe968c4c Device Boot Start End Blocks Id System /dev/sdb1 2048 4196351 2097152 83 Linux /dev/sdb3 6293504 10485759 2096128 83 Linux
邏輯分區是從第5個分區號開始,而且是連續的。
擴展分區能夠劃分爲必定大小的空間,但真正佔用空間的是擴展分區裏的邏輯分區;擴展分區自己不支持格式化,寫數據,是一個裝着邏輯分區的「殼」。
主分區數量範圍1 ~ 3,邏輯分區數量範圍0 ~ 1。ci