大网数据广告活动
服务器运维问答

fdisk -l show 500GB, df -h show 240 gb

· 52CE 我爱测

after incrase the disk space of my centos vm (in esxi hypervisor) when i execute fdsik [root@sopiqecommerce ~]# fdisk -l Disk /dev/sda: 504.7 GB, 504658657280 bytes, 985661440 sectors Units = sectors of 1 * 512 = 512 bytes Sector…

问题原文

原帖链接 · Youssef CH · CC BY-SA 4.0

after incrase the disk space of my centos vm (in esxi hypervisor)

when i execute fdsik

[root@sopiqecommerce ~]# fdisk -l

Disk /dev/sda: 504.7 GB, 504658657280 bytes, 985661440 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: 0x000bd0c1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   985661439   491781120   8e  Linux LVM

Disk /dev/mapper/centos-root: 241.7 GB, 241721933824 bytes, 472113152 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/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 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/mapper/centos-home: 21.5 GB, 21474836480 bytes, 41943040 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

when i execute df -h :

[root@sopiqecommerce ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  226G  106G  120G  48% /
devtmpfs                 2.9G     0  2.9G   0% /dev
tmpfs                    2.9G     0  2.9G   0% /dev/shm
tmpfs                    2.9G  8.8M  2.9G   1% /run
tmpfs                    2.9G     0  2.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  186M  829M  19% /boot
/dev/mapper/centos-home   20G   33M   20G   1% /home
tmpfs                    581M     0  581M   0% /run/user/0

i add 200 gb to disk using gparted

any missing configuration to use the unallocated 200gb ?

[update]

when i execute lvdisplay :

[root@sopiqecommerce ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                S40JP2-OofD-BRls-TeFj-uP6g-aBuh-mjKHyP
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100
  LV Status              available
  # open                 2
  LV Size                <3.88 GiB
  Current LE             992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                rHtm3b-0dqp-PXvF-OAaS-rLzR-TeW5-7E21cd
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100
  LV Status              available
  # open                 1
  LV Size                225.12 GiB
  Current LE             57631
  Segments               4
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                g33dwM-E1cZ-G6BM-2OP1-ilap-yS7k-ABU5Po
  LV Write Access        read/write
  LV Creation host, time sopiqecommerce, 2019-02-23 13:22:22 +0100
  LV Status              available
  # open                 1
  LV Size                20.00 GiB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

should i execute lvextend -l+100%FREE /dev/mapper/centos-root , to incrase the /root partition ?

已采纳解答

原帖链接 · Dexirian · CC BY-SA 4.0

Odds are you are using LVM disks, so you need to expand the logical volume as well.

You need to run :

lvdisplay

Find the Logical Volume to which you want to add space, and run the following command :

lvextend -l+100%FREE /dev/full/path/here

Once that's done, you also need to run :

resize2fs /dev/full/path/here

df -h should now show the proper size

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。