可以先加几块硬盘,记得先关闭虚拟机再加。这里我加了四块硬盘
这是你创建虚拟机时选择的磁盘类型,这里也需要与之一致
选择创建新硬盘
将其存储为单个文件,并选择大小
成功创建
//生产分区建议: 如无特殊需要, 直接使用整个磁盘, 无需分区
//学习分区建议:1P 1E(3L)(个人推荐这个,划分主分区,然后剩下的全部扩展分区) 2P 1E(2L) 3P 1E(1L) (仅适用于练习)
//正常情况下,我们分为主分区,然后分为扩展分区,将剩余的全部分给扩展分区,然后在扩展分区中划分逻辑分区
///只有主分区和逻辑分区才能格式化,扩展分区不能。它只是用来占据位置的,大小非常小
[root@lnh ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 100G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 99G 0 part ├─cs-root 253:0 0 65.2G 0 lvm / ├─cs-swap 253:1 0 2G 0 lvm[SWAP]└─cs-home 253:2 0 31.8G 0 lvm /homesdb 8:16 0 5G 0 disk sdc 8:32 0 5G 0 disk sdd 8:48 0 5G 0 disk sde 8:64 0 5G 0 disk sr0 11:0 1 9G 0 rom ///检查分区[root@lnh ~]# fdisk -lDisk /dev/sdc: 5 GiB, 5368709120 bytes, 10485760 sectors Units: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors //sda硬盘,一共100G,209715200个扇区,Units: sectors of 1 * 512 = 512 bytes ///每个扇区的大小Sector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dos //显示这是MBR格式的Disk identifier: 0x7276f405Device Boot Start End Sectors Size Id Type/dev/sda1 * 2048 2099199 2097152 1G 83 Linux//*表示指导的系统盘/dev/sda2 2099200 209715199 207616000 99G 8e Linux LVMDisk /dev/sdd: 5 GiB, 5368709120 bytes, 10485760 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes 电脑 / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/sde: 5 GiB, 5368709120 bytes, 10485760 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/cs-root: 65.2 GiB, 69956796416 bytes, 136634368 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/cs-swap: 2 GiB, 2181038080 bytes, 4259840 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/cs-home: 31.8 GiB, 34158411776 bytes, 66715648 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes//Disk /dev/mapper/cs-root,Disk /dev/mapper/cs-swap,Disk /dev/mapper/cs-home是sda逻辑卷//列出所有分区表[root@lnh ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.32.1).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.Created a new DOS disklabel with disk identifier 0x35a0c29f.Command (m for help): mHelp: DOS (MBR) a toggle a bootable flag ////切换分区启动标记 b edit nested BSD disklabel ///修改标签 c toggle the dos compatibility flag 切换dos兼容模式的标记 Generic //通用 d delete a partition //删除分区 F list free unpartitioned space l list known partition types ///列出已知分区的类型 n add a new partition ///添加新的分区 p print the partition table ///打印分区表 t change a partition type //改变分区类型 v verify the partition table ///验证分区表 i print information about a partition //打印分区信息 Misc m print this menu //打印这个菜单 u change display/entry units x extra functionality (experts only) Script //脚本 I load disk layout from sfdisk script file//显示布局信息 O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit //保存并退出 q quit without saving changes ///不保存退出 Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition tableCommand (m for help): n //创建分区Partition type p primary (0 primary, 0 extended, 4 free)//主分区(只能分四个) e extended (container for logical partitions)//扩展分区Select (default p): ///主分区默认 Using default response p.Partition number (1-4, default 1): //默认第一个First sector (2048-10485759, default 2048): ///默认这个初始位置Last sector, sectors or size{K,M,G,T,P}(2048-10485759, default 10485759): 50MCreated a new partition 1 of type 'Linux' and of size 50 MiB.Command (m for help): p //打印查看分区表Disk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (
mi