查看当前硬盘
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
网友评论