Nueva partición del disco de la máquina virtual

Grabe la expansión del disco de la máquina virtual

Al ver que el espacio en disco del portátil es bastante grande, y el espacio asignado cuando se instala de antemano se siente pequeño y lo expande un poco.

Ver el tamaño del sistema de archivos

Haga clic en Máquina virtual -> Configuración -> Disco -> extensión , seleccione la extensión para el tamaño de disco apropiado.

  1. Luego verifique el sistema de archivos actual, la asignación de almacenamiento y no vio que el sistema cargaba la memoria recién expandida.
[root@localhost ~]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  3.8G     0  3.8G   0% /dev
tmpfs          tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs          tmpfs     3.9G   13M  3.8G   1% /run
tmpfs          tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1      xfs        60G  4.1G   56G   7% /
/dev/sda2      xfs        25G  771M   25G   4% /var
tmpfs          tmpfs     781M   32K  781M   1% /run/user/1000
/dev/sr0       iso9660   4.4G  4.4G     0 100% /run/media/root/CentOS 7 x86_64
tmpfs          tmpfs     781M     0  781M   0% /run/user/0

  1. Mire el tamaño real de todo el disco después de la expansión y el tamaño de cada partición que se ha particionado.
[root@localhost ~]# fdisk -l 

Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 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 label type: dos
Disk identifier: 0x0009cdd8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   125831167    62914560   83  Linux
/dev/sda2       125831168   178259967    26214400   83  Linux
/dev/sda3       178259968   188743679     5241856   82  Linux swap / Solaris
  1. Luego divide una partición más en el mismo disco
[root@localhost ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 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 label type: dos
Disk identifier: 0x0009cdd8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   125831167    62914560   83  Linux
/dev/sda2       125831168   178259967    26214400   83  Linux
/dev/sda3       178259968   188743679     5241856   82  Linux swap / Solaris

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): p
Selected partition 4
First sector (188743680-314572799, default 188743680): 
Using default value 188743680
Last sector, +sectors or +size{
    
    K,M,G} (188743680-314572799, default 314572799): 
Using default value 314572799
Partition 4 of type Linux and of size 60 GiB is set

  1. Consultar la situación después de la partición
Command (m for help): p

Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 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 label type: dos
Disk identifier: 0x0009cdd8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   125831167    62914560   83  Linux
/dev/sda2       125831168   178259967    26214400   83  Linux
/dev/sda3       178259968   188743679     5241856   82  Linux swap / Solaris
/dev/sda4       188743680   314572799    62914560   83  Linux

Command (m for help): wp
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

  1. El último advierte que el sistema actual está ocupado y la tabla anterior todavía está en uso. Debe reiniciarse para usar la nueva tabla. Luego reinicie, formatee la nueva partición, cree un directorio data1 y monte la partición en la actual directorio.
[root@localhost ~]# reboot
[root@localhost mapper]#  mkfs.xfs /dev/sda4
[root@localhost mapper]# mkdir /data1
[root@localhost mapper]# mount /dev/sda4 /data1
[root@localhost mapper]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.8G     0  3.8G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G   13M  3.8G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1        60G  4.1G   56G   7% /
/dev/sda2        25G  812M   25G   4% /var
tmpfs           781M   12K  781M   1% /run/user/42
tmpfs           781M     0  781M   0% /run/user/0
/dev/sda4        60G   33M   60G   1% /data1

  1. Después de reiniciar el sistema, el disco debe montarse manualmente de nuevo, por lo que es mejor montarlo automáticamente después de arrancar.
[root@localhost ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Mar 17 16:49:42 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9311cbde-d447-4a56-8f74-092e065c9420 /                       xfs     defaults        0 0
UUID=489ce9aa-e8e2-4203-98c4-2491f8bd09ec /var                    xfs     defaults        0 0
UUID=a8da9bdf-e3ee-4cb8-b652-5e17632f0a44 swap                    swap    defaults        0 0
/dev/sda4       /data1  xfs     defaults        0       0  

Supongo que te gusta

Origin blog.csdn.net/m0_48187193/article/details/114965177
Recomendado
Clasificación