要對一個u盤進行分區 windows上直接格式化就行了,但是我的u盤 由於之前做成的系統把u盤分成三個分區,windows只能格式化第一個分區其他兩個分區只能看着,理論上windows上也有dd之類的命令只需要先破壞分區,再直接初始化就行了。這里主要簡單說下我在linux上的分區格式化。
1 常用命令 fdisk
首先可以用lsblk查看直接的設備盤 我的是/dev/sdc
fdisk /dev/sdc
m會出幫助
Command (m for help): m Help: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display/entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table
d 刪除其他分區
n 創建分區 如果只創建一個分區一路默認就會只創建一個分區。如需多個分區需要根據提示輸入對應的分區大小及分區類別
t 改變分區文件系統類別 如:fat ntfs ext4等等
w 保存之前所有更改的內容
q 是不保存 直接退出(最后一步后悔葯)否則只能用恢復軟件去恢復了
2、格式化文件系統 mkfs系列 按mkfs tab會自動補全
mkfs mkfifo mkfs mkfs.exfat mkfs.ext4 mkfs.minix mkfs.ubifs mkfontdir mkfs.bfs mkfs.ext2 mkfs.fat mkfs.msdos mkfs.vfat mkfontscale mkfs.cramfs mkfs.ext3 mkfs.jffs2 mkfs.ntfs
ru:mkfs.vfat /dev/sdc1
命令+分區名
就會自動分區格式化成vfat格式
之后可以mount /dev/sdc1 /mnt/ 可以copy對應文件了
umount 卸載設備
umount /mnt