虚拟机分配硬盘

发布时间:2026/9/25 12:14:59
虚拟机分配硬盘 先在虚拟机增加硬盘。分配新加的硬盘[rootlocalhost ~]# fdisk /dev/sdaWelcome to fdisk (util-linux 2.23.2).Command (m for help): p ← 你输入 pDevice Boot Start End Blocks Id System/dev/sda1 * 2048 2099199 1048576 83 Linux/dev/sda2 2099200 33554431 15727616 8e Linux LVMCommand (m for help): d ← 你输入 dPartition number (1,2, default 2): 2 ← 你输入 2Partition 2 is deletedCommand (m for help): n ← 你输入 nPartition type:p primary (1 primary, 0 extended, 3 free)e extendedSelect (default p): p ← 你输入 pPartition number (1-4, default 2): 2 ← 你输入 2First sector (2048-167772159, default 2048): 2099200 ← 你输入起始扇区你之前记下的数字Last sector, sectors or size{K,M,G} (2099200-167772159, default 167772159): ← 直接回车Command (m for help): t ← 你输入 tPartition number (1,2, default 2): 2 ← 你输入 2Hex code (type L to list all codes): 8e ← 你输入 8eChanged type of partition Linux to Linux LVMCommand (m for help): w ← 你输入 wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.识别挂在硬盘[rootlocalhost ~]# pvresize /dev/sda2Physical volume /dev/sda2 changed1 physical volume(s) resized / 0 physical volume(s) not resized[rootlocalhost ~]# pvdisplay--- Physical volume ---PV Name /dev/sda2VG Name centosPV Size 80.00 GiB / not usable 2.00 MiBAllocatable yesPE Size 4.00 MiBTotal PE 20479Free PE 16640Allocated PE 3839PV UUID vHeZCZ-Gxfs-wb1z-Wejc-6hBo-BStr-EvbOHd[rootlocalhost ~]# lvextend -l 100%FREE /dev/centos/rootSize of logical volume centos/root changed from 13.39 GiB (3429 extents) to 79.99 GiB (20479 extents).Logical volume centos/root successfully resized.[rootlocalhost ~]# xfs_growfs /meta-data/dev/mapper/centos-root isize512 agcount4, agsize877824 blks sectsz512 attr2, projid32bit1 crc1 finobt0 spinodes0data bsize4096 blocks3511296, imaxpct25 sunit0 swidth0 blksnaming version 2 bsize4096 ascii-ci0 ftype1log internal bsize4096 blocks2560, version2 sectsz512 sunit0 blks, lazy-count1realtime none extsz4096 blocks0, rtextents0data blocks changed from 3511296 to 20970496[rootlocalhost ~]# df -h /文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/centos-root 80G 5.0G 75G 7% /

关于本文作者

来自尧图内容编辑团队

尧图内容编辑团队 内容团队

尧图内容编辑团队

本文由尧图网络内容编辑团队执笔。团队由资深项目经理、前端工程师与设计师组成,所有内容均来自亲手交付的真实项目,先讲清问题、再给出可落地的解法。尧图深耕北京网站建设十年,服务过京华建材集团、智造科技等各行业客户,把一线经验沉淀为可复用的行业观察。

  • 十年建站经验,覆盖建材、制造、服务、文创等
  • 项目经理把关选题与事实准确性
  • 工程师与设计师联合撰写专业细节
  • 统一编辑规范,保证文风与排版一致
  • 每月复盘转化数据,迭代选题方向

延伸阅读

相关资讯与近期热门内容

深度阅读推荐

建站决策前值得细读的三篇

网站改版的5个关键决策
2024-08-12

网站改版的5个关键决策

什么时候该改版、改到什么程度、如何避免流量掉光,京华建材集团改版复盘给出答案。

获取专属建站方案

看完文章,把您的行业与预算告诉我们,免费获取一份量身定制的官网建设方案与报价。

立即免费咨询