高級Linux運維工程師必備技能(掃盲篇)

                      高級Linux運維工程師必備技能(掃盲篇)html

                                            做者:尹正傑node

版權聲明:原創做品,謝絕轉載!不然將追究法律責任。python

 

  在瞭解文件系統以前,咱們要學習一下磁盤存儲數據的方式,你們都知道文件從內存若要持久化存儲的話就得把它存到硬盤上,想畢都知道文件存入磁盤都是二進制存取的。那麼硬盤是如何存儲的呢?咱們如今標配基本上都是1T呢,如今都是2017了,500G的硬盤都已經遭嫌棄了。
                      
1.生活小知識。
  上面是一幅圖能夠看到,有磁頭,並且這個磁頭是懸浮在盤面上的,若是這個盤面有震動,極可能直接滑到盤面,致使上面寫的數據被劃掉,形成數據丟失,所以,咱們在購買硬盤的時候都寫着不能強劇烈震動。 硬盤在工做的時候,這個盤面一直在轉,若是訪問裏面的數據,須要必定時間,咱們稱之爲「平均尋道時間」。 把不一樣盤面上的相同磁道(能夠理解就是盤面上的一個圈,整個盤面有好多個這個樣的打圈小圈造成的)劃分紅同一個分區內部。那麼這些維護不一樣盤面的相同編號的磁道咱們成爲柱面(cylinder). 磁盤劃分其實是按照柱面劃分的,那麼很顯然在最外層的柱面劃分出來的分區的性能是最好的,你可能會問爲何?緣由很簡單,就是在相同的角速度中,最外層的周長是最大(也就意味着它存儲的數據將越多)。所以咱們在劃分分區的時候依次劃分C,D,E硬盤,最早劃分的是C盤(分區軟件默認把C盤劃分到最外層),所以你們都用C盤作系統盤是有緣由的喲!
 
2.MBR分區
在整塊硬盤的最外側磁道上,在第零("0")個扇區上,這個扇區是不能用來劃分區的,由於這個扇區上存放着整塊磁盤的分區信息。這個分區一般被稱做爲MBR(Master Boot Record,主引導記錄 )分區(如今都流行GPT分區了),這個扇區僅僅佔用了512個字節(bytes),你可別小看這512bytes,
a>.它保函了引導加載器(bootloader,其佔用了446bytes);
b>.fat,即分區表,其佔用了64bytes,每16bytes一個分區,總共只能分區4個[聽說比爾蓋茨層發表過言論:「硬盤這麼小,有誰能用到多餘4個分區呢?)【當時的硬盤都很小並且特別貴,只有幾百兆(M)大小】」;
c>.5A,其爲十六進制的「5A」,佔用最後2個字節,用來標記這個MBR分區是不是有效數據的(2個字節被填充了2個5A,MBR有效性標記)。
硬盤內部都是真空的,爲何呢?由於它要旋轉,有的硬盤的轉速高達1.5w/m,若是不坐車真空的這麼高的轉速很容易和真空中的微粒發生碰撞,致使溫度太高!因此不要輕易拆開硬盤,基本上你拆開就不是真空了,即便拆開後能用,也用不了多長時間就會壞掉的。
 
3.擴展分區與邏輯分區
隨着硬盤的存儲數據進一步的增加,咱們分區4個是遠遠夠用的,所以須要從4個主分區中拿出一個分區單獨,用來存放其餘的分區信息咱們叫它爲「擴展分區」,若是這個擴展分區足夠大,就能夠對其進行劃分多個分區讓不一樣用戶使用。所以這個擴展分區(引用額外的分區表)是不能被格式化的,這樣它就不能被使用,須要額外劃分出一個或多個邏輯分區才能被使用。
 
4.MBR分區方法
a>.4個主分區
b>.3個主分區和一個擴展分區。
注意:MBR最大支持2T的硬盤。大於2TB就得使用GPT分區格式!
 
5.硬盤接口
DMA:Direct Memory Access (直接內存訪問機制)
磁盤設備存放於/dev/文件夾下,
IDE接口的磁盤:/dev/hda、/dev/hdb、/dev/hdc、/dev/hdd
SCSI接口的磁盤:/dev/sda、/dev/sdb、/dev/sdc、/dev/sdd
/dev/XdYZ
/dev/ 表示的是一個設備目錄
X h IDE硬盤
s SATA、SISC、U盤
Y a 第一塊硬盤
b 第二塊硬盤
c 第三塊硬盤
。。。。。。。。。。
 
Z 1-3表示主分區,4通常爲擴展分區
5是邏輯分區第一個分區
6是邏輯分區第二個分區
。。。。。。。。。。
a>.IDE(ATA):並口,每一個控制器可接兩個硬盤,master/slave,133MB/S(這個速率就是被淘汰的根部緣由)
/dev/hd[a-z](注意:在Centos6.x版本之後,全部的硬盤即使是IDE接口的都被識別爲sd,早起的設備被設置爲hd)
/dev//hda[1-4](標識4個主分區)
/dev/hda[5+](邏輯分區5開始)
b>.SCSI:Small Computer System Interface (小型計算機接口,在讀取數據上效率很高,由於它有單獨的SCSI控制器,容錯能力強且抗衰老【可是價格貴啊,相同存儲空間是機械硬盤的8倍價格呢!】) 速率:320mb/s 也是並口的 (有的人爲了省錢用IDE作raid陣列)
c>.SATA(Serial):300Mbps,600Mbps,6Gbps
d>.SAS:6Gbps
e>.USB:2.0接口: 3.0接口:

 

6.查看系統是如何識別磁盤分區的
 1 [root@yinzhengjie ~]# cat /proc/partitions  #查看系統識別的分區
 2 major minor  #blocks  name
 3 
 4    8        0  292968750 sda
 5    8       16  292968750 sdb
 6    9      127  278290432 md127
 7  259        0     512000 md127p1
 8  259        1  277777408 md127p2
 9  253        0   52428800 dm-0
10  253        1   33038336 dm-1
11  253        2  192307200 dm-2
12 [root@yinzhengjie ~]# 
  注意:若是你對你的硬盤剩餘的空間進行分區後,新加的分區信息內核是不能識別的,須要內核去重讀硬件的分區表,重啓是不頂事的!我在生產環境中就遇到過這麼一個坑。
 
7.根在內核
  根作爲訪問文件的入口,那麼這個根到底在硬盤上呢?仍是在操做系統上呢?根其實是在內核中,咱們訪問數據都是操做系統將這個硬盤掛在到了根下,而後咱們去訪問它而已。那你又會問了,那內核在哪啊?答案是在磁盤上。
實際上,在裝載內核以前,先啓動的是bootloader(內核未啓動就尚未文件系統存在),bootloader區磁盤上找到內核並啓動,內核啓動後會自動生成一個「/」(根),並將磁盤的文件都掛在到「/」下,這就造成了文件系統。
 
8.linux目錄
 1 /bin,/sbin                         #存放系統自身完成本身的啓動和基本運行機制索要提供的程序;。
 2 /usr/bin,/usr/sbin                  #存放完成操做系統基本功能的所提供的二進制程序;
 3 /usr/local/bin,/usr/local/sbin      #存放第三方程序;
 4 /lib,/lib64,/usr/lib,/usr/lib64     #存放庫文件的;
 5 /etc/                             #存放配置文件的;
 6 /media,/mnt                      #用於掛在的目錄,固然你也能夠自定義的;
 7 /dev                             #存放各類設備文件;
 8 /proc,/sys                         #存放運行中的內存映射數據;
 9 /home,/root                      #存放各普通用戶的家目錄,好比 /home/yinzhengjie;
10 /var                               #存放日誌的目錄;
11 /opt,/misc                         #觸發掛在目錄;
12 /srv                             #存放服務相關數據的;
13 /tmp                             #存放各類臨時文件,每次關機時自動清理;
14 /boot                           #存放內核、引導菜單等啓動文件;
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 /:根目錄,通常根目錄下只存放目錄,不要存放文件,/etc、/bin、/dev、/lib、/sbin應該和根目錄放置在一個分區中
 9 
10 /bin:/usr/bin:可執行二進制文件的目錄,如經常使用的命令ls、tar、mv、cat等。
11 
12 /boot:放置linux系統啓動時用到的一些文件。/boot/vmlinuz爲linux的內核文件,以及/boot/gurb。建議單獨分區,分區大小200M便可
13 
14 /dev:存放linux系統下的設備文件,訪問該目錄下某個文件,至關於訪問某個設備,經常使用的是掛載光驅mount /dev/cdrom /mnt。
15 
16 /etc:系統配置文件存放的目錄,不建議在此目錄下存放可執行文件,重要的配置文件有/etc/inittab、/etc/fstab、/etc/init.d、/etc/X十一、/etc/sysconfig、/etc/xinetd.d修改配置文件以前記得備份。
17 
18 注:/etc/X11存放與x windows有關的設置。
19 
20 /home:系統默認的用戶家目錄,新增用戶帳號時,用戶的家目錄都存放在此目錄下,~表示當前用戶的家目錄,~test表示用戶test的家目錄。建議單獨分區,並設置較大的磁盤空間,方便用戶存放數據
21 
22 /lib:/usr/lib:/usr/local/lib:系統使用的函數庫的目錄,程序在執行過程當中,須要調用一些額外的參數時須要函數庫的協助,比較重要的目錄爲/lib/modules。
23 
24 /lost+fount:系統異常產生錯誤時,會將一些遺失的片斷放置於此目錄下,一般這個目錄會自動出如今裝置目錄下。如加載硬盤於/disk 中,此目錄下就會自動產生目錄/disk/lost+found
25 
26 /mnt:/media:光盤默認掛載點,一般光盤掛載於/mnt/cdrom下,也不必定,能夠選擇任意位置進行掛載。
27 
28 /opt:給主機額外安裝軟件所擺放的目錄。如:FC4使用的Fedora 社羣開發軟件,若是想要自行安裝新的KDE 桌面軟件,能夠將該軟件安裝在該目錄下。之前的 Linux 系統中,習慣放置在 /usr/local 目錄下
29 
30 /proc:此目錄的數據都在內存中,如系統核心,外部設備,網絡狀態,因爲數據都存放於內存中,因此不佔用磁盤空間,比較重要的目錄有/proc/cpuinfo、/proc/interrupts、/proc/dma、/proc/ioports、/proc/net/*等
31 
32 /root:系統管理員root的家目錄,系統第一個啓動的分區爲/,因此最好將/root和/放置在一個分區下。
33 
34 /sbin:/usr/sbin:/usr/local/sbin:放置系統管理員使用的可執行命令,如fdisk、shutdown、mount等。與/bin不一樣的是,這幾個目錄是給系統管理員root使用的命令,通常用戶只能"查看"而不能設置和使用。
35 
36 /tmp:通常用戶或正在執行的程序臨時存放文件的目錄,任何人均可以訪問,重要數據不可放置在此目錄下
37 
38 /srv:服務啓動以後須要訪問的數據目錄,如www服務須要訪問的網頁數據存放在/srv/www內
39 
40 /usr:應用程序存放目錄,/usr/bin存放應用程序,/usr/share存放共享數據,/usr/lib存放不能直接運行的,倒是許多程序運行所必需的一些函數庫文件。/usr/local:存放軟件升級包。/usr/share/doc:系統說明文件存放目錄。/usr/share/man: 程序說明文件存放目錄,使用 man ls時會查詢/usr/share/man/man1/ls.1.gz的內容建議單獨分區,設置較大的磁盤空間
41 
42 /var:放置系統執行過程當中常常變化的文件,如隨時更改的日誌文件/var/log,/var/log/message:全部的登陸文件存放目錄,/var/spool/mail:郵件存放的目錄,/var/run:程序或服務啓動後,其PID存放在該目錄下。建議單獨分區,設置較大的磁盤空間
43 '''
Linux目錄詳細版本,猛戳這裏!!
 
9.用來對設備進行分區的命令
用於分區的管理工具:fdisk,sfdisk,parted
a>.查看分區信息
 1 [root@yinzhengjie ~]# fdisk -l /dev/[sh]d[a-z]  #使用文件名通配過濾掉沒有用的信息(不是正則表達式喲),能夠看出下面只有2個硬盤
 2 
 3 Disk /dev/sda: 21.5 GB, 21474836480 bytes
 4 255 heads, 63 sectors/track, 2610 cylinders
 5 Units = cylinders of 16065 * 512 = 8225280 bytes
 6 Sector size (logical/physical): 512 bytes / 512 bytes
 7 I/O size (minimum/optimal): 512 bytes / 512 bytes
 8 Disk identifier: 0x00059922
 9 
10    Device Boot(是否可引導)      Start         End      Blocks   Id(對應文件系統的ID)  System
11 /dev/sda1   *(*表示能夠引導)           1          39      307200   83  Linux
12 Partition 1 does not end on cylinder boundary.
13 /dev/sda2              39        2358    18631680   83  Linux
14 /dev/sda3            2358        2611     2031616   82  Linux swap / Solaris
15 
16 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
17 255 heads, 63 sectors/track, 1305 cylinders
18 Units = cylinders of 16065 * 512 = 8225280 bytes
19 Sector size (logical/physical): 512 bytes / 512 bytes
20 I/O size (minimum/optimal): 512 bytes / 512 bytes
21 Disk identifier: 0x00000000
22 
23 [root@yinzhengjie ~]# 
b>虛擬文件系統
              
 
VFS:(Virtual File System)#虛擬文件系統
基本文件系統:Ext3,Ext3,Ext4,Reiserfs(早起的suse用的就是該文件系統喲),xfs(支持單個巨大的文件),JFS(日誌文件系統,IBM開發的),vfat,NTFS
交換分區:swap
集羣文件系統:GFS2(紅帽系統研發,谷歌都再用呢),OCFS2(甲骨文公司研發,用的人很少)
網絡文件系統:NFS,smbfs(window是CIFS)
光盤:iso9660
c>.對磁盤進行分區
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 fdisk:
 9     d 刪除分區
10     n:新建一個分區
11     p:列出已有分區
12     t:調至分區ID
13     l:列出內核支持的分區id
14     w:保存退出
15     q:不保存退出 
16     m:幫助
17 '''
  1 #!/usr/bin/env python
  2 #_*_coding:utf-8_*_
  3 #@author :yinzhengjie
  4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
  5 #EMAIL:y1053419035@qq.com
  6 
  7 '''
  8 [root@yinzhengjie ~]# fdisk /dev/sdb  #對第二塊硬盤進行分區
  9 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
 10 Building a new DOS disklabel with disk identifier 0x8614a108.
 11 Changes will remain in memory only, until you decide to write them.
 12 After that, of course, the previous content won't be recoverable.
 13 
 14 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 15 
 16 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
 17          switch off the mode (command 'c') and change display units to
 18          sectors (command 'u').
 19 
 20 Command (m for help): m  #查看幫助
 21 Command action
 22    a   toggle a bootable flag
 23    b   edit bsd disklabel
 24    c   toggle the dos compatibility flag
 25    d   delete a partition
 26    l   list known partition types
 27    m   print this menu
 28    n   add a new partition
 29    o   create a new empty DOS partition table
 30    p   print the partition table
 31    q   quit without saving changes
 32    s   create a new empty Sun disklabel
 33    t   change a partition's system id
 34    u   change display/entry units
 35    v   verify the partition table
 36    w   write table to disk and exit
 37    x   extra functionality (experts only)
 38 
 39 Command (m for help): p  #列出已有分區
 40 
 41 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 42 255 heads, 63 sectors/track, 1305 cylinders
 43 Units = cylinders of 16065 * 512 = 8225280 bytes
 44 Sector size (logical/physical): 512 bytes / 512 bytes
 45 I/O size (minimum/optimal): 512 bytes / 512 bytes
 46 Disk identifier: 0x8614a108
 47 
 48    Device Boot      Start         End      Blocks   Id  System
 49 
 50 Command (m for help): n   #新建一個分區
 51 Command action
 52    e   extended   #擴展分區
 53    p   primary partition (1-4)  #主分區
 54 p  #選擇主分區
 55 Partition number (1-4): 1  #選擇編號
 56 First cylinder (1-1305, default 1):  #選擇分區的起始點,默認爲1
 57 Using default value 1
 58 Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +1G  #建立一個1G的主分區
 59 
 60 Command (m for help): n  #再新建一個分區
 61 Command action
 62    e   extended
 63    p   primary partition (1-4)
 64 p   #選擇類型爲主分區
 65 Partition number (1-4): 2  #設置編號爲2
 66 First cylinder (133-1305, default 133):
 67 Using default value 133
 68 Last cylinder, +cylinders or +size{K,M,G} (133-1305, default 1305): +1G  #建立一個1G的分區
 69 
 70 Command (m for help): n   #再新建一個分區
 71 Command action
 72    e   extended
 73    p   primary partition (1-4)
 74 p #選擇類型爲主分區
 75 Partition number (1-4): 3  #這隻編號爲3
 76 First cylinder (265-1305, default 265):
 77 Using default value 265
 78 Last cylinder, +cylinders or +size{K,M,G} (265-1305, default 1305): +2G  #建立一個2G的分區
 79 
 80 Command (m for help): n  #再新建一個分區
 81 Command action
 82    e   extended
 83    p   primary partition (1-4)
 84 e  #因爲已經設置了3個主分區了,因此我將第四個分區設置爲擴展分區,便於我建立更多的邏輯分區
 85 Selected partition 4
 86 First cylinder (527-1305, default 527):
 87 Using default value 527
 88 Last cylinder, +cylinders or +size{K,M,G} (527-1305, default 1305):
 89 Using default value 1305
 90 
 91 Command (m for help): p  #列出已有分區
 92 
 93 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 94 255 heads, 63 sectors/track, 1305 cylinders
 95 Units = cylinders of 16065 * 512 = 8225280 bytes
 96 Sector size (logical/physical): 512 bytes / 512 bytes
 97 I/O size (minimum/optimal): 512 bytes / 512 bytes
 98 Disk identifier: 0x8614a108
 99 
100    Device Boot      Start         End      Blocks   Id  System
101 /dev/sdb1               1         132     1060258+  83  Linux   #這就是主分區,ID爲83
102 /dev/sdb2             133         264     1060290   83  Linux
103 /dev/sdb3             265         526     2104515   83  Linux
104 /dev/sdb4             527        1305     6257317+   5  Extended  #折就是擴展分區,ID爲5
105 
106 Command (m for help): n  #新建一個分區
107 First cylinder (527-1305, default 527):
108 Using default value 527
109 Last cylinder, +cylinders or +size{K,M,G} (527-1305, default 1305): +5G  #建立一個5G的邏輯分區。
110 
111 Command (m for help): P   #列出已有分區
112 
113 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
114 255 heads, 63 sectors/track, 1305 cylinders
115 Units = cylinders of 16065 * 512 = 8225280 bytes
116 Sector size (logical/physical): 512 bytes / 512 bytes
117 I/O size (minimum/optimal): 512 bytes / 512 bytes
118 Disk identifier: 0x8614a108
119 
120    Device Boot      Start         End      Blocks   Id  System
121 /dev/sdb1               1         132     1060258+  83  Linux   #主分區
122 /dev/sdb2             133         264     1060290   83  Linux
123 /dev/sdb3             265         526     2104515   83  Linux
124 /dev/sdb4             527        1305     6257317+   5  Extended  #擴展分區
125 /dev/sdb5             527        1180     5253223+  83  Linux   #這就是新建的邏輯分區
126 
127 Command (m for help): W  #保存退出
128 
129 驗證是否分區成功:
130 [root@yinzhengjie ~]# fdisk /dev/sdb
131 
132 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
133          switch off the mode (command 'c') and change display units to
134          sectors (command 'u').
135 
136 Command (m for help): p
137 
138 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
139 255 heads, 63 sectors/track, 1305 cylinders
140 Units = cylinders of 16065 * 512 = 8225280 bytes
141 Sector size (logical/physical): 512 bytes / 512 bytes
142 I/O size (minimum/optimal): 512 bytes / 512 bytes
143 Disk identifier: 0x8614a108
144 
145    Device Boot      Start         End      Blocks   Id  System
146 /dev/sdb1               1         132     1060258+  83  Linux
147 /dev/sdb2             133         264     1060290   83  Linux
148 /dev/sdb3             265         526     2104515   83  Linux
149 /dev/sdb4             527        1305     6257317+   5  Extended
150 /dev/sdb5             527        1180     5253223+  83  Linux
151 
152 Command (m for help): q
153 
154 [root@yinzhengjie ~]#
155 '''
用fdisk 工具對磁盤進行分區過程
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 #讓操做系統重讀分區表,獲取最新的分區信息。
 8 '''
 9 [root@yinzhengjie ~]# cat /proc/partitions  #查看系統識別的分區,發現沒有咱們的分區
10 major minor  #blocks  name
11 
12    8        0  292968750 sda
13    8       16  292968750 sdb
14    9      127  278290432 md127
15  259        0     512000 md127p1
16  259        1  277777408 md127p2
17  253        0   52428800 dm-0
18  253        1   33038336 dm-1
19  253        2  192307200 dm-2
20 [root@yinzhengjie ~]#
21 [root@yinzhengjie ~]# kpartx -l /dev/sdb  #列出已添加的全部分區信息
22 sdb1 : 0 2120517 /dev/sdb 63
23 sdb2 : 0 2120580 /dev/sdb 2120580
24 sdb3 : 0 4209030 /dev/sdb 4241160
25 sdb4 : 0 2 /dev/sdb 8450190
26 sdb5 : 0 10506447 /dev/sdb 8450253
27 [root@yinzhengjie ~]# kpartx -af /dev/sdb   #強行添加分區信息
28 [root@yinzhengjie ~]# kpartx -a /dev/sdb    #重讀分區表信息
29 [root@yinzhengjie ~]#
30 [root@yinzhengjie ~]# ls /dev/sdb*          #發現系統以及識別了這幾個分區
31 /dev/sdb  /dev/sdb1  /dev/sdb2  /dev/sdb3  /dev/sdb4  /dev/sdb5
32 [root@yinzhengjie ~]#
33 [root@yinzhengjie ~]# cat /proc/partitions  #查看分區表
34 major minor  #blocks  name
35 
36    8        0   20971520 sda
37    8        1     307200 sda1
38    8        2   18631680 sda2
39    8        3    2031616 sda3
40    8       16   10485760 sdb
41    8       17    1060258 sdb1
42    8       18    1060290 sdb2
43    8       19    2104515 sdb3
44    8       20          1 sdb4
45    8       21    5253223 sdb5
46  253        0    1060258 dm-0
47  253        1    1060290 dm-1
48  253        2    2104515 dm-2
49  253        3          1 dm-3
50  253        4    5253223 dm-4
51 [root@yinzhengjie ~]#
52 
53 '''
54 
55 
56 #提示,若是你的操做系統是Centos5的話執行如下命令就好使了
57 [root@yinzhengjie ~]# partprobe   #可是這個條命令不適合CentOs6!
用kpartx 讓系統重讀分區表
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# fdisk /dev/sdb
 9 
10 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
11          switch off the mode (command 'c') and change display units to
12          sectors (command 'u').
13 
14 Command (m for help): p  #查看當前分區
15 
16 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
17 255 heads, 63 sectors/track, 1305 cylinders
18 Units = cylinders of 16065 * 512 = 8225280 bytes
19 Sector size (logical/physical): 512 bytes / 512 bytes
20 I/O size (minimum/optimal): 512 bytes / 512 bytes
21 Disk identifier: 0x8614a108
22 
23    Device Boot      Start         End      Blocks   Id  System
24 /dev/sdb1               1         132     1060258+  83  Linux
25 /dev/sdb2             133         264     1060290   83  Linux
26 /dev/sdb3             265         526     2104515   83  Linux
27 /dev/sdb4             527        1305     6257317+   5  Extended
28 /dev/sdb5             527        1180     5253223+  83  Linux
29 
30 Command (m for help): d  #刪除分區
31 Partition number (1-5): 5  #選擇相應的編號,在她給定的數值內選取喲
32 
33 Command (m for help): p #發現已經刪除成功了
34 
35 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
36 255 heads, 63 sectors/track, 1305 cylinders
37 Units = cylinders of 16065 * 512 = 8225280 bytes
38 Sector size (logical/physical): 512 bytes / 512 bytes
39 I/O size (minimum/optimal): 512 bytes / 512 bytes
40 Disk identifier: 0x8614a108
41 
42    Device Boot      Start         End      Blocks   Id  System
43 /dev/sdb1               1         132     1060258+  83  Linux
44 /dev/sdb2             133         264     1060290   83  Linux
45 /dev/sdb3             265         526     2104515   83  Linux
46 /dev/sdb4             527        1305     6257317+   5  Extended
47 
48 Command (m for help): w   #保存配置並退出
49 The partition table has been altered!
50 
51 Calling ioctl() to re-read partition table.
52 Syncing disks.
53 [root@yinzhengjie ~]#
54 
55 
56 '''
用fdisk刪除分區信息
  1 #!/usr/bin/env python
  2 #_*_coding:utf-8_*_
  3 #@author :yinzhengjie
  4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
  5 #EMAIL:y1053419035@qq.com
  6 
  7 '''
  8 [root@yinzhengjie ~]# fdisk /dev/sdb
  9 
 10 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
 11          switch off the mode (command 'c') and change display units to
 12          sectors (command 'u').
 13 
 14 Command (m for help): p #查看當前分區信息
 15 
 16 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 17 255 heads, 63 sectors/track, 1305 cylinders
 18 Units = cylinders of 16065 * 512 = 8225280 bytes
 19 Sector size (logical/physical): 512 bytes / 512 bytes
 20 I/O size (minimum/optimal): 512 bytes / 512 bytes
 21 Disk identifier: 0x8614a108
 22 
 23    Device Boot      Start         End      Blocks   Id  System
 24 /dev/sdb1               1         132     1060258+  83  Linux
 25 /dev/sdb2             133         264     1060290   83  Linux
 26 /dev/sdb3             265         526     2104515   83  Linux   #主分區
 27 /dev/sdb4             527        1305     6257317+   5  Extended
 28 
 29 Command (m for help): t  #調整分區ID
 30 Partition number (1-5): 3  #選擇分區標號
 31 Hex code (type L to list codes): L  #查看ID對應的文件系統類型。
 32 
 33  0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 34  1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 35  2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 36  3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 37  4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx
 38  5  Extended        42  SFS             86  NTFS volume set da  Non-FS data
 39  6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 40  7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility
 41  8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt
 42  9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access
 43  a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O
 44  b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor
 45  c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs
 46  e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT
 47  f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
 48 10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
 49 11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor
 50 12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor
 51 14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary
 52 16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS
 53 17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
 54 18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
 55 1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep
 56 1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT
 57 1e  Hidden W95 FAT1
 58 Hex code (type L to list codes): 82  #選擇 Linux swap / So分區類型
 59 Changed system type of partition 3 to 82 (Linux swap / Solaris)
 60 
 61 Command (m for help): P #查看當前類型
 62 
 63 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 64 255 heads, 63 sectors/track, 1305 cylinders
 65 Units = cylinders of 16065 * 512 = 8225280 bytes
 66 Sector size (logical/physical): 512 bytes / 512 bytes
 67 I/O size (minimum/optimal): 512 bytes / 512 bytes
 68 Disk identifier: 0x8614a108
 69 
 70    Device Boot      Start         End      Blocks   Id  System
 71 /dev/sdb1               1         132     1060258+  83  Linux
 72 /dev/sdb2             133         264     1060290   83  Linux
 73 /dev/sdb3             265         526     2104515   82  Linux swap / Solaris  #果然已經變成了交換分區
 74 /dev/sdb4             527        1305     6257317+   5  Extended
 75 
 76 Command (m for help): t  #修改分區類型
 77 Partition number (1-5): 3  #仍是選擇以前修改的分區
 78 Hex code (type L to list codes): 83  #修改會以前的分區類型
 79 Changed system type of partition 3 to 83 (Linux)
 80 
 81 Command (m for help): p  #查看分區狀況
 82 
 83 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 84 255 heads, 63 sectors/track, 1305 cylinders
 85 Units = cylinders of 16065 * 512 = 8225280 bytes
 86 Sector size (logical/physical): 512 bytes / 512 bytes
 87 I/O size (minimum/optimal): 512 bytes / 512 bytes
 88 Disk identifier: 0x8614a108
 89 
 90    Device Boot      Start         End      Blocks   Id  System
 91 /dev/sdb1               1         132     1060258+  83  Linux
 92 /dev/sdb2             133         264     1060290   83  Linux
 93 /dev/sdb3             265         526     2104515   83  Linux
 94 /dev/sdb4             527        1305     6257317+   5  Extended
 95 
 96 Command (m for help): w  #保存當前配置
 97 The partition table has been altered!
 98 
 99 Calling ioctl() to re-read partition table.
100 Syncing disks.
101 [root@yinzhengjie ~]#
102 '''
用fdisk修改分區類型
 
10.建立文件系統
                        

 

  你可使用2個扇區(512字節)爲一個塊(block),那麼這個一個快的大小就是1kb,4個扇區就是2kb,8個扇區就是4kb.那麼問題來了,這個每一個單位的塊導師是1kb好呢?仍是2kb或是4kb好呢?這就要看你存儲的數據的大小了,若是你存儲的數據是大文件的話,固然block越大越好,這樣block存儲相同的數據block越大,用的塊數就越少,若是你存儲的是小文件的話,固然block越小越好,由於block過大,存進去的數據卻很小就形成了浪費!(由於一個block只能存儲一個數據源)。
  注意,在存儲數據的時候,一個block只能屬於一個文件,不能同時屬於2個文件。硬鏈接除外,其實硬連接指的仍是一同一個文件。也就是說,不一樣的文件不能使用相同的磁盤塊。這些磁盤塊都有其編號的,是爲了方便數據源(主要是inode)只想存儲數據的塊(block)
  磁盤碎片,就是否是連續的塊(block)存儲着屬於同一個文件的數據,這樣就致使了在存取的時候特別麻煩,大大的下降了磁盤的工做效率。以下圖:
                            

 

  日誌文件系統是能夠將源數據(indoe)和塊數據都寫入日誌區,等都寫入成功了在把數據分別寫入到源數據區和塊數據區,假如你才寫文檔的時候,若是忽然斷電,恰巧你剛恰好寫完數據,那麼他回將數據分別寫入indoe和block區域中,若是你沒有寫完,他就會對比在日誌區的inode和block對應的是否完整,若是不完整,日誌區會自動將Inode刪除,清除掉不完整的block,就完成了一次自檢模式。
                              
#!/usr/bin/env python
#_*_coding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
#EMAIL:y1053419035@qq.com

'''

mke2fs:
   配置文件:/etc/mke2fs.conf
   -t:指定文件類型{ext2|ext3|ext4}
   -j:用於建立Ext3文件系統,至關於-t ext3
   -L label: 指定卷標,
   -b{1024|2028|4096}:指定塊大小
   -i # :#個字節給指定一個indone
   -N # : 直接指定預留多少個indone
   -I # : 指定Inode大小
   -m # :預留給管理員的空間百分比,默認爲5
   -O :指定分區特性
e2label /dev/SOMEDEVICE 查看卷標,

e2label /dev/SOMEDEVICE  Label 直接更改卷標

e2label /dev/SOMEDEVICE 「」   刪除卷標

blkid 查看UUID和TYPE 

dumpe2fs 查看超級塊和是否有碎片 
    -h:僅顯示超級塊中保存的信息 


tune2fs:調整mke2fs的信息 
     -l:查看超級塊中的信息 
    -L: 設定卷標 
    -m:預留管理員的空間百分比 
     -j:若是原來的文件系統爲ext2,-j可以將其提高爲ext3 
     -o:[^]mount-options[,...] 指定默認掛載選項 
     -O:[^]feature[,...] 調整分區特性 
    tune2fs -o 掛載選項 設備 
    tune2fs -o ^設備選項 取消 


fsck:文件系統檢測 
      -t 文件類型 設備 
      -f 強行檢測 
      -a 自動修復錯誤 
      -r 交互式修復錯誤
      
e2fsck 
      -t 指定時間 
      -y 自動回答爲yes 
      -f 強行檢測 
'
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mke2fs /dev/sdb3   #格式化該分區,默認爲ext2文件系統
 9 mke2fs 1.41.12 (17-May-2010)
10 Filesystem label=     #卷標
11 OS type: Linux
12 Block size=4096 (log=2)  #塊大小是4K
13 Fragment size=4096 (log=2)
14 Stride=0 blocks, Stripe width=0 blocks
15 131648 inodes, 526128 blocks  #節點書和塊數。
16 26306 blocks (5.00%) reserved for the super user   #有5.00%的block給管理用,這個比例是能夠調整的
17 First data block=0
18 Maximum filesystem blocks=541065216   #最大塊數
19 17 block groups  #有17個塊組
20 32768 blocks per group, 32768 fragments per group    #
21 7744 inodes per group
22 Superblock backups stored on blocks:
23         32768, 98304, 163840, 229376, 294912
24 
25 Writing inode tables: done
26 Writing superblocks and filesystem accounting information: done
27 
28 This filesystem will be automatically checked every 39 mounts or
29 180 days, whichever comes first.  Use tune2fs -c or -i to override    #表示每39次掛載或者180天(半年)文件系統會自動檢測一次。.
30 [root@yinzhengjie ~]#
31 [root@yinzhengjie ~]#
32 [root@yinzhengjie ~]# mke2fs -j /dev/sdb3  #格式化該分區,指定格式爲ext3文件系統
33 mke2fs 1.41.12 (17-May-2010)
34 Filesystem label=
35 OS type: Linux
36 Block size=4096 (log=2)
37 Fragment size=4096 (log=2)
38 Stride=0 blocks, Stripe width=0 blocks
39 131648 inodes, 526128 blocks
40 26306 blocks (5.00%) reserved for the super user
41 First data block=0
42 Maximum filesystem blocks=541065216
43 17 block groups
44 32768 blocks per group, 32768 fragments per group
45 7744 inodes per group
46 Superblock backups stored on blocks:
47         32768, 98304, 163840, 229376, 294912
48 
49 Writing inode tables: done
50 Creating journal (16384 blocks): done   #與ext2相比多出來的項目,存放日誌的區域。
51 Writing superblocks and filesystem accounting information: done
52 
53 This filesystem will be automatically checked every 38 mounts or
54 180 days, whichever comes first.  Use tune2fs -c or -i to override.  #這裏的是38次掛載或者6個月進行一次掛載,和ext2的區別。
55 [root@yinzhengjie ~]# 
56 '''
用mke2fs的-j參數格式化分區
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mke2fs -L Data -t ext4 /dev/sdb3  #指定卷標和文件系統格式
 9 mke2fs 1.41.12 (17-May-2010)
10 Filesystem label=Data  #這就是卷標
11 OS type: Linux
12 Block size=4096 (log=2)
13 Fragment size=4096 (log=2)
14 Stride=0 blocks, Stripe width=0 blocks
15 131648 inodes, 526128 blocks
16 26306 blocks (5.00%) reserved for the super user
17 First data block=0
18 Maximum filesystem blocks=541065216
19 17 block groups
20 32768 blocks per group, 32768 fragments per group
21 7744 inodes per group
22 Superblock backups stored on blocks: 
23         32768, 98304, 163840, 229376, 294912
24 
25 Writing inode tables: done                            
26 Creating journal (16384 blocks): done
27 Writing superblocks and filesystem accounting information: done
28 
29 This filesystem will be automatically checked every 38 mounts or
30 180 days, whichever comes first.  Use tune2fs -c or -i to override.
31 [root@yinzhengjie ~]# 
32 '''
用mke2fs的-L用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# e2label /dev/sdb3   #查看卷標名
 9 Data
10 [root@yinzhengjie ~]# e2label /dev/sdb3  MYDATA  #修改卷標名
11 [root@yinzhengjie ~]# e2label /dev/sdb3
12 MYDATA
13 [root@yinzhengjie ~]# 
14 '''
用e2label查看或修改卷標名
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mke2fs -b 2048 -m 3 -t ext4 /dev/sdb3
 9 mke2fs 1.41.12 (17-May-2010)
10 Filesystem label=
11 OS type: Linux
12 Block size=2048 (log=1)  #被修改的塊大小爲2048
13 Fragment size=2048 (log=1)  
14 Stride=0 blocks, Stripe width=0 blocks
15 131560 inodes, 1052256 blocks
16 31567 blocks (3.00%) reserved for the super user   #給管理員預留的block,這個就是經過上面的「-m」參數實現的。
17 First data block=0
18 Maximum filesystem blocks=538968064
19 65 block groups
20 16384 blocks per group, 16384 fragments per group
21 2024 inodes per group
22 Superblock backups stored on blocks:
23         16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816
24 
25 Writing inode tables: done
26 Creating journal (32768 blocks): done
27 Writing superblocks and filesystem accounting information: done
28 
29 This filesystem will be automatically checked every 29 mounts or
30 180 days, whichever comes first.  Use tune2fs -c or -i to override.
31 [root@yinzhengjie ~]#
32 '''
mke2fs的-b與-m參數的用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# blkid /dev/sdb3   #查看分區的UUID和TYPE,咱們能夠用uuid來進行掛載
 9 /dev/sdb3: UUID="87f7686e-09bd-4a1e-a567-4939c6a4dcab" TYPE="ext4"
10 [root@yinzhengjie ~]#
11 '''
blkid 查看UUID和TYPE
  1 #!/usr/bin/env python
  2 #_*_coding:utf-8_*_
  3 #@author :yinzhengjie
  4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
  5 #EMAIL:y1053419035@qq.com
  6 
  7 '''
  8 [root@yinzhengjie ~]# dumpe2fs /dev/sdb3  
  9 dumpe2fs 1.41.12 (17-May-2010)
 10 Filesystem volume name:   <none>
 11 Last mounted on:          <not available>
 12 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
 13 Filesystem magic number:  0xEF53
 14 Filesystem revision #:    1 (dynamic)
 15 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
 16 Filesystem flags:         signed_directory_hash
 17 Default mount options:    (none)
 18 Filesystem state:         clean
 19 Errors behavior:          Continue
 20 Filesystem OS type:       Linux
 21 Inode count:              131560
 22 Block count:              1052256
 23 Reserved block count:     31567
 24 Free blocks:              998268
 25 Free inodes:              131549
 26 First block:              0
 27 Block size:               2048
 28 Fragment size:            2048
 29 Reserved GDT blocks:      512
 30 Blocks per group:         16384
 31 Fragments per group:      16384
 32 Inodes per group:         2024
 33 Inode blocks per group:   253
 34 Flex block group size:    16
 35 Filesystem created:       Thu May 11 12:42:49 2017
 36 Last mount time:          n/a
 37 Last write time:          Thu May 11 12:42:49 2017
 38 Mount count:              0
 39 Maximum mount count:      29
 40 Last checked:             Thu May 11 12:42:49 2017
 41 Check interval:           15552000 (6 months)
 42 Next check after:         Tue Nov  7 11:42:49 2017
 43 Lifetime writes:          97 MB
 44 Reserved blocks uid:      0 (user root)
 45 Reserved blocks gid:      0 (group root)
 46 First inode:              11
 47 Inode size:               256
 48 Required extra isize:     28
 49 Desired extra isize:      28
 50 Journal inode:            8
 51 Default directory hash:   half_md4
 52 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
 53 Journal backup:           inode blocks
 54 Journal features:         (none)
 55 Journal size:             64M
 56 Journal length:           32768
 57 Journal sequence:         0x00000001
 58 Journal start:            0
 59 
 60 
 61 Group 0: (Blocks 0-16383) [ITABLE_ZEROED]  #顯示組名,存儲數據的block編號,若是你的Bolck和上個組沒有鏈接上就說明存在磁盤碎片
 62   Checksum 0x8fce, unused inodes 2013  #沒有用的inode有多少個
 63   Primary superblock at 0, Group descriptors at 1-2
 64   Reserved GDT blocks at 3-514
 65   Block bitmap at 515 (+515), Inode bitmap at 531 (+531)
 66   Inode table at 547-799 (+547)
 67   11779 free blocks, 2013 free inodes, 2 directories, 2013 unused inodes
 68   Free blocks: 4605-16383
 69   Free inodes: 12-2024
 70 Group 1: (Blocks 16384-32767) [INODE_UNINIT, ITABLE_ZEROED]
 71   Checksum 0xd2d4, unused inodes 2024
 72   Backup superblock at 16384, Group descriptors at 16385-16386
 73   Reserved GDT blocks at 16387-16898
 74   Block bitmap at 516 (+4294951428), Inode bitmap at 532 (+4294951444)
 75   Inode table at 800-1052 (+4294951712)
 76   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
 77   Free blocks: 16899-32767
 78   Free inodes: 2025-4048
 79 Group 2: (Blocks 32768-49151) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
 80   Checksum 0x209d, unused inodes 2024
 81   Block bitmap at 517 (+4294935045), Inode bitmap at 533 (+4294935061)
 82   Inode table at 1053-1305 (+4294935581)
 83   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
 84   Free blocks: 32768-49151
 85   Free inodes: 4049-6072
 86 Group 3: (Blocks 49152-65535) [INODE_UNINIT, ITABLE_ZEROED]
 87   Checksum 0x595b, unused inodes 2024
 88   Backup superblock at 49152, Group descriptors at 49153-49154
 89   Reserved GDT blocks at 49155-49666
 90   Block bitmap at 518 (+4294918662), Inode bitmap at 534 (+4294918678)
 91   Inode table at 1306-1558 (+4294919450)
 92   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
 93   Free blocks: 49667-65535
 94   Free inodes: 6073-8096
 95 Group 4: (Blocks 65536-81919) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
 96   Checksum 0x4c65, unused inodes 2024
 97   Block bitmap at 519 (+4294902279), Inode bitmap at 535 (+4294902295)
 98   Inode table at 1559-1811 (+4294903319)
 99   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
100   Free blocks: 65536-81919
101   Free inodes: 8097-10120
102 Group 5: (Blocks 81920-98303) [INODE_UNINIT, ITABLE_ZEROED]
103   Checksum 0x86c0, unused inodes 2024
104   Backup superblock at 81920, Group descriptors at 81921-81922
105   Reserved GDT blocks at 81923-82434
106   Block bitmap at 520 (+4294885896), Inode bitmap at 536 (+4294885912)
107   Inode table at 1812-2064 (+4294887188)
108   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
109   Free blocks: 82435-98303
110   Free inodes: 10121-12144
111 Group 6: (Blocks 98304-114687) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
112   Checksum 0x8dba, unused inodes 2024
113   Block bitmap at 521 (+4294869513), Inode bitmap at 537 (+4294869529)
114   Inode table at 2065-2317 (+4294871057)
115   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
116   Free blocks: 98304-114687
117   Free inodes: 12145-14168
118 Group 7: (Blocks 114688-131071) [INODE_UNINIT, ITABLE_ZEROED]
119   Checksum 0x5fe4, unused inodes 2024
120   Backup superblock at 114688, Group descriptors at 114689-114690
121   Reserved GDT blocks at 114691-115202
122   Block bitmap at 522 (+4294853130), Inode bitmap at 538 (+4294853146)
123   Inode table at 2318-2570 (+4294854926)
124   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
125   Free blocks: 115203-131071
126   Free inodes: 14169-16192
127 Group 8: (Blocks 131072-147455) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
128   Checksum 0x0451, unused inodes 2024
129   Block bitmap at 523 (+4294836747), Inode bitmap at 539 (+4294836763)
130   Inode table at 2571-2823 (+4294838795)
131   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
132   Free blocks: 131072-147455
133   Free inodes: 16193-18216
134 Group 9: (Blocks 147456-163839) [INODE_UNINIT, ITABLE_ZEROED]
135   Checksum 0xb130, unused inodes 2024
136   Backup superblock at 147456, Group descriptors at 147457-147458
137   Reserved GDT blocks at 147459-147970
138   Block bitmap at 524 (+4294820364), Inode bitmap at 540 (+4294820380)
139   Inode table at 2824-3076 (+4294822664)
140   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
141   Free blocks: 147971-163839
142   Free inodes: 18217-20240
143 Group 10: (Blocks 163840-180223) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
144   Checksum 0x544a, unused inodes 2024
145   Block bitmap at 525 (+4294803981), Inode bitmap at 541 (+4294803997)
146   Inode table at 3077-3329 (+4294806533)
147   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
148   Free blocks: 163840-180223
149   Free inodes: 20241-22264
150 Group 11: (Blocks 180224-196607) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
151   Checksum 0x3e65, unused inodes 2024
152   Block bitmap at 526 (+4294787598), Inode bitmap at 542 (+4294787614)
153   Inode table at 3330-3582 (+4294790402)
154   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
155   Free blocks: 180224-196607
156   Free inodes: 22265-24288
157 Group 12: (Blocks 196608-212991) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
158   Checksum 0x407e, unused inodes 2024
159   Block bitmap at 527 (+4294771215), Inode bitmap at 543 (+4294771231)
160   Inode table at 3583-3835 (+4294774271)
161   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
162   Free blocks: 196608-212991
163   Free inodes: 24289-26312
164 Group 13: (Blocks 212992-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
165   Checksum 0x3bb2, unused inodes 2024
166   Block bitmap at 528 (+4294754832), Inode bitmap at 544 (+4294754848)
167   Inode table at 3836-4088 (+4294758140)
168   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
169   Free blocks: 212992-229375
170   Free inodes: 26313-28336
171 Group 14: (Blocks 229376-245759) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
172   Checksum 0x0dce, unused inodes 2024
173   Block bitmap at 529 (+4294738449), Inode bitmap at 545 (+4294738465)
174   Inode table at 4089-4341 (+4294742009)
175   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
176   Free blocks: 229376-245759
177   Free inodes: 28337-30360
178 Group 15: (Blocks 245760-262143) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
179   Checksum 0x7e95, unused inodes 2024
180   Block bitmap at 530 (+4294722066), Inode bitmap at 546 (+4294722082)
181   Inode table at 4342-4594 (+4294725878)
182   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
183   Free blocks: 245760-262143
184   Free inodes: 30361-32384
185 Group 16: (Blocks 262144-278527) [INODE_UNINIT, ITABLE_ZEROED]
186   Checksum 0x0990, unused inodes 2024
187   Block bitmap at 262144 (+0), Inode bitmap at 262160 (+16)
188   Inode table at 262176-262428 (+32)
189   12304 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
190   Free blocks: 266224-278527
191   Free inodes: 32385-34408
192 Group 17: (Blocks 278528-294911) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
193   Checksum 0xcd8f, unused inodes 2024
194   Block bitmap at 262145 (+4294950913), Inode bitmap at 262161 (+4294950929)
195   Inode table at 262429-262681 (+4294951197)
196   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
197   Free blocks: 278528-294911
198   Free inodes: 34409-36432
199 Group 18: (Blocks 294912-311295) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
200   Checksum 0xdf82, unused inodes 2024
201   Block bitmap at 262146 (+4294934530), Inode bitmap at 262162 (+4294934546)
202   Inode table at 262682-262934 (+4294935066)
203   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
204   Free blocks: 294912-311295
205   Free inodes: 36433-38456
206 Group 19: (Blocks 311296-327679) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
207   Checksum 0xd576, unused inodes 2024
208   Block bitmap at 262147 (+4294918147), Inode bitmap at 262163 (+4294918163)
209   Inode table at 262935-263187 (+4294918935)
210   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
211   Free blocks: 311296-327679
212   Free inodes: 38457-40480
213 Group 20: (Blocks 327680-344063) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
214   Checksum 0xfb98, unused inodes 2024
215   Block bitmap at 262148 (+4294901764), Inode bitmap at 262164 (+4294901780)
216   Inode table at 263188-263440 (+4294902804)
217   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
218   Free blocks: 327680-344063
219   Free inodes: 40481-42504
220 Group 21: (Blocks 344064-360447) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
221   Checksum 0x57e5, unused inodes 2024
222   Block bitmap at 262149 (+4294885381), Inode bitmap at 262165 (+4294885397)
223   Inode table at 263441-263693 (+4294886673)
224   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
225   Free blocks: 344064-360447
226   Free inodes: 42505-44528
227 Group 22: (Blocks 360448-376831) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
228   Checksum 0xee70, unused inodes 2024
229   Block bitmap at 262150 (+4294868998), Inode bitmap at 262166 (+4294869014)
230   Inode table at 263694-263946 (+4294870542)
231   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
232   Free blocks: 360448-376831
233   Free inodes: 44529-46552
234 Group 23: (Blocks 376832-393215) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
235   Checksum 0x420d, unused inodes 2024
236   Block bitmap at 262151 (+4294852615), Inode bitmap at 262167 (+4294852631)
237   Inode table at 263947-264199 (+4294854411)
238   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
239   Free blocks: 376832-393215
240   Free inodes: 46553-48576
241 Group 24: (Blocks 393216-409599) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
242   Checksum 0xb3ac, unused inodes 2024
243   Block bitmap at 262152 (+4294836232), Inode bitmap at 262168 (+4294836248)
244   Inode table at 264200-264452 (+4294838280)
245   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
246   Free blocks: 393216-409599
247   Free inodes: 48577-50600
248 Group 25: (Blocks 409600-425983) [INODE_UNINIT, ITABLE_ZEROED]
249   Checksum 0xaab1, unused inodes 2024
250   Backup superblock at 409600, Group descriptors at 409601-409602
251   Reserved GDT blocks at 409603-410114
252   Block bitmap at 262153 (+4294819849), Inode bitmap at 262169 (+4294819865)
253   Inode table at 264453-264705 (+4294822149)
254   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
255   Free blocks: 410115-425983
256   Free inodes: 50601-52624
257 Group 26: (Blocks 425984-442367) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
258   Checksum 0xab55, unused inodes 2024
259   Block bitmap at 262154 (+4294803466), Inode bitmap at 262170 (+4294803482)
260   Inode table at 264706-264958 (+4294806018)
261   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
262   Free blocks: 425984-442367
263   Free inodes: 52625-54648
264 Group 27: (Blocks 442368-458751) [INODE_UNINIT, ITABLE_ZEROED]
265   Checksum 0x28a7, unused inodes 2024
266   Backup superblock at 442368, Group descriptors at 442369-442370
267   Reserved GDT blocks at 442371-442882
268   Block bitmap at 262155 (+4294787083), Inode bitmap at 262171 (+4294787099)
269   Inode table at 264959-265211 (+4294789887)
270   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
271   Free blocks: 442883-458751
272   Free inodes: 54649-56672
273 Group 28: (Blocks 458752-475135) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
274   Checksum 0x73c6, unused inodes 2024
275   Block bitmap at 262156 (+4294770700), Inode bitmap at 262172 (+4294770716)
276   Inode table at 265212-265464 (+4294773756)
277   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
278   Free blocks: 458752-475135
279   Free inodes: 56673-58696
280 Group 29: (Blocks 475136-491519) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
281   Checksum 0xb9dd, unused inodes 2024
282   Block bitmap at 262157 (+4294754317), Inode bitmap at 262173 (+4294754333)
283   Inode table at 265465-265717 (+4294757625)
284   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
285   Free blocks: 475136-491519
286   Free inodes: 58697-60720
287 Group 30: (Blocks 491520-507903) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
288   Checksum 0xef7a, unused inodes 2024
289   Block bitmap at 262158 (+4294737934), Inode bitmap at 262174 (+4294737950)
290   Inode table at 265718-265970 (+4294741494)
291   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
292   Free blocks: 491520-507903
293   Free inodes: 60721-62744
294 Group 31: (Blocks 507904-524287) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
295   Checksum 0xa124, unused inodes 2024
296   Block bitmap at 262159 (+4294721551), Inode bitmap at 262175 (+4294721567)
297   Inode table at 265971-266223 (+4294725363)
298   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
299   Free blocks: 507904-524287
300   Free inodes: 62745-64768
301 Group 32: (Blocks 524288-540671) [INODE_UNINIT, ITABLE_ZEROED]
302   Checksum 0xcb02, unused inodes 2024
303   Block bitmap at 524288 (+0), Inode bitmap at 524304 (+16)
304   Inode table at 524320-524572 (+32)
305   12304 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
306   Free blocks: 528368-540671
307   Free inodes: 64769-66792
308 Group 33: (Blocks 540672-557055) [INODE_UNINIT, ITABLE_ZEROED]
309   Checksum 0x1cd5, unused inodes 2024
310   Block bitmap at 524289 (+4294950913), Inode bitmap at 524305 (+4294950929)
311   Inode table at 524573-524825 (+4294951197)
312   0 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
313   Free blocks:
314   Free inodes: 66793-68816
315 Group 34: (Blocks 557056-573439) [INODE_UNINIT, ITABLE_ZEROED]
316   Checksum 0x0ed8, unused inodes 2024
317   Block bitmap at 524290 (+4294934530), Inode bitmap at 524306 (+4294934546)
318   Inode table at 524826-525078 (+4294935066)
319   0 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
320   Free blocks:
321   Free inodes: 68817-70840
322 Group 35: (Blocks 573440-589823) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
323   Checksum 0x17e4, unused inodes 2024
324   Block bitmap at 524291 (+4294918147), Inode bitmap at 524307 (+4294918163)
325   Inode table at 525079-525331 (+4294918935)
326   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
327   Free blocks: 573440-589823
328   Free inodes: 70841-72864
329 Group 36: (Blocks 589824-606207) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
330   Checksum 0x390a, unused inodes 2024
331   Block bitmap at 524292 (+4294901764), Inode bitmap at 524308 (+4294901780)
332   Inode table at 525332-525584 (+4294902804)
333   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
334   Free blocks: 589824-606207
335   Free inodes: 72865-74888
336 Group 37: (Blocks 606208-622591) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
337   Checksum 0x9577, unused inodes 2024
338   Block bitmap at 524293 (+4294885381), Inode bitmap at 524309 (+4294885397)
339   Inode table at 525585-525837 (+4294886673)
340   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
341   Free blocks: 606208-622591
342   Free inodes: 74889-76912
343 Group 38: (Blocks 622592-638975) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
344   Checksum 0x2ce2, unused inodes 2024
345   Block bitmap at 524294 (+4294868998), Inode bitmap at 524310 (+4294869014)
346   Inode table at 525838-526090 (+4294870542)
347   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
348   Free blocks: 622592-638975
349   Free inodes: 76913-78936
350 Group 39: (Blocks 638976-655359) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
351   Checksum 0x809f, unused inodes 2024
352   Block bitmap at 524295 (+4294852615), Inode bitmap at 524311 (+4294852631)
353   Inode table at 526091-526343 (+4294854411)
354   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
355   Free blocks: 638976-655359
356   Free inodes: 78937-80960
357 Group 40: (Blocks 655360-671743) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
358   Checksum 0x713e, unused inodes 2024
359   Block bitmap at 524296 (+4294836232), Inode bitmap at 524312 (+4294836248)
360   Inode table at 526344-526596 (+4294838280)
361   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
362   Free blocks: 655360-671743
363   Free inodes: 80961-82984
364 Group 41: (Blocks 671744-688127) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
365   Checksum 0x7bca, unused inodes 2024
366   Block bitmap at 524297 (+4294819849), Inode bitmap at 524313 (+4294819865)
367   Inode table at 526597-526849 (+4294822149)
368   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
369   Free blocks: 671744-688127
370   Free inodes: 82985-85008
371 Group 42: (Blocks 688128-704511) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
372   Checksum 0x69c7, unused inodes 2024
373   Block bitmap at 524298 (+4294803466), Inode bitmap at 524314 (+4294803482)
374   Inode table at 526850-527102 (+4294806018)
375   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
376   Free blocks: 688128-704511
377   Free inodes: 85009-87032
378 Group 43: (Blocks 704512-720895) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
379   Checksum 0xf9dc, unused inodes 2024
380   Block bitmap at 524299 (+4294787083), Inode bitmap at 524315 (+4294787099)
381   Inode table at 527103-527355 (+4294789887)
382   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
383   Free blocks: 704512-720895
384   Free inodes: 87033-89056
385 Group 44: (Blocks 720896-737279) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
386   Checksum 0xb154, unused inodes 2024
387   Block bitmap at 524300 (+4294770700), Inode bitmap at 524316 (+4294770716)
388   Inode table at 527356-527608 (+4294773756)
389   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
390   Free blocks: 720896-737279
391   Free inodes: 89057-91080
392 Group 45: (Blocks 737280-753663) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
393   Checksum 0x7b4f, unused inodes 2024
394   Block bitmap at 524301 (+4294754317), Inode bitmap at 524317 (+4294754333)
395   Inode table at 527609-527861 (+4294757625)
396   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
397   Free blocks: 737280-753663
398   Free inodes: 91081-93104
399 Group 46: (Blocks 753664-770047) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
400   Checksum 0x2de8, unused inodes 2024
401   Block bitmap at 524302 (+4294737934), Inode bitmap at 524318 (+4294737950)
402   Inode table at 527862-528114 (+4294741494)
403   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
404   Free blocks: 753664-770047
405   Free inodes: 93105-95128
406 Group 47: (Blocks 770048-786431) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
407   Checksum 0x63b6, unused inodes 2024
408   Block bitmap at 524303 (+4294721551), Inode bitmap at 524319 (+4294721567)
409   Inode table at 528115-528367 (+4294725363)
410   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
411   Free blocks: 770048-786431
412   Free inodes: 95129-97152
413 Group 48: (Blocks 786432-802815) [INODE_UNINIT, ITABLE_ZEROED]
414   Checksum 0x8a8c, unused inodes 2024
415   Block bitmap at 786432 (+0), Inode bitmap at 786448 (+16)
416   Inode table at 786464-786716 (+32)
417   12304 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
418   Free blocks: 790512-802815
419   Free inodes: 97153-99176
420 Group 49: (Blocks 802816-819199) [INODE_UNINIT, ITABLE_ZEROED]
421   Checksum 0x5d7a, unused inodes 2024
422   Backup superblock at 802816, Group descriptors at 802817-802818
423   Reserved GDT blocks at 802819-803330
424   Block bitmap at 786433 (+4294950913), Inode bitmap at 786449 (+4294950929)
425   Inode table at 786717-786969 (+4294951197)
426   15869 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
427   Free blocks: 803331-819199
428   Free inodes: 99177-101200
429 Group 50: (Blocks 819200-835583) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
430   Checksum 0x5c9e, unused inodes 2024
431   Block bitmap at 786434 (+4294934530), Inode bitmap at 786450 (+4294934546)
432   Inode table at 786970-787222 (+4294935066)
433   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
434   Free blocks: 819200-835583
435   Free inodes: 101201-103224
436 Group 51: (Blocks 835584-851967) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
437   Checksum 0x566a, unused inodes 2024
438   Block bitmap at 786435 (+4294918147), Inode bitmap at 786451 (+4294918163)
439   Inode table at 787223-787475 (+4294918935)
440   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
441   Free blocks: 835584-851967
442   Free inodes: 103225-105248
443 Group 52: (Blocks 851968-868351) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
444   Checksum 0x7884, unused inodes 2024
445   Block bitmap at 786436 (+4294901764), Inode bitmap at 786452 (+4294901780)
446   Inode table at 787476-787728 (+4294902804)
447   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
448   Free blocks: 851968-868351
449   Free inodes: 105249-107272
450 Group 53: (Blocks 868352-884735) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
451   Checksum 0xd4f9, unused inodes 2024
452   Block bitmap at 786437 (+4294885381), Inode bitmap at 786453 (+4294885397)
453   Inode table at 787729-787981 (+4294886673)
454   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
455   Free blocks: 868352-884735
456   Free inodes: 107273-109296
457 Group 54: (Blocks 884736-901119) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
458   Checksum 0x6d6c, unused inodes 2024
459   Block bitmap at 786438 (+4294868998), Inode bitmap at 786454 (+4294869014)
460   Inode table at 787982-788234 (+4294870542)
461   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
462   Free blocks: 884736-901119
463   Free inodes: 109297-111320
464 Group 55: (Blocks 901120-917503) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
465   Checksum 0xc111, unused inodes 2024
466   Block bitmap at 786439 (+4294852615), Inode bitmap at 786455 (+4294852631)
467   Inode table at 788235-788487 (+4294854411)
468   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
469   Free blocks: 901120-917503
470   Free inodes: 111321-113344
471 Group 56: (Blocks 917504-933887) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
472   Checksum 0x30b0, unused inodes 2024
473   Block bitmap at 786440 (+4294836232), Inode bitmap at 786456 (+4294836248)
474   Inode table at 788488-788740 (+4294838280)
475   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
476   Free blocks: 917504-933887
477   Free inodes: 113345-115368
478 Group 57: (Blocks 933888-950271) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
479   Checksum 0x3a44, unused inodes 2024
480   Block bitmap at 786441 (+4294819849), Inode bitmap at 786457 (+4294819865)
481   Inode table at 788741-788993 (+4294822149)
482   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
483   Free blocks: 933888-950271
484   Free inodes: 115369-117392
485 Group 58: (Blocks 950272-966655) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
486   Checksum 0x2849, unused inodes 2024
487   Block bitmap at 786442 (+4294803466), Inode bitmap at 786458 (+4294803482)
488   Inode table at 788994-789246 (+4294806018)
489   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
490   Free blocks: 950272-966655
491   Free inodes: 117393-119416
492 Group 59: (Blocks 966656-983039) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
493   Checksum 0xb852, unused inodes 2024
494   Block bitmap at 786443 (+4294787083), Inode bitmap at 786459 (+4294787099)
495   Inode table at 789247-789499 (+4294789887)
496   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
497   Free blocks: 966656-983039
498   Free inodes: 119417-121440
499 Group 60: (Blocks 983040-999423) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
500   Checksum 0xf0da, unused inodes 2024
501   Block bitmap at 786444 (+4294770700), Inode bitmap at 786460 (+4294770716)
502   Inode table at 789500-789752 (+4294773756)
503   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
504   Free blocks: 983040-999423
505   Free inodes: 121441-123464
506 Group 61: (Blocks 999424-1015807) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
507   Checksum 0x3ac1, unused inodes 2024
508   Block bitmap at 786445 (+4294754317), Inode bitmap at 786461 (+4294754333)
509   Inode table at 789753-790005 (+4294757625)
510   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
511   Free blocks: 999424-1015807
512   Free inodes: 123465-125488
513 Group 62: (Blocks 1015808-1032191) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
514   Checksum 0x6c66, unused inodes 2024
515   Block bitmap at 786446 (+4294737934), Inode bitmap at 786462 (+4294737950)
516   Inode table at 790006-790258 (+4294741494)
517   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
518   Free blocks: 1015808-1032191
519   Free inodes: 125489-127512
520 Group 63: (Blocks 1032192-1048575) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
521   Checksum 0x2238, unused inodes 2024
522   Block bitmap at 786447 (+4294721551), Inode bitmap at 786463 (+4294721567)
523   Inode table at 790259-790511 (+4294725363)
524   16384 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
525   Free blocks: 1032192-1048575
526   Free inodes: 127513-129536
527 Group 64: (Blocks 1048576-1052255) [INODE_UNINIT, ITABLE_ZEROED]
528   Checksum 0xb5ee, unused inodes 2024
529   Block bitmap at 1048576 (+0), Inode bitmap at 1048592 (+16)
530   Inode table at 1048608-1048860 (+32)
531   3425 free blocks, 2024 free inodes, 0 directories, 2024 unused inodes
532   Free blocks: 1048577-1048591, 1048593-1048607, 1048861-1052255
533   Free inodes: 129537-131560
534 [root@yinzhengjie ~]#
535 '''
用dumpe2fs 查看超級塊和是否有碎片
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# dumpe2fs -h /dev/sdb3  #僅顯示超級塊中保存的信息
 9 dumpe2fs 1.41.12 (17-May-2010)
10 Filesystem volume name:   <none>  #文件系統卷標名稱
11 Last mounted on:          <not available>   #上一次上面時候掛載的
12 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
13 Filesystem magic number:  0xEF53  #文件的魔術號
14 Filesystem revision #:    1 (dynamic)
15 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize  #支持的默認屬性
16 Filesystem flags:         signed_directory_hash
17 Default mount options:    (none)
18 Filesystem state:         clean
19 Errors behavior:          Continue
20 Filesystem OS type:       Linux
21 Inode count:              131560
22 Block count:              1052256
23 Reserved block count:     31567
24 Free blocks:              998268
25 Free inodes:              131549
26 First block:              0
27 Block size:               2048
28 Fragment size:            2048
29 Reserved GDT blocks:      512
30 Blocks per group:         16384
31 Fragments per group:      16384
32 Inodes per group:         2024
33 Inode blocks per group:   253
34 Flex block group size:    16
35 Filesystem created:       Thu May 11 12:42:49 2017
36 Last mount time:          n/a
37 Last write time:          Thu May 11 12:42:49 2017
38 Mount count:              0
39 Maximum mount count:      29
40 Last checked:             Thu May 11 12:42:49 2017
41 Check interval:           15552000 (6 months)
42 Next check after:         Tue Nov  7 11:42:49 2017
43 Lifetime writes:          97 MB
44 Reserved blocks uid:      0 (user root)
45 Reserved blocks gid:      0 (group root)
46 First inode:              11
47 Inode size:               256
48 Required extra isize:     28
49 Desired extra isize:      28
50 Journal inode:            8
51 Default directory hash:   half_md4
52 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
53 Journal backup:           inode blocks
54 Journal features:         (none)
55 Journal size:             64M
56 Journal length:           32768
57 Journal sequence:         0x00000001
58 Journal start:            0
59 
60 [root@yinzhengjie ~]#
61 '''
dumpe2fs的-h參數用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# tune2fs -l /dev/sdb3  #查看超級塊中的信息。
 9 tune2fs 1.41.12 (17-May-2010)
10 Filesystem volume name:   <none>
11 Last mounted on:          <not available>
12 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
13 Filesystem magic number:  0xEF53
14 Filesystem revision #:    1 (dynamic)
15 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
16 Filesystem flags:         signed_directory_hash 
17 Default mount options:    (none)
18 Filesystem state:         clean
19 Errors behavior:          Continue
20 Filesystem OS type:       Linux
21 Inode count:              131560
22 Block count:              1052256
23 Reserved block count:     31567
24 Free blocks:              998268
25 Free inodes:              131549
26 First block:              0
27 Block size:               2048
28 Fragment size:            2048
29 Reserved GDT blocks:      512
30 Blocks per group:         16384
31 Fragments per group:      16384
32 Inodes per group:         2024
33 Inode blocks per group:   253
34 Flex block group size:    16
35 Filesystem created:       Thu May 11 12:42:49 2017
36 Last mount time:          n/a
37 Last write time:          Thu May 11 12:42:49 2017
38 Mount count:              0
39 Maximum mount count:      29
40 Last checked:             Thu May 11 12:42:49 2017
41 Check interval:           15552000 (6 months)
42 Next check after:         Tue Nov  7 11:42:49 2017
43 Lifetime writes:          97 MB
44 Reserved blocks uid:      0 (user root)
45 Reserved blocks gid:      0 (group root)
46 First inode:              11
47 Inode size:               256
48 Required extra isize:     28
49 Desired extra isize:      28
50 Journal inode:            8
51 Default directory hash:   half_md4
52 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
53 Journal backup:           inode blocks
54 [root@yinzhengjie ~]# 
55 [root@yinzhengjie ~]#
56 '''
用tune2fs查看超級塊中的信息。
  1 #!/usr/bin/env python
  2 #_*_coding:utf-8_*_
  3 #@author :yinzhengjie
  4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
  5 #EMAIL:y1053419035@qq.com
  6 
  7 '''
  8 [root@yinzhengjie ~]# tune2fs -l /dev/sdb3  #查看/dev/sdb3 超級塊中的信息
  9 tune2fs 1.41.12 (17-May-2010)
 10 Filesystem volume name:   <none>
 11 Last mounted on:          <not available>
 12 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
 13 Filesystem magic number:  0xEF53
 14 Filesystem revision #:    1 (dynamic)
 15 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize  #含有分區特性「huge_file」
 16 Filesystem flags:         signed_directory_hash
 17 Default mount options:    (none)
 18 Filesystem state:         not clean
 19 Errors behavior:          Continue
 20 Filesystem OS type:       Linux
 21 Inode count:              131560
 22 Block count:              1052256
 23 Reserved block count:     31567
 24 Free blocks:              998268
 25 Free inodes:              131549
 26 First block:              0
 27 Block size:               2048
 28 Fragment size:            2048
 29 Reserved GDT blocks:      512
 30 Blocks per group:         16384
 31 Fragments per group:      16384
 32 Inodes per group:         2024
 33 Inode blocks per group:   253
 34 Flex block group size:    16
 35 Filesystem created:       Thu May 11 12:42:49 2017
 36 Last mount time:          n/a
 37 Last write time:          Thu May 11 13:04:33 2017
 38 Mount count:              0
 39 Maximum mount count:      29
 40 Last checked:             Thu May 11 12:42:49 2017
 41 Check interval:           15552000 (6 months)
 42 Next check after:         Tue Nov  7 11:42:49 2017
 43 Lifetime writes:          97 MB
 44 Reserved blocks uid:      0 (user root)
 45 Reserved blocks gid:      0 (group root)
 46 First inode:              11
 47 Inode size:               256
 48 Required extra isize:     28
 49 Desired extra isize:      28
 50 Journal inode:            8
 51 Default directory hash:   half_md4
 52 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
 53 Journal backup:           inode blocks
 54 [root@yinzhengjie ~]# tune2fs -O ^huge_file /dev/sdb3   #關閉/dev/sdb3的huge_file分區特性
 55 tune2fs 1.41.12 (17-May-2010)
 56 
 57 Please run e2fsck on the filesystem.
 58 
 59 [root@yinzhengjie ~]# tune2fs -l /dev/sdb3
 60 tune2fs 1.41.12 (17-May-2010)
 61 Filesystem volume name:   <none>
 62 Last mounted on:          <not available>
 63 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
 64 Filesystem magic number:  0xEF53
 65 Filesystem revision #:    1 (dynamic)
 66 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super uninit_bg dir_nlink extra_isize  #果然huge_file的分區特性沒了
 67 Filesystem flags:         signed_directory_hash
 68 Default mount options:    (none)
 69 Filesystem state:         not clean
 70 Errors behavior:          Continue
 71 Filesystem OS type:       Linux
 72 Inode count:              131560
 73 Block count:              1052256
 74 Reserved block count:     31567
 75 Free blocks:              998268
 76 Free inodes:              131549
 77 First block:              0
 78 Block size:               2048
 79 Fragment size:            2048
 80 Reserved GDT blocks:      512
 81 Blocks per group:         16384
 82 Fragments per group:      16384
 83 Inodes per group:         2024
 84 Inode blocks per group:   253
 85 Flex block group size:    16
 86 Filesystem created:       Thu May 11 12:42:49 2017
 87 Last mount time:          n/a
 88 Last write time:          Thu May 11 13:04:49 2017
 89 Mount count:              0
 90 Maximum mount count:      29
 91 Last checked:             Thu May 11 12:42:49 2017
 92 Check interval:           15552000 (6 months)
 93 Next check after:         Tue Nov  7 11:42:49 2017
 94 Lifetime writes:          97 MB
 95 Reserved blocks uid:      0 (user root)
 96 Reserved blocks gid:      0 (group root)
 97 First inode:              11
 98 Inode size:               256
 99 Required extra isize:     28
100 Desired extra isize:      28
101 Journal inode:            8
102 Default directory hash:   half_md4
103 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
104 Journal backup:           inode blocks
105 [root@yinzhengjie ~]# tune2fs -O huge_file /dev/sdb3  #打開/dev/sdb3的huge_file分區特性
106 tune2fs 1.41.12 (17-May-2010)
107 [root@yinzhengjie ~]# tune2fs -l /dev/sdb3
108 tune2fs 1.41.12 (17-May-2010)
109 Filesystem volume name:   <none>
110 Last mounted on:          <not available>
111 Filesystem UUID:          87f7686e-09bd-4a1e-a567-4939c6a4dcab
112 Filesystem magic number:  0xEF53
113 Filesystem revision #:    1 (dynamic)
114 Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize  #/dev/sdb3的huge_file分區特性又有了
115 Filesystem flags:         signed_directory_hash
116 Default mount options:    (none)
117 Filesystem state:         not clean
118 Errors behavior:          Continue
119 Filesystem OS type:       Linux
120 Inode count:              131560
121 Block count:              1052256
122 Reserved block count:     31567
123 Free blocks:              998268
124 Free inodes:              131549
125 First block:              0
126 Block size:               2048
127 Fragment size:            2048
128 Reserved GDT blocks:      512
129 Blocks per group:         16384
130 Fragments per group:      16384
131 Inodes per group:         2024
132 Inode blocks per group:   253
133 Flex block group size:    16
134 Filesystem created:       Thu May 11 12:42:49 2017
135 Last mount time:          n/a
136 Last write time:          Thu May 11 13:05:00 2017
137 Mount count:              0
138 Maximum mount count:      29
139 Last checked:             Thu May 11 12:42:49 2017
140 Check interval:           15552000 (6 months)
141 Next check after:         Tue Nov  7 11:42:49 2017
142 Lifetime writes:          97 MB
143 Reserved blocks uid:      0 (user root)
144 Reserved blocks gid:      0 (group root)
145 First inode:              11
146 Inode size:               256
147 Required extra isize:     28
148 Desired extra isize:      28
149 Journal inode:            8
150 Default directory hash:   half_md4
151 Directory Hash Seed:      ff3c9e24-63aa-462a-9d6d-863f99c556d0
152 Journal backup:           inode blocks
153 [root@yinzhengjie ~]#
154 '''
tune2fs的對特性的開啓與關閉用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# fsck -t ext4 /dev/sdb3  #對文件系統檢測
 9 fsck from util-linux-ng 2.17.2
10 e2fsck 1.41.12 (17-May-2010)
11 /dev/sdb3 was not cleanly unmounted, check forced.
12 Pass 1: Checking inodes, blocks, and sizes  #檢測 inodes, blocks, and sizes
13 Pass 2: Checking directory structure        #檢測目錄機構
14 Pass 3: Checking directory connectivity     #檢測目錄連整性
15 Pass 4: Checking reference counts           #引用的次數
16 Pass 5: Checking group summary information  #檢查組彙總信息
17 /dev/sdb3: 11/131560 files (0.0% non-contiguous), 53988/1052256 blocks
18 [root@yinzhengjie ~]#
19 '''
用fsck進行文件類型檢查

 

11.建立交換分區linux

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8     若是物理內存不夠用時,能夠將那些最近不多使用的頁面數據(Page)置換出去,即切換到硬盤上,可是要注意的是內
 9 存文件的格式和硬盤中文件的格式是不同的,因此這個分區必須格式化成跟內存兼容的模式不能轉換成文件的格式。以便
10 把內存的page直接存入這個分區,方便內存直接調用。而這個頁面(page)數據對於32位的操做系統一個page大概是4K左右,
11 對於64位操做系統這個page大小是可變的,4k-2M的大小都是比較常見的。事實上到底能使用多大的頁面(page)取決於CPU
12 而不取決於內存喲!這就是虛擬內存的概念。在linux上咱們稱之爲交換分區。記住,虛擬內存必須是一個單獨的分區。
13 
14 那麼問題來了:虛擬內存能代替物理內存運行程序嗎?
15     答案是否認的,只是使用虛擬內存暫時保存數據,而不是代替物理內存運行程序。
16     虛擬內存的做用是這樣的:
17         當運行某個大程序、大遊戲,須要的內存超過空閒內存但小於物理內存總量時,會暫時把內存裏這些數據放到磁盤
18     上的虛擬內存裏,空出物理內存運行遊戲。等退出遊戲後,又會把虛擬內存裏的東西讀出來,放回物理內存。因此,虛擬
19     內存,並非用來虛擬物理內存的,而是暫存數據的。若是對內存的需求大於物理內存總量,那虛擬內存設多大都無論用。
20     電腦內存過低,根本的方法仍是增長物理內存,才能流暢。虛擬內存機制上就無論用,即便管用,比物理內存低100倍的速
21     度,也管不上什麼實際的做用。因此,虛擬內存大了是沒用的,反而白佔用磁盤空間。
22 '''
23 
24 '''
25 交換分區:
26       mkswap 格式化爲虛擬內存
27       -L label 指定卷標
28       swapon 啓動虛擬內存
29       -a 啓動全部的虛擬分區
30       -p:指定優先級
31       swapoff 關閉虛擬內存
32       更多參數請參考man mkswap
33 ''' 
  1 #!/usr/bin/env python
  2 #_*_coding:utf-8_*_
  3 #@author :yinzhengjie
  4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
  5 #EMAIL:y1053419035@qq.com
  6 
  7 '''
  8 [root@yinzhengjie ~]# fdisk /dev/sdb  #對第二塊硬盤進行分區調整
  9 
 10 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
 11          switch off the mode (command 'c') and change display units to
 12          sectors (command 'u').
 13 
 14 Command (m for help): p  #查看當前分區狀況
 15 
 16 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 17 255 heads, 63 sectors/track, 1305 cylinders
 18 Units = cylinders of 16065 * 512 = 8225280 bytes
 19 Sector size (logical/physical): 512 bytes / 512 bytes
 20 I/O size (minimum/optimal): 512 bytes / 512 bytes
 21 Disk identifier: 0x8614a108
 22 
 23    Device Boot      Start         End      Blocks   Id  System
 24 /dev/sdb1               1         132     1060258+  83  Linux
 25 /dev/sdb2             133         264     1060290   83  Linux
 26 /dev/sdb3             265         526     2104515   83  Linux
 27 /dev/sdb4             527        1305     6257317+   5  Extended
 28 /dev/sdb5             527         919     3156741   83  Linux
 29 /dev/sdb6             920        1181     2104483+  83  Linux    #我想講第6個分區弄成交換分區。
 30 
 31 Command (m for help): t  #調整分區ID
 32 Partition number (1-6): 6  #選擇分區編號爲6
 33 Hex code (type L to list codes): L   #查看分區類型所對應的ID號,咱們發現「82」就是交換分區的編號
 34 
 35  0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 36  1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
 37  2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
 38  3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 39  4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx
 40  5  Extended        42  SFS             86  NTFS volume set da  Non-FS data
 41  6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
 42  7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility
 43  8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt
 44  9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access
 45  a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O
 46  b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor
 47  c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs
 48  e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT
 49  f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
 50 10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
 51 11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor
 52 12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor
 53 14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary
 54 16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS
 55 17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
 56 18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
 57 1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep
 58 1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT
 59 1e  Hidden W95 FAT1
 60 Hex code (type L to list codes): 82   #設置該分區的標號
 61 Changed system type of partition 6 to 82 (Linux swap / Solaris)
 62 
 63 Command (m for help): P   #查看當前分區狀況
 64 
 65 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 66 255 heads, 63 sectors/track, 1305 cylinders
 67 Units = cylinders of 16065 * 512 = 8225280 bytes
 68 Sector size (logical/physical): 512 bytes / 512 bytes
 69 I/O size (minimum/optimal): 512 bytes / 512 bytes
 70 Disk identifier: 0x8614a108
 71 
 72    Device Boot      Start         End      Blocks   Id  System
 73 /dev/sdb1               1         132     1060258+  83  Linux
 74 /dev/sdb2             133         264     1060290   83  Linux
 75 /dev/sdb3             265         526     2104515   83  Linux
 76 /dev/sdb4             527        1305     6257317+   5  Extended
 77 /dev/sdb5             527         919     3156741   83  Linux
 78 /dev/sdb6             920        1181     2104483+  82  Linux swap / Solaris
 79 
 80 Command (m for help): W  #保存並退出
 81 The partition table has been altered!
 82 
 83 Calling ioctl() to re-read partition table.
 84 Syncing disks.
 85 [root@yinzhengjie ~]#
 86 [root@yinzhengjie ~]# fdisk -l /dev/sdb  #查看分區信息
 87 
 88 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
 89 255 heads, 63 sectors/track, 1305 cylinders
 90 Units = cylinders of 16065 * 512 = 8225280 bytes
 91 Sector size (logical/physical): 512 bytes / 512 bytes
 92 I/O size (minimum/optimal): 512 bytes / 512 bytes
 93 Disk identifier: 0x8614a108
 94 
 95    Device Boot      Start         End      Blocks   Id  System
 96 /dev/sdb1               1         132     1060258+  83  Linux
 97 /dev/sdb2             133         264     1060290   83  Linux
 98 /dev/sdb3             265         526     2104515   83  Linux
 99 /dev/sdb4             527        1305     6257317+   5  Extended
100 /dev/sdb5             527         919     3156741   83  Linux
101 /dev/sdb6             920        1181     2104483+  82  Linux swap / Solaris
102 [root@yinzhengjie ~]# 
103 '''
調整分區爲交換分區(swap)格式
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# kpartx -af /dev/sdb
 9 [root@yinzhengjie ~]# partx -a /dev/sdb   #重讀分區表信息,其實也能夠不用敲擊這些命令的若是你是一塊新硬盤的話。
10 BLKPG: Device or resource busy
11 error adding partition 1
12 BLKPG: Device or resource busy
13 error adding partition 2
14 BLKPG: Device or resource busy
15 error adding partition 3
16 BLKPG: Device or resource busy
17 error adding partition 4
18 BLKPG: Device or resource busy
19 error adding partition 5
20 BLKPG: Device or resource busy
21 error adding partition 6
22 [root@yinzhengjie ~]# 
23 '''
用partx 重讀一下分區表,避免系統未識別最新分區信息。
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mkswap /dev/sdb6  #將分區格式化成swap格式
 9 Setting up swapspace version 1, size = 2104476 KiB
10 no label, UUID=41687bb2-c775-489c-9b32-1e4be73c233b   #看見沒有,這裏是「no label」,是由於我沒有定義卷標名。
11 [root@yinzhengjie ~]# 
12 [root@yinzhengjie ~]# mkswap -L myswap /dev/sdb6   #用-L參數定義一個卷標名。
13 Setting up swapspace version 1, size = 2104476 KiB
14 LABEL=myswap, UUID=0553b99a-ee75-4476-8eda-70c591206467  #看見沒,「LABEL=myswap」這就是我定義的卷標名稱。
15 [root@yinzhengjie ~]# 
16 '''
用mkswap定義卷標名稱
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# cat /proc/meminfo | grep "^S"   #查看當前交換分區大小
 9 SwapCached:            0 kB
10 SwapTotal:       2031612 kB  #目前交換分區大小爲2G
11 SwapFree:        2031612 kB  #表示空閒交換分區大小
12 Shmem:              1444 kB
13 Slab:              75020 kB
14 SReclaimable:      15620 kB
15 SUnreclaim:        59400 kB
16 [root@yinzhengjie ~]#
17 [root@yinzhengjie ~]# swapon /dev/sdb6   #啓用咱們已經格式化好的交換分區「/dev/sdb」
18 [root@yinzhengjie ~]# cat /proc/meminfo | grep "^S"   #再次查看當前交換分區大小
19 SwapCached:            0 kB
20 SwapTotal:       4136088 kB   #咱們發現交換分區大小變大了2G
21 SwapFree:        4136088 kB
22 Shmem:              1444 kB
23 Slab:              75148 kB
24 SReclaimable:      15656 kB
25 SUnreclaim:        59492 kB
26 [root@yinzhengjie ~]#
27 [root@yinzhengjie ~]# swapoff /dev/sdb6  #關閉交換分區「/dev/sdb」
28 [root@yinzhengjie ~]#
29 [root@yinzhengjie ~]# cat /proc/meminfo | grep "^S"  #驗證是否關閉成功
30 SwapCached:            0 kB
31 SwapTotal:       2031612 kB   #發現的確是少了2G的空間
32 SwapFree:        2031612 kB
33 Shmem:              1444 kB
34 Slab:              75068 kB
35 SReclaimable:      15636 kB
36 SUnreclaim:        59432 kB
37 [root@yinzhengjie ~]#
38 
39 '''
swapon和swapoff的用法展現

 

12.獲取IDE磁盤的相關信息正則表達式

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 hdparm
 9     -i 從操做系統讀取
10     -I 直接從硬盤讀取
11     -g 顯示硬盤的佈局信息
12     -t 測試硬盤的性能
13     -T 測試硬盤的性能
14 
15 '''
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8      一個磁頭一次能夠讀取128位信息,系統就會認爲它被虛擬成128個磁頭(heads)。因此兩個磁頭(一個盤片有兩個面,
 9 一個盤面有一個磁頭,因此說一個盤片有2個磁頭)就是256個虛擬磁頭(heads)。
10 [root@yinzhengjie ~]#
11 [root@yinzhengjie ~]# fdisk -l /dev/sdb  #咱們能夠看出來磁盤的信息
12 
13 Disk /dev/sdb: 10.7 GB, 10737418240 bytes
14 255 heads, 63 sectors/track, 1305 cylinders  #這裏有255個磁頭實際上是工業生產致使,理論上就是256你們知道便可。
15 Units = cylinders of 16065 * 512 = 8225280 bytes
16 Sector size (logical/physical): 512 bytes / 512 bytes
17 I/O size (minimum/optimal): 512 bytes / 512 bytes
18 Disk identifier: 0x8614a108
19 
20    Device Boot      Start         End      Blocks   Id  System
21 /dev/sdb1               1         132     1060258+  83  Linux
22 /dev/sdb2             133         264     1060290   83  Linux
23 /dev/sdb3             265         526     2104515   83  Linux
24 /dev/sdb4             527        1305     6257317+   5  Extended
25 /dev/sdb5             527         919     3156741   83  Linux
26 /dev/sdb6             920        1181     2104483+  82  Linux swap / Solaris
27 [root@yinzhengjie ~]#
28 '''
29 
30 '''
31 [root@yinzhengjie ~]# hdparm -i /dev/sdb  #從操做系統讀取
32 
33 /dev/sdb:
34 SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
35  HDIO_GET_IDENTITY failed: Invalid argument
36 [root@yinzhengjie ~]#
37 [root@yinzhengjie ~]# hdparm -I /dev/sdb  #直接從硬盤讀取
38 
39 /dev/sdb:
40 SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
41 
42 ATA device, with non-removable media
43 Standards:
44         Likely used: 1
45 Configuration:
46         Logical         max     current
47         cylinders       0       0
48         heads           0       0
49         sectors/track   0       0
50         --
51         Logical/Physical Sector size:           512 bytes
52         device size with M = 1024*1024:           0 MBytes
53         device size with M = 1000*1000:           0 MBytes
54         cache/buffer size  = unknown
55 Capabilities:
56         IORDY not likely
57         Cannot perform double-word IO
58         R/W multiple sector transfer: not supported
59         DMA: not supported
60         PIO: pio0
61 [root@yinzhengjie ~]#
62 [root@yinzhengjie ~]# hdparm -g /dev/sdb  #顯示硬盤的佈局信息
63 
64 /dev/sdb:
65  geometry      = 1305(柱面數)/255(磁頭,heads)/63(每磁道的扇區數), sectors = 20971520(總的扇區數), start = 0(從第幾個扇區開始)
66 [root@yinzhengjie ~]#
67 
68 '''
hdparm用法展現

 

13.掛載vim

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 掛載分類:
 9     手動掛載
10     按需掛載(autofs,這種效率比較低,當用的時候纔去掛載,須要等待時間。)
11     開機自動掛載
12 
13 mount[options] -t 文件類型 -o option 設備 掛載點
14      [options] : 命令的選項
15            -n:不更新/etc/mtab文件
16            --bind:dir1 dir2 將目錄掛載到目錄上,使得dir2也能訪問dir1的文件
17            -t fstype
18            -r 只讀掛載
19            -w:讀寫掛載
20            -L lable 以卷標指定,也可使用LABLE="lable"
21            -U UUID:使用UUID掛載,也可使用 UUID="uuid"
22                -o options:掛載時啓動分區特性
23                          async:異步I/O
24                          sync:同步I/O
25                          noatime/atime 是否更新文件時間戳,不是特別重要的文件,建議noatime
26                          auto: 是否可以被mount -a 自動掛載全部(/etc/fstab中)的文件自動掛載
27                          dev/nodev:是否能建立設備文件
28                          diratime/nodirtime:是否更新目錄的時間戳
29                          exec/noexec:是否容許執行二進制程序
30                          _netdev:網絡設備
31                          remount:從新掛載
32                          relatime/norelatime 是否實時更新
33                          acl 文件訪問控制列表
34 
35 掛載點:掛載之後原始數據將被隱藏
36    一、選擇空閒目錄
37    二、必須事先存在
38 卸載:
39    一、空閒時能夠卸載
40    二、其實也能夠強行卸載
41 umount 設備|掛載點
42 
43 直接使用mount能夠顯示當前系統的掛載信息,也能夠查看/proc/mounts或者/etc/mtab
44 
45 光盤:
46  /dev/cdrom /dev/dvdrom /dev/sr0
47  [-t iso9660]
48 '''
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# cat /proc/filesystems  #查看內核能識別的文件系統類型
 9 nodev   sysfs  #其中「nodev」表示非設備文件系統,即僞文件系統,後面的參數是「sysfs」。
10 nodev   rootfs
11 nodev   bdev
12 nodev   proc
13 nodev   cgroup
14 nodev   cpuset
15 nodev   tmpfs
16 nodev   devtmpfs
17 nodev   binfmt_misc
18 nodev   debugfs
19 nodev   securityfs
20 nodev   sockfs
21 nodev   usbfs
22 nodev   pipefs
23 nodev   anon_inodefs
24 nodev   inotifyfs
25 nodev   devpts
26 nodev   ramfs
27 nodev   hugetlbfs
28         iso9660  #這就是設備文件系統,光盤
29 nodev   pstore
30 nodev   mqueue
31 nodev   selinuxfs
32         ext4    #這個也是設備文件系統,前面沒有「nodev」進行標識。
33 nodev   vmhgfs
34 nodev   fuse
35         fuseblk
36 nodev   fusectl
37 [root@yinzhengjie ~]#
38 '''
查看內核能識別的文件系統類型
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mkdir /yinzhengjie  #建立一個掛載目錄
 9 [root@yinzhengjie ~]# mount   #查看當前的掛載信息
10 /dev/sda2 on / type ext4 (rw)
11 proc on /proc type proc (rw)
12 sysfs on /sys type sysfs (rw)
13 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
14 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
15 /dev/sda1 on /boot type ext4 (rw)
16 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
17 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
18 [root@yinzhengjie ~]# mount /dev/sdb1 /yinzhengjie/  #將第二塊設備的第一個分區掛載到"/yinzhengjie"目錄下。
19 [root@yinzhengjie ~]# 
20 [root@yinzhengjie ~]# mount   #再次查看掛載信息,發現多出來了最後一項
21 /dev/sda2 on / type ext4 (rw)
22 proc on /proc type proc (rw)
23 sysfs on /sys type sysfs (rw)
24 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
25 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
26 /dev/sda1 on /boot type ext4 (rw)
27 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
28 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
29 /dev/sdb1 on /yinzhengjie type ext4 (rw)  #發現了掛載的目錄
30 [root@yinzhengjie ~]# ll /yinzhengjie/ #查看掛載點信息,出現了「lost+found」目錄表示掛載成功
31 total 16
32 drwx------. 2 root root 16384 May 12 04:31 lost+found
33 [root@yinzhengjie ~]# cd /yinzhengjie/
34 [root@yinzhengjie yinzhengjie]# touch {1..5}.txt  #咱們建立5個文件看看
35 [root@yinzhengjie yinzhengjie]# ll  #發現也能成功建立文件,文件名是存在掛載目錄下的。
36 total 16
37 -rw-r--r--. 1 root root     0 May 12 04:36 1.txt
38 -rw-r--r--. 1 root root     0 May 12 04:36 2.txt
39 -rw-r--r--. 1 root root     0 May 12 04:36 3.txt
40 -rw-r--r--. 1 root root     0 May 12 04:36 4.txt
41 -rw-r--r--. 1 root root     0 May 12 04:36 5.txt
42 drwx------. 2 root root 16384 May 12 04:31 lost+found
43 [root@yinzhengjie yinzhengjie]# cd  #回到本身的家目錄去
44 [root@yinzhengjie ~]# umount /yinzhengjie/  #卸載掛載點
45 [root@yinzhengjie ~]# mount  #再一次查看掛載信息,發現以前的掛載點不見了。
46 /dev/sda2 on / type ext4 (rw)
47 proc on /proc type proc (rw)
48 sysfs on /sys type sysfs (rw)
49 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
50 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
51 /dev/sda1 on /boot type ext4 (rw)
52 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
53 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
54 [root@yinzhengjie ~]# 
55 [root@yinzhengjie ~]# ll /yinzhengjie/  #發現這個目錄的文件也沒有了,緣由是卸載成功了,數據還存在那塊設備上。
56 total 0
57 [root@yinzhengjie ~]# 
58 '''
mount的基本使用展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# ll /yinzhengjie/  #查看目錄爲空。
 9 total 0
10 [root@yinzhengjie ~]# mount  #先查看掛載以前的信息
11 /dev/sda2 on / type ext4 (rw)
12 proc on /proc type proc (rw)
13 sysfs on /sys type sysfs (rw)
14 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
15 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
16 /dev/sda1 on /boot type ext4 (rw)
17 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
18 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
19 [root@yinzhengjie ~]#
20 [root@yinzhengjie ~]# tune2fs -L yinzhengjie /dev/sdb1  #給這個分區設置一個卷標名稱。
21 tune2fs 1.41.12 (17-May-2010)
22 [root@yinzhengjie ~]# e2label /dev/sdb1 #查看這個卷標名稱
23 yinzhengjie
24 [root@yinzhengjie ~]#
25 [root@yinzhengjie ~]# mount LABEL="yinzhengjie"  /yinzhengjie/  #把卷標名稱爲"yinzhengjie" 的設備掛載到「/yinzhengjie/」這個目錄下來。
26 [root@yinzhengjie ~]# mount  #查看掛載後的信息
27 /dev/sda2 on / type ext4 (rw)
28 proc on /proc type proc (rw)
29 sysfs on /sys type sysfs (rw)
30 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
31 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
32 /dev/sda1 on /boot type ext4 (rw)
33 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
34 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
35 /dev/sdb1 on /yinzhengjie type ext4 (rw)  #這裏有記錄,說明掛載成功了。
36 [root@yinzhengjie ~]# ll /yinzhengjie/  #看一下掛載目錄,果然是訪問到了數據
37 total 16
38 -rw-r--r--. 1 root root     0 May 12 04:36 1.txt
39 -rw-r--r--. 1 root root     0 May 12 04:36 2.txt
40 -rw-r--r--. 1 root root     0 May 12 04:36 3.txt
41 -rw-r--r--. 1 root root     0 May 12 04:36 4.txt
42 -rw-r--r--. 1 root root     0 May 12 04:36 5.txt
43 drwx------. 2 root root 16384 May 12 04:31 lost+found
44 [root@yinzhengjie ~]#
45 '''
mount命令基於卷標掛載用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# ll /yinzhengjie/
 9 total 0
10 [root@yinzhengjie ~]#
11 [root@yinzhengjie ~]# mount  #查看掛載信息
12 /dev/sda2 on / type ext4 (rw)
13 proc on /proc type proc (rw)
14 sysfs on /sys type sysfs (rw)
15 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
16 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
17 /dev/sda1 on /boot type ext4 (rw)
18 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
19 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
20 [root@yinzhengjie ~]#
21 [root@yinzhengjie ~]# blkid /dev/sdb1  #先查看設備的UUID信息
22 /dev/sdb1: LABEL="yinzhengjie" UUID="768fe361-9425-4928-b2d9-641064d1052a" TYPE="ext4"
23 [root@yinzhengjie ~]# mount UUID="768fe361-9425-4928-b2d9-641064d1052a" /yinzhengjie/  #將上面查閱到的UUID=
24 "768fe361-9425-4928-b2d9-641064d1052a"賦值下來,它就是「/dev/sdb1」這塊設備,咱們將它掛載到"/yinzhengjie"目錄下。
25 [root@yinzhengjie ~]#
26 [root@yinzhengjie ~]# mount  #查看掛載信息
27 /dev/sda2 on / type ext4 (rw)
28 proc on /proc type proc (rw)
29 sysfs on /sys type sysfs (rw)
30 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
31 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
32 /dev/sda1 on /boot type ext4 (rw)
33 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
34 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
35 /dev/sdb1 on /yinzhengjie type ext4 (rw)
36 [root@yinzhengjie ~]# ll /yinzhengjie/  #發現可以成功範圍數據。
37 total 16
38 -rw-r--r--. 1 root root     0 May 12 04:36 1.txt
39 -rw-r--r--. 1 root root     0 May 12 04:36 2.txt
40 -rw-r--r--. 1 root root     0 May 12 04:36 3.txt
41 -rw-r--r--. 1 root root     0 May 12 04:36 4.txt
42 -rw-r--r--. 1 root root     0 May 12 04:36 5.txt
43 drwx------. 2 root root 16384 May 12 04:31 lost+found
44 [root@yinzhengjie ~]#
45 '''
mount命令基於UUID進行掛載用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mount  #查看掛載信息
 9 /dev/sda2 on / type ext4 (rw)
10 proc on /proc type proc (rw)
11 sysfs on /sys type sysfs (rw)
12 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
13 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
14 /dev/sda1 on /boot type ext4 (rw)
15 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
16 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
17 /dev/sdb1 on /yinzhengjie type ext4 (rw)  #發現這個設備的掛載的權限是"讀寫(rw)"模式
18 [root@yinzhengjie ~]#
19 [root@yinzhengjie ~]# mount -o remount,ro /dev/sdb1  #咱們對其進行從新掛載,並將掛載後權限設置爲只讀模式。
20 [root@yinzhengjie ~]# mount
21 /dev/sda2 on / type ext4 (rw)
22 proc on /proc type proc (rw)
23 sysfs on /sys type sysfs (rw)
24 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
25 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
26 /dev/sda1 on /boot type ext4 (rw)
27 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
28 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
29 /dev/sdb1 on /yinzhengjie type ext4 (ro) #過着,權限變成了只讀(ro)了。
30 [root@yinzhengjie ~]#
31 
32 '''
mount命令的remount從新掛載用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mount
 9 /dev/sda2 on / type ext4 (rw)
10 proc on /proc type proc (rw)
11 sysfs on /sys type sysfs (rw)
12 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
13 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
14 /dev/sda1 on /boot type ext4 (rw)
15 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
16 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
17 /dev/sdb1 on /yinzhengjie type ext4 (ro) #權限是隻讀
18 [root@yinzhengjie ~]# mount -o remount,rw,acl /dev/sdb1 #啓用文件訪問控制列表功能(acl)
19 [root@yinzhengjie ~]# mount
20 /dev/sda2 on / type ext4 (rw)
21 proc on /proc type proc (rw)
22 sysfs on /sys type sysfs (rw)
23 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
24 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
25 /dev/sda1 on /boot type ext4 (rw)
26 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
27 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
28 /dev/sdb1 on /yinzhengjie type ext4 (rw,acl) #發現真的有acl和rw權限了。
29 [root@yinzhengjie ~]#
30 
31 '''
mount命令啓動acl功能用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# tune2fs -o acl /dev/sdb1  #給該分區添加ACL熟悉,讓其掛載的時候默認就支持ACL
 9 tune2fs 1.41.12 (17-May-2010)
10 [root@yinzhengjie ~]# tune2fs -l /dev/sdb1 | grep ^D  #查看該分區信息
11 Default mount options:    acl  #咱們發現是啓用了acl功能的,在mount的選項的時候它會自動支持該參數。
12 Desired extra isize:      28
13 Default directory hash:   half_md4
14 Directory Hash Seed:      63cd7ef0-15f3-4e20-978a-82472a392459
15 [root@yinzhengjie ~]#
16 [root@yinzhengjie ~]# mount /dev/sdb1 /yinzhengjie/
17 [root@yinzhengjie ~]# mount
18 /dev/sda2 on / type ext4 (rw)
19 proc on /proc type proc (rw)
20 sysfs on /sys type sysfs (rw)
21 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
22 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
23 /dev/sda1 on /boot type ext4 (rw)
24 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
25 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
26 /dev/sdb1 on /yinzhengjie type ext4 (rw)  #注意這裏儘管沒有acl顯示,可是它仍是有acl屬性的,由於那個分區自己就支持acl,是我們給配置的。
27 [root@yinzhengjie ~]#
28     若是你想取消mount這個參數咋辦呢?很簡單,只要加一個「^」這個符號就好使了,以下:
29 [root@yinzhengjie ~]# tune2fs -o ^acl /dev/sdb1
30 tune2fs 1.41.12 (17-May-2010)
31 [root@yinzhengjie ~]# tune2fs -l /dev/sdb1 | grep ^D
32 Default mount options:    (none)  #發現該屬性的確是沒有啦!爲空!
33 Desired extra isize:      28
34 Default directory hash:   half_md4
35 Directory Hash Seed:      63cd7ef0-15f3-4e20-978a-82472a392459
36 [root@yinzhengjie ~]#
37 '''
利用tune2fs給mount添加默認acl功能用法展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# mkdir -p /media/yinzhengjie/cdrom  #建立掛載點
 9 [root@yinzhengjie ~]# ls -l /dev/cdrom  #查看媒體文件所對應的連接
10 lrwxrwxrwx. 1 root root 3 May 12 02:38 /dev/cdrom -> sr0
11 [root@yinzhengjie ~]# ls -l /dev/sr0
12 brw-rw----+ 1 root cdrom 11, 0 May 12 02:38 /dev/sr0
13 [root@yinzhengjie ~]# ls -l /dev/dvd
14 lrwxrwxrwx. 1 root root 3 May 12 02:38 /dev/dvd -> sr0
15 [root@yinzhengjie ~]#
16 [root@yinzhengjie ~]# mount -o ro /dev/cdrom /media/yinzhengjie/cdrom/  #以只讀(ro)的方式掛載,等價於:mount -r /dev/cdrom /media/yinzhengjie/cdrom/
17 [root@yinzhengjie ~]# mount
18 /dev/sda2 on / type ext4 (rw)
19 proc on /proc type proc (rw)
20 sysfs on /sys type sysfs (rw)
21 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
22 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
23 /dev/sda1 on /boot type ext4 (rw)
24 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
25 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
26 /dev/sdb1 on /yinzhengjie type ext4 (rw)
27 /dev/sr0 on /media/yinzhengjie/cdrom type iso9660 (ro)
28 [root@yinzhengjie ~]# ll /media/yinzhengjie/cdrom/
29 total 712
30 -r--r--r--. 2 root root     14 Oct 24  2014 CentOS_BuildTag
31 dr-xr-xr-x. 3 root root   2048 Oct 24  2014 EFI
32 -r--r--r--. 2 root root    212 Nov 27  2013 EULA
33 -r--r--r--. 2 root root  18009 Nov 27  2013 GPL
34 dr-xr-xr-x. 3 root root   2048 Oct 24  2014 images
35 dr-xr-xr-x. 2 root root   2048 Oct 24  2014 isolinux
36 dr-xr-xr-x. 2 root root 686080 Oct 24  2014 Packages
37 -r--r--r--. 2 root root   1354 Oct 19  2014 RELEASE-NOTES-en-US.html
38 dr-xr-xr-x. 2 root root   4096 Oct 24  2014 repodata
39 -r--r--r--. 2 root root   1706 Nov 27  2013 RPM-GPG-KEY-CentOS-6
40 -r--r--r--. 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Debug-6
41 -r--r--r--. 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Security-6
42 -r--r--r--. 2 root root   1734 Nov 27  2013 RPM-GPG-KEY-CentOS-Testing-6
43 -r--r--r--. 1 root root   3380 Oct 24  2014 TRANS.TBL
44 [root@yinzhengjie ~]#
45 '''
mount命令用只讀的方式掛載光盤
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 [root@yinzhengjie ~]# umount /dev/sr0  #卸載給設備報錯了
 9 umount: /media/yinzhengjie/cdrom: device is busy.
10         (In some cases useful info about processes that use
11          the device is found by lsof(8) or fuser(1))  #說是用lsof和fuser命令能夠找到這個設備被誰使用
12 [root@yinzhengjie ~]#
13 [root@yinzhengjie ~]# fuser /media/yinzhengjie/cdrom/ #看一下是哪一個進程再訪問這個設備
14 /media/yinzhengjie/cdrom/:  2420c
15 [root@yinzhengjie ~]#
16 [root@yinzhengjie ~]# fuser -v /media/yinzhengjie/cdrom/  #查看詳細信息,究竟是哪一個用戶和對應的進程在訪問該設備。
17                      USER        PID ACCESS COMMAND
18 /media/yinzhengjie/cdrom/:
19                      root       2420 ..c.. bash
20 [root@yinzhengjie ~]# who  #實際上是我本身開了2個設備在測試呢!
21 root     pts/0        2017-05-12 03:08 (172.16.3.210)
22 root     pts/1        2017-05-12 05:42 (172.16.3.210)
23 [root@yinzhengjie ~]#
24 [root@yinzhengjie ~]# fuser -km /media/yinzhengjie/cdrom/  #將正在訪問的該設備的用戶踢出去。
25 /media/yinzhengjie/cdrom/:  2420c
26 [root@yinzhengjie ~]# who  #執行了上個命令,哪一個用戶就被提出終端了!
27 root     pts/1        2017-05-12 05:42 (172.16.3.210)
28 [root@yinzhengjie ~]# 
29 [root@yinzhengjie ~]# umount /dev/sr0  #再一次執行卸載,發現沒有報錯
30 [root@yinzhengjie ~]# mount   #也成功卸載掉了
31 /dev/sda2 on / type ext4 (rw)
32 proc on /proc type proc (rw)
33 sysfs on /sys type sysfs (rw)
34 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
35 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
36 /dev/sda1 on /boot type ext4 (rw)
37 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
38 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
39 [root@yinzhengjie ~]#
40 '''
umount卸載報錯解決方案展現
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8     其實mount命令是經過「/proc/mounts[也是和內核相關的文件喲]」這個文件獲取到當前系統上正在掛載的相關信息,只不過mount用了比較讓咱們易
 9 讀的方式輸出出來而已。
10 [root@yinzhengjie ~]# cat /proc/mounts
11 rootfs / rootfs rw 0 0
12 proc /proc proc rw,relatime 0 0
13 sysfs /sys sysfs rw,seclabel,relatime 0 0
14 devtmpfs /dev devtmpfs rw,seclabel,relatime,size=490820k,nr_inodes=122705,mode=755 0 0
15 devpts /dev/pts devpts rw,seclabel,relatime,gid=5,mode=620,ptmxmode=000 0 0
16 tmpfs /dev/shm tmpfs rw,seclabel,relatime 0 0
17 /dev/sda2 / ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
18 none /selinux selinuxfs rw,relatime 0 0
19 devtmpfs /dev devtmpfs rw,seclabel,relatime,size=490820k,nr_inodes=122705,mode=755 0 0
20 /proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
21 /dev/sda1 /boot ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
22 none /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
23 vmware-vmblock /var/run/vmblock-fuse fuse.vmware-vmblock rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other 0 0
24 /dev/sdb1 /yinzhengjie ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0
25 [root@yinzhengjie ~]#
26     咱們知道mount命令可讓咱們用來掛載以及查看相關相信,可是最終的數據存放在哪裏呢?固然是要有一個配置文件了,其中「/etc/mtab 」就是一個用來存放
27 掛載信息的。
28 [root@yinzhengjie ~]# cat /etc/mtab
29 /dev/sda2 / ext4 rw 0 0
30 proc /proc proc rw 0 0
31 sysfs /sys sysfs rw 0 0
32 devpts /dev/pts devpts rw,gid=5,mode=620 0 0
33 tmpfs /dev/shm tmpfs rw,rootcontext="system_u:object_r:tmpfs_t:s0" 0 0
34 /dev/sda1 /boot ext4 rw 0 0
35 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
36 vmware-vmblock /var/run/vmblock-fuse fuse.vmware-vmblock rw,nosuid,nodev,default_permissions,allow_other 0 0
37 /dev/sdb1 /yinzhengjie ext4 rw 0 0
38 [root@yinzhengjie ~]#
39     讓咱們來作個測試,咱們卸載一個掛載點,看這個配置文件是否也發生變化。
40 [root@yinzhengjie ~]# umount /dev/sdb1  #咱們卸載以前手動掛載的分區
41 [root@yinzhengjie ~]# cat /etc/mtab  #再次查看該配置文件,果不其然,隨着mount命令將掛載信息刪除了。
42 /dev/sda2 / ext4 rw 0 0
43 proc /proc proc rw 0 0
44 sysfs /sys sysfs rw 0 0
45 devpts /dev/pts devpts rw,gid=5,mode=620 0 0
46 tmpfs /dev/shm tmpfs rw,rootcontext="system_u:object_r:tmpfs_t:s0" 0 0
47 /dev/sda1 /boot ext4 rw 0 0
48 none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
49 vmware-vmblock /var/run/vmblock-fuse fuse.vmware-vmblock rw,nosuid,nodev,default_permissions,allow_other 0 0
50 [root@yinzhengjie ~]# 
51 '''
擴展:mount的前世此生

 

14.查看磁盤信息命令windows

a>.df 磁盤空間使用狀態報告bash

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# df #默認是以KB爲單位的
 8 Filesystem     1K-blocks    Used Available Use% Mounted on
 9 /dev/sda2       18208184 2504904  14771696  15% /
10 tmpfs             502172      72    502100   1% /dev/shm
11 /dev/sda1         289293   28473    245460  11% /boot
12 [root@yinzhengjie ~]# df -m  #以MB爲空間
13 Filesystem     1M-blocks  Used Available Use% Mounted on
14 /dev/sda2          17782  2447     14426  15% /
15 tmpfs                491     1       491   1% /dev/shm
16 /dev/sda1            283    28       240  11% /boot
17 [root@yinzhengjie ~]# df -h  #將文件大小顯示易讀格式
18 Filesystem      Size  Used Avail Use% Mounted on
19 /dev/sda2        18G  2.4G   15G  15% /
20 tmpfs           491M   72K  491M   1% /dev/shm
21 /dev/sda1       283M   28M  240M  11% /boot
22 [root@yinzhengjie ~]# df -i  #顯示inode數量
23 Filesystem      Inodes IUsed   IFree IUse% Mounted on
24 /dev/sda2      1164592 98347 1066245    9% /
25 tmpfs           125543     3  125540    1% /dev/shm
26 /dev/sda1        76912    38   76874    1% /boot
27 [root@yinzhengjie ~]# df -ih #划算成一度單位,注意下面的M或者K表示的不是文件的大小,而是表示的數字K=1000,M=1000000
28 Filesystem     Inodes IUsed IFree IUse% Mounted on
29 /dev/sda2        1.2M   97K  1.1M    9% /
30 tmpfs            123K     3  123K    1% /dev/shm
31 /dev/sda1         76K    38   76K    1% /boot
32 [root@yinzhengjie ~]# df -P  #所有顯示,就是當Filesystem名稱過長的時候,不會換行顯示。
33 Filesystem     1024-blocks    Used Available Capacity Mounted on
34 /dev/sda2         18208184 2504908  14771692      15% /
35 tmpfs               502172      72    502100       1% /dev/shm
36 /dev/sda1           289293   28473    245460      11% /boot
37 [root@yinzhengjie ~]# df -Ph #將文件大小顯示易讀格式且每行信息不換行顯示。
38 Filesystem      Size  Used Avail Use% Mounted on
39 /dev/sda2        18G  2.4G   15G  15% /
40 tmpfs           491M   72K  491M   1% /dev/shm
41 /dev/sda1       283M   28M  240M  11% /boot
42 [root@yinzhengjie ~]# df -Ph /dev/sda1  #能夠單獨查看一個分區狀況。
43 Filesystem      Size  Used Avail Use% Mounted on
44 /dev/sda1       283M   28M  240M  11% /boot
45 [root@yinzhengjie ~]#
46 [root@yinzhengjie ~]# df -T     #顯示時顯示文件類型
47 Filesystem     Type  1K-blocks    Used Available Use% Mounted on
48 /dev/sda2      ext4   18208184 2504920  14771680  15% /
49 tmpfs          tmpfs    502172      72    502100   1% /dev/shm
50 /dev/sda1      ext4     289293   28473    245460  11% /boot
51 [root@yinzhengjie ~]#
52 '''

b>.du 顯示文件佔用磁盤的狀況網絡

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# ls -ldh /etc/  #查看目錄大小,很明顯不許確!
 8 drwxr-xr-x. 102 root root 4.0K May 12 05:48 /etc/
 9 [root@yinzhengjie ~]# du -s /etc/  #用du查看文件大小,默認爲K.
10 39788   /etc/
11 [root@yinzhengjie ~]# du -sh /etc/  #用du查看目錄大小,默認爲M
12 39M     /etc/
13 [root@yinzhengjie ~]# du -sh /etc/sysconfig/network-scripts/ifcfg-eth0  #咱們也能夠查看文件的大小 
14 4.0K    /etc/sysconfig/network-scripts/ifcfg-eth0
15 [root@yinzhengjie ~]# 
16 
17 '''

 

15.開機自動掛載app

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 開機自動掛載
 8    /etc/rc.d/rc.sysinit:系統初始化腳本
 9       其中一個功能:掛載/etc/fstab文件中定義的文件系統掛載點
10 [root@yinzhengjie ~]# cat  /etc/fstab
11 
12 #
13 # /etc/fstab
14 # Created by anaconda on Tue Apr 11 05:43:15 2017
15 #
16 # Accessible filesystems, by reference, are maintained under '/dev/disk'
17 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
18 #
19 UUID=421dd611-48a1-4a71-9f06-60605f68ef0d /                       ext4    defaults        1 1
20 UUID=003bdf87-a068-4553-b506-f174b1f82ed6 /boot                   ext4    defaults        1 2
21 UUID=1020e7eb-2f17-4a4d-b8bf-36776dcbf547 swap                    swap    defaults        0 0
22 tmpfs                   /dev/shm                tmpfs   defaults        0 0
23 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
24 sysfs                   /sys                    sysfs   defaults        0 0
25 proc                    /proc                   proc    defaults        0 0
26 [root@yinzhengjie ~]#
27 咱們看如下掛載的格式,從左往右一次又6列參數,那麼這6列參數是啥意思呢?請看如下分析:
28 1>.要掛載的設備:設備文件、LABEL=」ladel」 UUID
29 2>.掛載點:有的文件系統沒有掛載點  swap沒有掛載點,掛載點爲swap
30 3>.文件系統類型:
31 4>.掛載選項:多個選項間使用逗號分隔
32 5>.轉儲頻率:
33     0:從不備份
34     1:每日備份
35     2:每隔一天備份
36 6>.自檢次序
37     1:首先自檢,一般只能被/使用
38     2-9:順序
39     0:從不自檢
40 '''
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# vim + /etc/fstab  #編輯mount配置文件,並將光標移動在最後一行,「+」參數表示最後一行
 8 [root@yinzhengjie ~]# cat /etc/fstab  #在最後一行添加你須要開機掛載的設備和目錄。
 9 
10 #
11 # /etc/fstab
12 # Created by anaconda on Tue Apr 11 05:43:15 2017
13 #
14 # Accessible filesystems, by reference, are maintained under '/dev/disk'
15 # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
16 #
17 UUID=421dd611-48a1-4a71-9f06-60605f68ef0d /                       ext4    defaults        1 1
18 UUID=003bdf87-a068-4553-b506-f174b1f82ed6 /boot                   ext4    defaults        1 2
19 UUID=1020e7eb-2f17-4a4d-b8bf-36776dcbf547 swap                    swap    defaults        0 0
20 tmpfs                   /dev/shm                tmpfs   defaults        0 0
21 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
22 sysfs                   /sys                    sysfs   defaults        0 0
23 proc                    /proc                   proc    defaults        0 0
24 /dev/sdb1               /yinzhengjie            ext4    defaults,acl    0 0  #這就是咱們新加的一行。
25 [root@yinzhengjie ~]# mount     #查看當前掛載項。
26 /dev/sda2 on / type ext4 (rw)
27 proc on /proc type proc (rw)
28 sysfs on /sys type sysfs (rw)
29 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
30 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
31 /dev/sda1 on /boot type ext4 (rw)
32 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
33 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
34 [root@yinzhengjie ~]# mount -a  #從新加載「 /etc/fstab」把fstab裏面沒有掛載的信息進行掛載,其功效等同於重作操做系統時進行的自動掛載。或者執行「init 6」再查看配置文件是否生效。
35 [root@yinzhengjie ~]# mount  #再次查看當前掛載項。
36 /dev/sda2 on / type ext4 (rw)
37 proc on /proc type proc (rw)
38 sysfs on /sys type sysfs (rw)
39 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
40 tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
41 /dev/sda1 on /boot type ext4 (rw)
42 none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
43 vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)
44 /dev/sdb1 on /yinzhengjie type ext4 (rw,acl)  #發現最後一行多出了一行掛載信息。說明你操做成功了。
45 [root@yinzhengjie ~]#
46 
47 '''
修改 /etc/fstab配置文件進行開機自動掛載展現

 

16.查看內存空間使用狀態

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# cat /proc/meminfo  #查看內存信息
 8 MemTotal:        1004348 kB
 9 MemFree:          671056 kB
10 Buffers:           18764 kB
11 Cached:           126240 kB
12 SwapCached:            0 kB
13 Active:           108700 kB
14 Inactive:         110672 kB
15 Active(anon):      74616 kB
16 Inactive(anon):     1184 kB
17 Active(file):      34084 kB
18 Inactive(file):   109488 kB
19 Unevictable:           0 kB
20 Mlocked:               0 kB
21 SwapTotal:       4136088 kB
22 SwapFree:        4136088 kB
23 Dirty:               164 kB
24 Writeback:             0 kB
25 AnonPages:         74376 kB
26 Mapped:            42396 kB
27 Shmem:              1440 kB
28 Slab:              75132 kB
29 SReclaimable:      15608 kB
30 SUnreclaim:        59524 kB
31 KernelStack:        1560 kB
32 PageTables:        10916 kB
33 NFS_Unstable:          0 kB
34 Bounce:                0 kB
35 WritebackTmp:          0 kB
36 CommitLimit:     4638260 kB
37 Committed_AS:     336672 kB
38 VmallocTotal:   34359738367 kB
39 VmallocUsed:      156112 kB
40 VmallocChunk:   34359567284 kB
41 HardwareCorrupted:     0 kB
42 AnonHugePages:     12288 kB
43 HugePages_Total:       0
44 HugePages_Free:        0
45 HugePages_Rsvd:        0
46 HugePages_Surp:        0
47 Hugepagesize:       2048 kB
48 DirectMap4k:        6144 kB
49 DirectMap2M:     1042432 kB
50 DirectMap1G:           0 kB
51 [root@yinzhengjie ~]# free -m  #其實free命令的數據時取自「/proc/meminfo」文件的,知識爲了易讀性能夠用free -m參數查看內存使用狀況
52              total       used       free     shared    buffers     cached
53 Mem:           980        325        655          1         18        123
54 -/+ buffers/cache:        183        797 #這一行纔是正點,其餘的都是虛的,實際使用內存爲183,實際空餘內存爲797
55 Swap:         4039          0       4039
56 [root@yinzhengjie ~]# free -g  #這個參數是以GB爲單位,列出磁盤中內存信息,空餘查看內存比較大的時候用,若是你的內存不深就不多的話就會跟我同樣出現下面的尷尬參數了。
57              total       used       free     shared    buffers     cached
58 Mem:             0          0          0          0          0          0
59 -/+ buffers/cache:          0          0
60 Swap:            3          0          3
61 [root@yinzhengjie ~]# 
62 
63 '''

 

17.dd命令經常使用參數展現:

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 dd命令:
 9    bs:一次讀多大的數據量
10    count:讀取次數
11    if:輸入文件
12    of:輸出文件
13    dd if=input_file of=output_file
14    dd if=input_file of=output_file bs=#[b|k|m|g] count=#
15    cat /dev/cdrom > /tmp/linux.iso #製做光盤
16 /dev/zero:吐01的
17 '''
 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# cat /etc/issue
 8 CentOS release 6.6 (Final)
 9 Kernel \r on an \m
10 
11 
12         This is Yin Zhengjie's server
13 
14 
15 
16 
17 
18 [root@yinzhengjie ~]# 
19 [root@yinzhengjie ~]# dd if=/etc/issue of=/tmp/issue.dd
20 0+1 records in #讀了多少個
21 0+1 records out #輸出了多少個
22 84 bytes (84 B) copied, 0.00011992 s, 700 kB/s  #多少字節被複制,一共花了多長時間,每秒鐘傳輸數據的平局速度。
23 [root@yinzhengjie ~]# cat /tmp/issue.dd  #查看內容的確被複制
24 CentOS release 6.6 (Final)
25 Kernel \r on an \m
26 
27 
28         This is Yin Zhengjie's server
29 
30 
31 
32 
33 
34 [root@yinzhengjie ~]#
35 
36 
37 '''
利用dd拷貝文件效率要高與cp命令

  其實dd相比cp是一個更低級的命令,跟語言同樣,語言越高級越接近用戶,處理速度就越慢,語言越低級就越接近機器,處理速度就越快,那麼爲何dd命令處理速度要相比cp更快呢?其實很簡單,cp命令才拷貝文件的時候,先經過VFS系統(即虛擬文件系統)將源數據統統的讀取出來,而後在將這些數據傳給VFS,並經過文件系統在從新生成一份如出一轍的數據才完成了拷貝功能,可是dd命令就不同了,他繞過了VFS系統,直接找到源數據的inode所對應的blocks,直接將這些blocks內存中拷貝一份,這就是二者的差距。

                 

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 '''
 7 [root@yinzhengjie ~]# dd if=/dev/zero of=/yinzhengjie.swapfile bs=1M count=100  #建立一個100M的文件
 8 100+0 records in
 9 100+0 records out
10 104857600 bytes (105 MB) copied, 0.145994 s, 718 MB/s
11 [root@yinzhengjie ~]#
12 [root@yinzhengjie ~]# ll -h / | grep yinzhengjie  #驗證文件是否建立成功
13 drwxr-xr-x.   3 root root 4.0K May 12 04:36 yinzhengjie
14 -rw-r--r--.   1 root root 100M May 12 10:46 yinzhengjie.swapfile  #發現有這個100M的文件
15 [root@yinzhengjie ~]#
16 [root@yinzhengjie ~]# mkswap -f /yinzhengjie.swapfile #強制將這個文件格式化成交換分區
17 Setting up swapspace version 1, size = 102396 KiB
18 no label, UUID=f5896342-dd1f-4980-8806-2086ae3fec90
19 [root@yinzhengjie ~]# free -m  #先查看內存信息
20              total       used       free     shared    buffers     cached
21 Mem:           980        890         90          1        451        227
22 -/+ buffers/cache:        212        768
23 Swap:         4039          0       4039 #咱們發現如今的total=4039
24 [root@yinzhengjie ~]# swapon /yinzhengjie.swapfile #開啓這個文件的交換分區
25 [root@yinzhengjie ~]# free -m #發現果真多了100M的swap分區
26              total       used       free     shared    buffers     cached
27 Mem:           980        890         90          1        451        227
28 -/+ buffers/cache:        212        768
29 Swap:         4139          0       4139  #咱們發現如今的total=4139
30 [root@yinzhengjie ~]# 
31 '''
利用dd命令建立一個swap分區文件,可是不到玩不得不要用!

如下是dd生產環節中經常使用的幾個案例:

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 '''
 8 linux製做光盤的2種方式:
 9 [root@yinzhengjie ~]# dd if=/dev/cdrom of=/yinzhengjie/linux.iso                #利用dd命令製做光盤,方法一
10 [root@yinzhengjie ~]# cat /dev/cdrom > /yinzhengjie/linux.iso                   #利用cat命令製做光盤,方法二
11 linux中的磁盤對拷貝:
12 [root@yinzhengjie ~]# dd if=/dev/sda of=/dev/sdb                                #即將/dev/sda設備的信息拷貝一份到/dev/sdb上去。
13 [root@yinzhengjie ~]# dd if=/dev/sda of=/tmp/myfile bs=512 count=1              #講/dev/sda的MBR分區進行備份,當分區表破壞時,能夠用/tmp/myfile進行還原。
14 [root@yinzhengjie ~]# dd if=/dev/zero of=/dev/sdb bs=512 count=1                #刪除/dev/sdb的分區信息,固然裏面的數據仍是能夠找回來的,能夠經過專業的數據恢復工具。
15 [root@yinzhengjie ~]# dd if=/dev/zero of=/yinzhengjie.swapfile bs=1M count=100  #建立一個100M的本地迴環設備,能夠用來作分區格式化的(固然得須要一些額外的操做)
16 '''
17 
18 #這裏只是dd命令的冰山一角,想要了解dd命令更多的用法,請參考man幫助,在哪裏或許你能找到你感興趣的參數。

 

18.巧記歸檔命令

 1 #!/usr/bin/env python
 2 #_*_coding:utf-8_*_
 3 #@author :yinzhengjie
 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/
 5 #EMAIL:y1053419035@qq.com
 6 
 7 
 8 '''
 9 文件連接
10    ln 源文件 目標文件
11     硬連接:
12          不能跨分區,
13      指向同一個indone的兩個位置
14          不能對目錄建立硬連接
15      硬連接會改變文件被連接的次數
16     符號連接:
17         ln -s
18      符號連接能夠跨分區
19      符號連接文件跟源文件不一樣一個inode
20      能夠對目錄建立符號連接
21      符號連接不會改變源文件被連接的次數
22 
23 
24 dev 第一個表示主設備號 第二個表示次設備號
25 
26 壓縮工具
27    zip:
28    gzip:gunzip= gzip -d,zcat
29    後綴:.gz
30    -c 指定要壓縮的文件
31    bzip2,bunzip2
32    -k 保留源文件
33    後綴 .bz
34    xz
35      後綴.xz
36    -#:指定壓縮比 1-9,默認的爲6
37 
38 
39 歸檔工具:
40    tar [options] file.tar file1....
41     -c:建立歸檔
42     -x:展開歸檔
43     -t:不展開而直接查看被歸檔的文件
44     -z:使用gzip壓縮
45     -j:使用bz2壓縮
46     -J:使用xz壓縮
47 
48 
49 '''
相關文章
相關標籤/搜索