一、新增、分区、格式化新盘
1、首先在虚拟机中增加一块新硬盘(500G)
例如:Vmware、Exsi 软件,增加完成后,查看一下:
root@ubuntu:~# lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sda ├─sda1 vfat FAT32 0CC8-757B 1G 1% /boot/efi ├─sda2 ext4 1.0 602d4169-741c-47c2-9d63-686cc0a09f0d 1.7G 5% /boot └─sda3 LVM2_member LVM2 001 AfCID6-QHNz-OEcg-KXdj-bVeS-KCMK-DQ2fwE └─ubuntu--vg-ubuntu--lv ext4 1.0 8b41073e-f1ba-412e-9eb2-8127713f827d 84.4G 7% / sdb sr0
其中sdb就是新增加的硬盘。
可以查看更详细的硬盘情况
root@ubuntu:~# fdisk -l Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors Disk model: Virtual disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: A226A3F1-5348-41F9-A64B-0F2F00938DD1 Device Start End Sectors Size Type /dev/sda1 2048 2203647 2201600 1G EFI System /dev/sda2 2203648 6397951 4194304 2G Linux filesystem /dev/sda3 6397952 209713151 203315200 96.9G Linux filesystem Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 96.95 GiB, 104094236672 bytes, 203309056 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 /dev/sdb: 500 GiB, 536870912000 bytes, 1048576000 sectors Disk model: Virtual disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
请查标红的一行。
2、新硬盘分区(分区表)
root@ubuntu:~# fdisk /dev/sdb Welcome to fdisk (util-linux 2.39.3). 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 (MBR) disklabel with disk identifier 0x7bfe4259. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-1048575999, default 2048): <直接回车> Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1048575999, default 1048575999): <直接回车> Created a new partition 1 of type 'Linux' and of size 500 GiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
3、查看新盘分区结果
root@ubuntu:~# lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sda ├─sda1 vfat FAT32 0CC8-757B 1G 1% /boot/efi ├─sda2 ext4 1.0 602d4169-741c-47c2-9d63-686cc0a09f0d 1.7G 5% /boot └─sda3 LVM2_member LVM2 001 AfCID6-QHNz-OEcg-KXdj-bVeS-KCMK-DQ2fwE └─ubuntu--vg-ubuntu--lv ext4 1.0 8b41073e-f1ba-412e-9eb2-8127713f827d 84.4G 7% / sdb └─sdb1 sr0
说明分区成功了
4、将新的分区格式化成 ext4 格式
root@ubuntu:~# mkfs -t ext4 /dev/sdb1 mke2fs 1.47.0 (5-Feb-2023) Creating filesystem with 131071744 4k blocks and 32768000 inodes Filesystem UUID: 8fd776d3-9be5-4a59-8ce4-504bb14849e2 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
记住新的UUID,说明格式化成功。
查看一下格式化结果:
root@ubuntu:~# lsblk -f NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sda ├─sda1 vfat FAT32 0CC8-757B 1G 1% /boot/efi ├─sda2 ext4 1.0 602d4169-741c-47c2-9d63-686cc0a09f0d 1.7G 5% /boot └─sda3 LVM2_member LVM2 001 AfCID6-QHNz-OEcg-KXdj-bVeS-KCMK-DQ2fwE └─ubuntu--vg-ubuntu--lv ext4 1.0 8b41073e-f1ba-412e-9eb2-8127713f827d 84.4G 7% / sdb └─sdb1 ext4 1.0 8fd776d3-9be5-4a59-8ce4-504bb14849e2 sr0
二、挂载新盘
1、查看卷分组
标签:ext4,为例,--,ubuntu24.04,虚拟机,bytes,ubuntu,512,size From: https://www.cnblogs.com/hunttown/p/18510531