300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > linux格式化不了分区 Linux 格式化硬盘 分区

linux格式化不了分区 Linux 格式化硬盘 分区

时间:2023-10-30 12:36:00

相关推荐

linux格式化不了分区 Linux 格式化硬盘 分区

查看当前硬盘

fdisk -l

格式化硬盘

mkfs -t ext4 /dev/sdb

分区

fdisk /dev/sdb

然后按提示输入

root@test:/# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.27.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

Partition type

p primary (1 primary, 0 extended, 3 free)

e extended (container for logical partitions)

Select (default p): p

Partition number (2-4, default 2): 2

First sector (651175056-1953525167, default 651175936):

Last sector, +sectors or +size{K,M,G,T,P} (651175936-1953525167, default 1953525167): 1302350111

Created a new partition 2 of type 'Linux' and of size 310.5 GiB.

Command (m for help): wq

The partition table has been altered.

Calling ioctl() to re-read partition table.

如果遇到提示Re-reading the partition table failed.: Device or resource busy

用命令partprobe

初始化分区

mkfs.ext4 /dev/sdb1

挂载到本地

mount /dev/sdb1 /mnt/disk_1

查看磁盘使用情况

df -l

提示partition满了,解决办法

把swapper分区删掉(不是一个好办法,但是能解决问题)

通过fdisk -l查看哪个是swapp

swapoff /dev/sdb*

然后通过fdisk /dev/sdb删掉swapp分区,这样就多了个partition

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。