1. VMware add hard disk
1. First close the Linux system
2. Edit the virtual machine settings
3. Click Add
4. Select the hard disk-<Enter the corresponding size
2. Partitioning and mounting of the hard disk
Code directly
# 查看当前硬盘情况
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 39G 0 part
├─centos-root 253:0 0 37G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 2G 0 disk
sdc 8:32 0 2G 0 disk
sdd 8:48 0 2G 0 disk
sr0 11:0 1 4.4G 0 rom
#使用fdisk 对我们的sdb进行分区
[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x156bec68 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):1
起始 扇区 (2048-4194303,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{
K,M,G} (2048-4194303,默认为 4194303):+1500M
分区 1 已设置为 Linux 类型,大小设为 1.5 GiB
#写入保存
命令(输入 m 获取帮助):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
# 刷新当前任务
[root@localhost ~]# partprobe /dev/sdb
# 查看创建好的分区
[root@localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 39G 0 part
├─centos-root 253:0 0 37G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 2G 0 disk
└─sdb1 8:17 0 1.5G 0 part
sdc 8:32 0 2G 0 disk
sdd 8:48 0 2G 0 disk
sr0 11:0 1 4.4G 0 rom
[root@localhost ~]# fdisk -l /dev/sdb
磁盘 /dev/sdb:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x156bec68
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 3074047 1536000 83 Linux
[root@localhost ~]#
Set up the file system
make file system extend4
[root@localhost ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
96000 inodes, 384000 blocks
19200 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=394264576
12 block groups
32768 blocks per group, 32768 fragments per group
8000 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (8192 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@localhost ~]#
Mount
mount -t ext4 /dev/sdb1 /mnt/disk1
mount parameter file system to be mounted partition file address to be mounted
[root@localhost ~]# mkdir /mnt/disk1
[root@localhost ~]# mount -t ext4 /dev/sdb1 /mnt/disk1
[root@localhost ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 13M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 37G 5.1G 32G 14% /
/dev/sda1 xfs 1014M 185M 830M 19% /boot
tmpfs tmpfs 378M 12K 378M 1% /run/user/42
tmpfs tmpfs 378M 0 378M 0% /run/user/0
/dev/sdb1 ext4 1.5G 4.5M 1.4G 1% /mnt/disk1
[root@localhost ~]#
note:
/ dev / sdb sdb1 partition to mount our mnt / disk1 following data storage location to mount your hard drive