1.增加一块硬盘
关机






2.创建分区,格式化分区,挂载分区
查看是否新增
lsblk ll /dev/sdb*

创建分区
[root@zzp ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0xcf8ee6cb 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):m
命令操作
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)
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-41943039,默认为 41943039):+5G
分区 1 已设置为 Linux 类型,大小设为 5 GiB
命令(输入 m 获取帮助):p
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xcf8ee6cb
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
格式化分区
[root@zzp ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
挂载分区
[root@zzp ~]# cd / [root@zzp /]# mkdir /sdb1 [root@zzp /]# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbin sdb1 srv sys tmp usr var [root@zzp /]# mount /dev/sdb1 /sdb1 [root@zzp /]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda3 20G 4.6G 15G 24% / devtmpfs 978M 0 978M 0% /dev tmpfs 993M 0 993M 0% /dev/shm tmpfs 993M 8.9M 984M 1% /run tmpfs 993M 0 993M 0% /sys/fs/cgroup /dev/sda1 497M 151M 346M 31% /boot tmpfs 199M 20K 199M 1% /run/user/0 /dev/sr0 4.3G 4.3G 0 100% /run/media/root/CentOS 7 x86_64 /dev/sdb1 5.0G 33M 5.0G 1% /sdb1

3087

被折叠的 条评论
为什么被折叠?



