-
I/O ports(I/O設備地址):這些其實都是文件(Linux的思想就是一切皆文件),因此可以用open(),write(),read(),close()來進行操作
塊設備:block,存取單位是‘塊’,如:磁盤
字符設備:char,存取單位是‘字符’,如:鍵盤設備文件:關聯至一個設備驅動程序,進而能夠跟與之對應的硬件設備進行通信 設備號碼: 主設備號(major number),標識設備類型 次設備號(minor number),標識同一個類型下的不同設備
-
/dev/DEV_FILE:磁盤設備文件命名
CentOS5之前:
IDE:/dev/hd
SCSI,SATA,SAS,USB: /dev/sd
CentOS6,7 統一命名爲:/dev/sd不同設備:a-z 如:/dev/sda, /dev/sdb 同一設備上不同分區:1,2,3... 如:/dev/sda1, /dev/sda2
-
磁盤分區表格式
MBR(Master Boot Record)與GPT(GUID partition Table)
MBR:在0磁道0扇區:有512bytes
boot loader:446bytes
分區表:64bytes
結束標誌:2bytes
用MBR的話,最多有4個分區:3個主分區+1邏輯分區(邏輯分區可以有N個) - 分區工具
有fdisk,parted,sfdisk
1)
(1)fdisk:對於一塊硬盤來講,最多隻能管理15個分區
語法:fdisk -l [-u] [device...]
內建子命令:
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
*d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
*l list known partition types
m print this menu
*n add a new partition
o create a new empty DOS partition table
*p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
*t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
(2) parted命令:磁盤分區和分區大小調整工具,與fdisk不同,它支持調整分區大小
parted [options] [device [command [options...]...]]
-h:顯示幫助信息
-s:腳本模式,不提示用戶
-v:顯示版本號
2)查看內核是否已經識別新的分區:cat /proc/partions
3)通知內核重新讀取硬盤分區表:
(1)partx -a /dev/DEVICE
-n [M]:[N]
(2) kpartx -a /dev/DEVICE
-f(force)