天天看點

linux的硬碟分區與檔案系統設定

fdisk -l 檢視硬碟狀态

/desk/xdx /dev/ha0 –IDE 舊硬碟

/dev/ hd0 并口硬碟

sda 序列槽硬碟

真實存在的裝置

cat/proc/ 系統系統識别的裝置

fidisk -l 檢視真實存在的裝置

blikid 檢視系統可以用的裝置

df 系統真實使用的裝置

df -H 檢視檔案的大小

df -h 檔案的大小更正确

cd /mnt/

umount /dev/sdc1

umount: /mnt: target is busy.

linux的硬碟分區與檔案系統設定

[[email protected] mnt]# Killed (core dumped)

fuser -vm /dev/sdc1 檢視哪些程序占用裝置

linux的硬碟分區與檔案系統設定

Vim檔案占用裝置

linux的硬碟分區與檔案系統設定

fuser -km /dev/sdc1 強制解除安裝裝置

linux的硬碟分區與檔案系統設定

df

/dev/sdc 挂載去掉

fdisk -l 檢視完整分區的狀态

linux的硬碟分區與檔案系統設定

partprobe手動确認分區表狀态

cat /proc/partitions/ 檢視分區表

不能直接挂需要檔案系統ext4 企業7版本 indow vfat檔案系統

xfs 檔案系統 支援8eb-b的分區 7G每輸速度

格式化等于安裝檔案系統 格式化檔案系統片才能進行挂載

mkts.xfs /dev/vdb*

邏輯分區的拓展分區不用挂載

linux的硬碟分區與檔案系統設定
linux的硬碟分區與檔案系統設定

mkfs.xfs /dev/vdb*

blkid檢視格式化的情況

linux的硬碟分區與檔案系統設定

mount /dev/vdb1 /mnt/

挂載 /dev/vdb1 到/mnt/

df 檢視挂載情況

/dev/vdb1 1020588 32928 987660 4% /mnt

linux的硬碟分區與檔案系統設定
linux的硬碟分區與檔案系統設定

GPT最大支援 264次方的硬碟大小

parted /dev/vdb GPT的分區方式

linux的硬碟分區與檔案系統設定

New disk label type? Gpt

linux的硬碟分區與檔案系統設定

Warning: The existing disk label on /dev/vdb will be destroyed and all data on

this disk will be lost. Do you want to continue?

Yes/No? yes

(parted) quit

Information: You may need to update /etc/fstab.

fdisk /dev/vdb

linux的硬碟分區與檔案系統設定

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Partition number (1-128, default 1): 1

mkfs.xfs /dev/vdb1 -f 強制格式化才能挂載到/mnt/

linux的硬碟分區與檔案系統設定

mount /dev/vdb1 /mnt/ 挂載到/mnt/

df 顯示 挂載裝置

/dev/vdb1 98988 5280 93708 6% /mnt

linux的硬碟分區與檔案系統設定

開機自動挂載

vim /etc/fstab

mount -a

/dev/vdb1 98988 5280 93708 6% /mnt

linux的硬碟分區與檔案系統設定

10行

vim /etc/fstab

/dev/vdb1 /mnt xfs defaults 0 0

linux的硬碟分區與檔案系統設定

還原到msdos檔案系統 所有檔案資料失去

[[email protected] ~]# parted /dev/vdb

(parted) mklabel

New disk label type? msdoc

parted: invalid token: msdoc

New disk label type? msdos

Warning: The existing disk label on /dev/vdb will be destroyed and all data on this

disk will be lost. Do you want to continue?

Yes/No? yes

linux的硬碟分區與檔案系統設定

(parted) quit

GPT檔案系統不能挂載到/mnt 重新挂載/dev/vdb1到/mnt

df顯示挂載資訊 mount /dev/vdb1 /mnt/

df顯示挂載資訊 umount /dev/vdb1 /mnt/

partprobe 同步分區資訊

cat /proc/partitions/ 看分區的資訊

linux的硬碟分區與檔案系統設定

wap 緩沖區

fdisk /dev/vdb

Command (m for help): t

Partition number (1-3, default 3): 3

Hex code (type L to list all codes): l

Hex code (type L to list all codes): 82

Changed type of partition ‘Linux’ to ‘Linux swap / Solaris’

轉換swap檔案系統

p wq

cat /proc/partitions

fdisk -l

開機挂載swap分區

UUID=9bf6b9f7-92ad-441b-848e-0257cbb883d1 / xfs defaults

/dev/vdb1 /mnt xfs defaults 0 0

/dev/vdb3 swap swap defaults 0 0

linux的硬碟分區與檔案系統設定

swapon -s 顯示swap分區的資訊 沒有挂載資訊

linux的硬碟分區與檔案系統設定

mkswap /dev/vdb3 轉換為swap分區的格式

swapon -a /dev/vdb3 挂載/dev/vdb3分區

linux的硬碟分區與檔案系統設定

swapon -s 顯示swap分區的資訊

Cat /proc/partitons/

linux的硬碟分區與檔案系統設定

Fdisk -l 檢視分區資訊

linux的硬碟分區與檔案系統設定

Filename Type Size Used Priority

/dev/vdb3 partition 102396 0 -1

blkid 格式化情況

/dev/vda1: UUID=”9bf6b9f7-92ad-441b-848e-0257cbb883d1” TYPE=”xfs”

/dev/vdb3: UUID=”dfc5b9c7-9f3a-425b-a9ba-ed7fc5344b8d” TYPE=”swap”

/dev/vdb1: UUID=”714525e9-a28f-4464-b7b5-2a0d1cc02791” TYPE=”xfs

linux的硬碟分區與檔案系統設定

swap的分區的縮減 删除

vim /etc/fstab

删除/dev/vdb3 swap swap defaults 0 0

swapoff /dev/vbd3

fdisk /dev/vdb3

linux的硬碟分區與檔案系統設定

partprobe

cat /proc/partitions

linux的硬碟分區與檔案系統設定