【问题标题】:how to increase disk size on centoscentos如何增加磁盘大小
【发布时间】:2019-12-23 15:12:36
【问题描述】:

我在虚拟机上的磁盘太小了,所以我用 VBoxManage 把它变大了,然后用 gparted 将新的可用空间分配给了主分区。但是在使用系统时,我仍然会收到类似“没有可用磁盘空间”的错误 缺少什么?

fdisk -l 显示磁盘 /dev/sda 有 14 GB。这是新尺寸。

[root@office data]# fdisk -l

Disk /dev/sda: 14.0 GB, 13991149568 bytes, 27326464 sectors
Units = Sektoren 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: 0x000a2e1f

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    27326463    13150208   8e  Linux LVM

Disk /dev/mapper/centos-root: 7159 MB, 7159676928 bytes, 13983744 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 859 MB, 859832320 bytes, 1679360 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

但 df -h 不会在 /centos-root 上显示新的大小。相反,有一些我不明白的 tmpfs 条目。如何将新磁盘空间分配给我的“工作”分区?

[root@office data]# df -h
Dateisystem             Größe Benutzt Verf. Verw% Eingehängt auf
/dev/mapper/centos-root  6,7G    6,7G   16K  100% /
devtmpfs                 1,9G       0  1,9G    0% /dev
tmpfs                    1,9G       0  1,9G    0% /dev/shm
tmpfs                    1,9G    8,6M  1,9G    1% /run
tmpfs                    1,9G       0  1,9G    0% /sys/fs/cgroup
/dev/sda1                497M    206M  292M   42% /boot
tmpfs                    379M       0  379M    0% /run/user/0

【问题讨论】:

    标签: centos virtualbox


    【解决方案1】:

    我自己找到了答案,解释了here

    因此,为 centos 客人扩大 virtualbox 磁盘的步骤是:

    1. 使用 VBoxManage 实用程序调整磁盘大小
    2. 使用 GParted 分配新的未分配空间
    3. 我缺少的步骤:使用链接中的描述 在 centos 内管理磁盘

    【讨论】:

      【解决方案2】:

      您的磁盘正在使用逻辑卷映射 (LVM),因为“mapper”在开发名称中。最好的方法可以避免 gparted 或弄乱您的文件。参考这里:https://unix.stackexchange.com/a/659099/352647

      【讨论】:

      • 最好的做法是避免使用 gparted?为什么?我不是说你错了。 “最好的办法可以避免”并不容易理解。语法不好。
      猜你喜欢
      • 2019-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-25
      • 2023-03-31
      • 1970-01-01
      • 2022-10-18
      • 2023-01-24
      相关资源
      最近更新 更多