inode和block特點(diǎn)

inode默認(rèn)內(nèi)存是256個(gè)字節(jié)在文件系統(tǒng)中是唯一的。
一個(gè)文件至少要占用一個(gè)inode及一個(gè)block,多個(gè)文件可以占用同一個(gè)inode(硬鏈接)
block默認(rèn)內(nèi)存是4k:一個(gè)block只能被一個(gè)文件使用,及時(shí)占不滿不會被別的文件占用
查看和管理inode
ls -ih? ? ?df -ih查看磁盤使用情況(一般加上h這樣就成為人類可讀內(nèi)容
[root@shenfan2hao1 ~]# df -hi shen1
Filesystem? ? Inodes IUsed IFree IUse% Mounted on
/dev/sda3? ? ? ? 3.0M? 61K? 2.9M? ? 3% /
[root@shenfan2hao1 ~]# ls -hi shen1
8410570 shen1
查看整體的block 用df -h ; inode df -i
[root@shenfan2hao1 ~]# df -h shen1
Filesystem? ? ? Size? Used Avail Use% Mounted on
/dev/sda3? ? ? 5.8G? 1.7G? 4.2G? 29% /
[root@shenfan2hao1 ~]# df -i shen1
Filesystem? ? ? Inodes IUsed? IFree IUse% Mounted on
/dev/sda3? ? ? 3042816 62084 2980732? ? 3% /
鏈接的概念
在linux中有兩種鏈接,硬鏈接(hard link),軟連接或者符號鏈接(symbolic link or soft link)
可以使用 ln 來創(chuàng)建鏈接文件, ln 創(chuàng)建硬鏈接,ln -s創(chuàng)建軟連接
硬鏈接 (hard link)
定義:通過inode節(jié)索引點(diǎn)來進(jìn)行連接,簡單的說就是一個(gè)文件創(chuàng)造多個(gè)入口

[root@shenfan2hao1 ~]# ln shen1 /tmp/shen1.hard
[root@shenfan2hao1 ~]# ll /tmp
創(chuàng)建一個(gè)硬鏈接目的,是為了保障數(shù)據(jù)安全,做了硬鏈接,幾遍是刪除一個(gè)借口文件,其他照樣可以訪問文件,只要不把最后一個(gè)文件刪除就可以。
硬鏈接只能做文件鏈接,不能對目錄進(jìn)行使用,軟連接可以對目錄進(jìn)行使用
軟連接
ln -s? (原文件) (目標(biāo)文件)
定義:軟連接也叫作符號鏈接,源文件被刪除會失效。
[root@shenfan2hao1 tmp]# touch shen.txt
[root@shenfan2hao1 tmp]# ln -s shen.txt shen.txt.soft
lrwxrwxrwx 1 root root 8 Apr 10 15:35 shen.txt.soft -> shen.txt
創(chuàng)建目錄軟連接
[root@shenfan2hao1 tmp]# mkdir 911
[root@shenfan2hao1 tmp]# ln -s 911 911.soft
[root@shenfan2hao1 tmp]# ll
total 22460
drwxr-xr-x 2 root root? ? ? ? 6 Apr 10 15:38 911
lrwxrwxrwx 1 root root? ? ? ? 3 Apr 10 15:38 911.soft -> 911

顯示,設(shè)置時(shí)間
設(shè)置時(shí)間的主要目的就是為了在備份數(shù)據(jù)的時(shí)候加上時(shí)間,這樣就不會跟之前備份好的數(shù)據(jù)出現(xiàn)沖突覆蓋導(dǎo)致數(shù)據(jù)丟失?。。。?/b>
date 顯示? ? ;? ? set 設(shè)置??
?[root@shenfan2hao1 tmp]# date
Wed Apr 10 15:43:43 CST 2019
date -d? +%Y(年)%m(月)%d(日)%H(小時(shí))%M(分鐘)%S(秒)
date -d +%F = 顯示年-月-日 ; %T = 顯示 時(shí):分:秒 ; %w (周幾)
如何自動同步網(wǎng)絡(luò)時(shí)間 : ntpdate
常用的網(wǎng)絡(luò)時(shí)間服務(wù)器
ntp1.aliyun.com

date -s 自己設(shè)置時(shí)間
seq :豎著顯示
