When installing a new device after a new hard drive, in order to more fully secure the use of hard disk space must first partition, and then format and finally mount use.
1. Before you turn on a virtual machine, first add the hard disk device, here I added five hard disk (disk 5, three blocks do RAID5,2 do backups)
Click "Add"
Select the hard drive, click "Next"
Select the disk type
Select "Create a new virtual hard disk"
Set disk size
The default disk name like, click "Finish"
Successfully added hard disk appear in the list, here are the steps above have been completed in five hard disk, click "OK" to open the virtual machine to disk partitions
2. Open a terminal
input the command:
View disk partition fdisk -l
3. Create a backup disk
[root@huming-hbza ~]# mdadm -Cv /dev/md0 -n 3 -l 5 -x 2 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf mdadm: layout defaults to left-symmetric mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 512K mdadm: size set to 20954112K mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started. [root@huming-hbza ~]#
4. ext4 file system format
[root@huming-hbza ~]# mkfs.ext4 /dev/md0 mke2fs 1.42.9 (28-Dec-2013) 文件系统标签= OS type: Linux 块大小=4096 (log=2) 分块大小=4096 (log=2) Stride=128 blocks, Stripe width=256 blocks 2621440 inodes, 10477056 blocks 523852 blocks (5.00%) reserved for the super user 第一个数据块=0 Maximum filesystem blocks=2157969408 320 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624 Allocating group tables: 完成 正在写入inode表: 完成 Creating journal (32768 blocks): 完成 Writing superblocks and filesystem accounting information: 完成 [root@huming-hbza ~]#
5.挂载磁盘
[root@huming-hbza ~]# mkdir /home/news
[root@huming-hbza ~]# mount /dev/md0 /home/news/
6.查看磁盘状况
[root@huming-hbza ~]# mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Mon Oct 21 01:45:48 2019 Raid Level : raid5 Array Size : 41908224 (39.97 GiB 42.91 GB) Used Dev Size : 20954112 (19.98 GiB 21.46 GB) Raid Devices : 3 Total Devices : 5 Persistence : Superblock is persistent Update Time : Mon Oct 21 01:54:32 2019 State : clean Active Devices : 3 Working Devices : 5 Failed Devices : 0 Spare Devices : 2 Layout : left-symmetric Chunk Size : 512K Consistency Policy : resync Name : huming-hbza:0 (local to host huming-hbza) UUID : d7544320:d9e3eea0:3fefd0b6:5df6848d Events : 18 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 8 32 1 active sync /dev/sdc 5 8 48 2 active sync /dev/sdd 3 8 64 - spare /dev/sde 4 8 80 - spare /dev/sdf [root@huming-hbza ~]#
可以发现已经挂载好,并且已经将磁盘准备好两个备份盘