1. Add 10G HDD. Hot swap is actually supported on the server
2. Fdisk-l View[[email protected] ~]# fdisk-l #如果识别不到新插的硬盘, to view the disk, the virtual machine requires a reboot to load the new disk properly. disk/dev/sda:53.7 GB, 53687091200 bytes, 104857600 sectorsunits = sectors of 1 * = bytessector size (logic al/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk identifier:0 X000cd7c5 device boot start End Blocks Id system/dev/sda1 * 2048 2099199 1048576 83 Linux/dev/sda2 2099200 94373887 46137344 83 linux/dev/sda3 94373888 102502399 4064256 82 linux swap/solaris/dev/sda4 102502400 104857599 1177600 5 extended/dev/sda5 102504448 104601599 1048576 83 linux disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 sectors #这里的sdb为新加的磁盘Units = sectors of 1 * 512 = 512 Bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): + bytes/512 bytes 3, for the disk can be non-partitioned, directly formatted a whole block use, but usually is first partition, after formatting. fdisk is MBR partition mode, up to 2TB only, up to the primary partition primary plus the extended partition extended is 4, want to multiple partitions need the fourth partition for the extended partition extended, and in the extended partition within a plurality of logical partitions. The extended partition is just a shell that does not support formatting and is really storing logical partitions. [[email protected] ~]# fdisk/dev/sdbwelcome to fdisk (Util-linux 2.23.2). changes would remain in memory only, u Ntil decide to write them. Be careful before using the write Command. device does not contain a recognized partition tablebuilding a new DOS dis Klabel with disk identifier 0x189fc246. command (M-help): n #创建一个新的分区 (typically N: Create a new partition ; p: List partition; W: Save and exit; D: delete a partition; Q: Do not save direct exit) Partition type: p primary (0 primary, 0 Extended, 4 free) #主分区: If you want to use a partition, you can divide up to four e extended #扩展分区: Contains logical partition SELECT (Default p): P partition number (1-4, Default 1): 1First sector (2048-20971519, default 2048): #这里起始扇区都使用默认, you can enter directly. Using Default value 2048Last sector, +sectors or +size{k,m,g} (2048-20971519, default 20971519): +2g & nbsp; #划分2个G的空间. Partition 1 of type Linux and of size 2 GiB is SetCommand (M for help): p #列出分区 disk/dev/sdb:10.7 GB, 10 737418240 bytes, 20971520 sectorsunits = sectors of 1 * MB = bytessector size (logical/physical): bytes/512 byt ESI/O size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk identifier:0x189fc246 Device Boot start end Blocks Id System/dev/sdb1 2048 4196351 2097152 83 Linux # you can now see the partition command you just partitioned (M for help): n #主分区分完过后, and the new partition will not prompt for partition type: p primary (1 primary, 0 extended, 3 free) e Extendedselect (default p): #默认回车Using Default Response ppartition Number (2-4, default 2): #默认回车First sector (4196352-20971519, default 4196352): #默认回车Using Default value 4196352Last sector, +sectors or +size{k,m,g} (4196352-20971519, default 20971519): +2g&nbs p; #新建2G的主分区Partition 2 of type Linux and of size 2 GiB is SetCommand (M for help): p #列 Out partition disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 sectorsunits = sectors of 1 * = bytessector size (log ical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk identifier: 0x189fc246 device boot Start End Blocks Id System/dev/sdb1 2048 4196351 2097152 83 linux/dev/sdb2 4196352 8390655 2097152 83 Linuxcommand (M for help): n #新建一个分区Partition type: p Primary (2 primary, 0 extended, 2 free) e extendedselect (default p): #回车默认主分区Using Default Response ppartition number (3,4, default 3): #默认回车从3开始First Sector (8390656-20971519, default 8390656): #默认回车Using default value 8390656LaSt sector, +sectors or +size{k,m,g} (8390656-20971519, default 20971519): +1g #划分1个G的主分区Partition 3 of type Lin UX and of size 1 GiB is SetCommand (M-help): p #列出分区 disk/dev/sdb:10.7 GB, 10737418240 b Ytes, 20971520 sectorsunits = sectors of 1 * = bytessector size (logical/physical): bytes/512 bytesi/o Size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk Identifier:0x189fc246 device Boo t start end Blocks Id System/dev/sdb1 2048 4196351 2097152 83 Linux/dev/sdb2 4196352 8390655 2097152 83 linux/dev/sdb3 8390656 10487807 1048576 83 Linux command (M for help): n #新建分区Partition type: p Primary (3 primary, 0 extended, 1 free) e extendedselect (default e): e & nbsp; #划分扩展分区Selected partition 4First sector (10487808-20971519, default 10487808): # Default carriage return by using default value 10487808Last sector, +sectors or +size{k,m,g} (10487808-20971519, default 20971519): #默认回车划分剩余空间给扩展分区Using Default value 20971519Partition 4 of type Extended and of size 5 GiB is SetCommand (M for help ): p #列出分区 disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 sectorsunits = sectors of 1 * 512 = 5 Bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk Identifier:0x189fc246 device Boot &nbs p; start end Blocks Id System/dev/sdb1 2048 4196351 2097152 83 linux/dev/sdb2 4196352 8390655 2097152 83 linux/dev/sdb3 8390656 10487807 1048576 83 Linux/dev/sdb4 10487808 20971519 5241856 5 extendedcommand (M for help): n #可以看到提示变了 can only be divided into logical partitions. All primary partitions is in useadding logical partition 5First sector (10489856-20971519, default 10489856): Using defaul T value 10489856Last sector, +sectors or +size{k,m,g} (10489856-20971519, default 20971519): +1g # Logical partition dividing 1G size partition 5 of type Linux and of size 1 GiB is SetCommand (M for help): p #列出分区 disk/dev /sdb:10.7 GB, 10737418240 bytes, 20971520 sectorsunits = sectors of 1 * = bytessector size (logical/physical): 51 2 bytes/512 bytesi/o Size (minimum/optimal): bytes/512 bytesdisk label Type:dosdisk identifier:0x189fc246 & Nbsp; device boot start End Blocks Id System/dev/sdb1 2048 4196351 2097152 83 linux/dev/sdb2 4196352 8390655 2097152 83 linux/dev/sdb3 8390656 10487807 1048576 83 linux/dev/sdb4 10487808 20971519 5241856 5 Extended/dev/sdb5 10489856 12587007 1048576 83 linuxcommand (M for help): n #再划分一个逻辑分区All primary partitions is in Useadding Logical Partition 6First sector (12589056-20971519, default 12589056): Using default value 12589056Last sector, + Sectors or +siZe{k,m,g} (12589056-20971519, default 20971519): +1g #划分1G大小的逻辑分区Partition 6 of type Linux and of size 1 GiB is Set command (M-help): p #列出分区 disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 sectorsu NITs = sectors of 1 * bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk label Type:dosdisk Identifier:0x189fc246 device Boot & nbsp; start end Blocks Id System/dev/sdb1 2048 4196351 2097152 83 Linux/dev/sdb2 4196352 8390655 2097152 83 linux/dev/sdb3 8390656 10487807 1048576 83 Linux/dev/sdb4 10487808 20971519 5241856 5 extended/dev/sdb5 10489856 12587007 1048576 83 linux/dev/sdb6 12589056 14686207 1048576 83 linuxcommand (M for help): d # Delete a partition 6Partition number (1-6, default 6): 6 #回车默认是6Partition 6 is Deleted command (M-Help ): p #列出分区 disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 sectorsunits = sectors of 1 * = + bYtessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk Label Type: Dosdisk Identifier:0x189fc246 device boot start End Blocks Id System/dev/sdb1 2048 4196351 2097152 83 linux/dev/sdb2 4196352 8390655 2097152 83 linux/dev/sdb3 8390656 10487807 1048576 83 linux/dev/sdb4 10487808 &nbsP; 20971519 5241856 5 extended/dev/sdb5 10489856 12587007 1048576 83 linuxcommand (M for help): w #保存并退出The partition Table have been altered! calling ioctl () to re-read partition table. Syncing disks.[[email protected] ~]# fdisk-l/dev/sdb disk/dev/sdb:10.7 GB, 10737418240 bytes, 20971520 Sectorsunits = sectors of 1 * bytessector size (logical/physical): bytes/512 bytesi/o Size (Minimum/optima L): bytes/512 bytesdisk label Type:dosdisk Identifier:0x189fc246 device BOOT  &N bsp; start end Blocks Id System/dev/sdb1 2048 4196351 2097152 83 linux/dev/sdb2 4196352 8390655 2097152 83 Linux/dev/sdb3 8390656 10487807 1048576 83 linux/dev/sdb4 10487808 20971519 5241856 5 extended/dev/sdb5 10489856 12587007 1048576 83 linux
when we create a disk partition, there are three types of partitions to choose from, the extended partition (e), the primary partition (P), and the logical partition (L).
we can create up to 4 partitions (not including logical partitions in 4), and if you want to create multiple partitions, you can have 3 primary partitions and one extended partition combination. Then in the extended partition, create the logical partition (you can create an infinite number of logical partitions); It should be noted that the extended partition is equivalent to a shell, is not formatted (not available), only its sub-partitions can be formatted. When partitioning in Fdisk, use the D option to delete the partition you want to delete, and be aware that when you have sub-partitions (logical partitions) in the extended partition, deleting the extended partition is deleted along with the child partition.
Linux Disk partitioning