RHEL7系统硬盘挂载
1、新加硬盘(虚拟机关系状态,新增加硬盘)
2、使用fdisk –l 命令查看新添加的硬盘。
[root@linuxprobe Desktop]# fdisk –l //输入命令
Disk
/dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units =
sectors of 1 * 512 = 512 bytes
Sector
size (logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk label
type: dos
Disk
identifier: 0x0009fcb7
Device Boot
Start
End
Blocks
Id
System
/dev/sda1
*
2048
1026047
512000
83
Linux
//新增加的5G
/dev/sda2
1026048
41943039
20458496
8e Linux
LVM
2、 硬盘分区
[root@linuxprobe
Desktop]# fdisk /dev/sdb
Welcome to fdisk (util-linux
2.23.2).
Changes will remain in memory only, until
you decide to write them.
Be careful before using the write
command.
Device does not contain a recognized
partition table
Building a new DOS disklabel with disk
identifier 0x97d52ea9.
Command (m for help): n
//输入n
Partition type:
p
primary (0 primary, 0 extended, 4 free)
e
extended
Select (default p):
p//输入
P
Partition number (1-4,
default 1): //默认回车
First sector (2048-10485759, default
2048): //直接回车
Using default value 2048
Last sector, +sectors or +size{K,M,G}
(2048-10485759, default 10485759): +2G //输入大小
Partition 1 of type Linux and of size 2
GiB is set
Command (m for help):
P
//再次输入输入
P,查看分区大小
Disk /dev/sdb: 5368 MB, 5368709120 bytes,
10485760 sectors
Units = sectors of 1 * 512 = 512
bytes
Sector size (logical/physical): 512 bytes
/ 512 bytes
I/O size (minimum/optimal): 512 bytes /
512 bytes
Disk label type: dos
Disk identifier: 0x97d52ea9
Device Boot
Start
End
Blocks
Id
System
/dev/sdb1
2048
4196351
2097152
83
Linux
Command (m for help):
W
//切记输入W 保存。
The partition table has been
altered!
Calling ioctl() to re-read partition
table.
Syncing disks.
[root@linuxprobe Desktop]#
3、 查看刚才新建的分区,是否成功。
[root@linuxprobe Desktop]# file /dev/sdb1
/dev/sdb1: block special
4、 分区格式化
[root@linuxprobe
Desktop]# mkfs.xfs /dev/sdb1 //格式为xfs格式
meta-data=/dev/sdb1
isize=256
agcount=4, agsize=131072 blks
=
sectsz=512
attr=2, projid32bit=1
=
crc=0
data
=
bsize=4096
blocks=524288, imaxpct=25
=
sunit=0
swidth=0 blks
naming
=version 2
bsize=4096
ascii-ci=0 ftype=0
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
6、新建目录以及挂载
[root@linuxprobe Desktop]# mkdi
mkdict mkdir
[root@linuxprobe Desktop]# mkdi
mkdict mkdir
[root@linuxprobe Desktop]# mkdir /tmp1
//新建目录
[root@linuxprobe Desktop]# mount /dev/sdb1
/tmp1/
//挂载
[root@linuxprobe Desktop]# df –h //查看
Filesystem
Size Used
Avail Use% Mounted on
/dev/mapper/rhel_linuxprobe-root
18G
8.3G
9.3G 47%
/
devtmpfs
905M
0
905M 0%
/dev
tmpfs
914M
148K
914M 1%
/dev/shm
tmpfs
914M
8.9M
905M 1%
/run
tmpfs
914M
0
914M 0%
/sys/fs/cgroup
/dev/sda1
497M
119M
379M 24%
/boot
/dev/sdb1
2.0G
33M
2.0G 2%
/tmp1
[root@linuxprobe Desktop]#