当前位置: 首页 > news >正文

ARM环境上 openEuler扩展根盘并扩展到根分区中

虚拟化平台中在线直接把磁盘40G扩展到100G,系统中无法识别,需要先关闭开机器后才可以识别到是100G

[root@openeuler ~]# uname -m
aarch64

[root@openeuler ~]# more /etc/os-release 
NAME="openEuler"
VERSION="22.03 (LTS-SP4)"
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 (LTS-SP4)"
ANSI_COLOR="0;31"
[root@openeuler ~]#  vgs
VG        #PV #LV #SN Attr   VSize  VFree
openeuler   1   2   0 wz--n- 38.41g    0 
[root@openeuler ~]# lvdisplay 
--- Logical volume ---
LV Path                /dev/openeuler/root
LV Name                root
VG Name                openeuler
LV UUID                rHuEgp-5lpI-HYIc-6sCg-ht7i-UmF8-okp27I
LV Write Access        read/write
LV Creation host, time openeuler, 2024-12-01 23:48:52 +0800
LV Status              available
# open                 1
LV Size                22.41 GiB
Current LE             5737
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:0

--- Logical volume ---
LV Path                /dev/openeuler/swap
LV Name                swap
VG Name                openeuler
LV UUID                sicsoy-TJMe-Nayq-br09-696r-7c6w-grPVkH
LV Write Access        read/write
LV Creation host, time openeuler, 2024-12-01 23:48:53 +0800
LV Status              available
# open                 2
LV Size                16.00 GiB
Current LE             4096
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     8192
Block device           253:1

[root@openeuler ~]#  fdisk -l /dev/vda   --查看磁盘大小及磁盘格式
GPT PMBR size mismatch (83886079 != 209715199) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 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
Disklabel type: gpt
Disk identifier: 6B1A02AA-01E2-4BBA-8BB0-D3F524D83E2F

Device        Start      End  Sectors  Size Type
/dev/vda1      2048  1230847  1228800  600M EFI System
/dev/vda2   1230848 81786879 80556032 38.4G Linux LVM
/dev/vda3  81786880 83884031  2097152    1G Linux filesystem
[root@openeuler ~]# parted /dev/vda    --因是gpt格式磁盘,建议使用parted分区
GNU Parted 3.5
Using /dev/vda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Warning: Not all of the space available to /dev/vda appears to be used, you can fix the GPT to use all of the space (an extra 125829120 blocks) or continue with the current
setting? 
Fix/Ignore? Fix       --这里必须是Fix,选择Ignore分区无效                           
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
1      1049kB  630MB   629MB   fat32        EFI System Partition  boot, esp
2      630MB   41.9GB  41.2GB                                     lvm
3      41.9GB  42.9GB  1074MB  xfs

(parted) mkpart                                                           
Partition name?  []?                                                      
File system type?  [ext2]? xfs
Start? 42.9GB                                                             
End? 107GB
(parted) p                                                                
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
1      1049kB  630MB   629MB   fat32        EFI System Partition  boot, esp
2      630MB   41.9GB  41.2GB                                     lvm
3      41.9GB  42.9GB  1074MB  xfs
4      42.9GB  107GB   64.4GB  xfs

(parted) q                                                                
Information: You may need to update /etc/fstab.

[root@openeuler ~]# vgextend openeuler /dev/vda4
Physical volume "/dev/vda4" successfully created.
Volume group "openeuler" successfully extended
[root@openeuler ~]# vgs
VG        #PV #LV #SN Attr   VSize   VFree  
openeuler   2   2   0 wz--n- <98.41g <60.00g
[root@openeuler ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    4.0M     0  4.0M   0% /dev
tmpfs                        16G     0   16G   0% /dev/shm
tmpfs                       6.1G  9.3M  6.1G   1% /run
tmpfs                       4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/mapper/openeuler-root   23G  2.3G   21G  10% /
tmpfs                        16G     0   16G   0% /tmp
/dev/vda3                  1014M  156M  859M  16% /boot
/dev/vda1                   599M  6.5M  593M   2% /boot/efi

[root@openeuler ~]# xfs_info /dev/mapper/openeuler-root
meta-data=/dev/mapper/openeuler-root isize=512    agcount=4, agsize=1468672 blks
=                       sectsz=512   attr=2, projid32bit=1
=                       crc=1        finobt=1, sparse=1, rmapbt=0
=                       reflink=1    bigtime=1 inobtcount=0
data     =                       bsize=4096   blocks=5874688, imaxpct=25
=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2868, version=2
=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@openeuler ~]# 

[root@openeuler ~]# lvextend -l +100%FREE /dev/mapper/openeuler-root
Size of logical volume openeuler/root changed from 22.41 GiB (5737 extents) to <82.41 GiB (21096 extents).
Logical volume openeuler/root successfully resized.
[root@openeuler ~]#  xfs_growfs /dev/mapper/openeuler-root
meta-data=/dev/mapper/openeuler-root isize=512    agcount=4, agsize=1468672 blks
=                       sectsz=512   attr=2, projid32bit=1
=                       crc=1        finobt=1, sparse=1, rmapbt=0
=                       reflink=1    bigtime=1 inobtcount=0
data     =                       bsize=4096   blocks=5874688, imaxpct=25
=                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2868, version=2
=                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 5874688 to 21602304
[root@openeuler ~]# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    4.0M     0  4.0M   0% /dev
tmpfs                        16G     0   16G   0% /dev/shm
tmpfs                       6.1G  9.3M  6.1G   1% /run
tmpfs                       4.0M     0  4.0M   0% /sys/fs/cgroup
/dev/mapper/openeuler-root   83G  2.7G   80G   4% /
tmpfs                        16G     0   16G   0% /tmp
/dev/vda3                  1014M  156M  859M  16% /boot
/dev/vda1                   599M  6.5M  593M   2% /boot/efi
[root@openeuler ~]# 

http://www.dtcms.com/a/273054.html

相关文章:

  • 小架构step系列10:日志热更新
  • HTTP核心基础详解(附实战要点)
  • Jaspersoft Studio-6.4.0 TextField内容展示不全
  • [实战]调频(FM)和调幅(AM)信号生成(完整C语言实现)
  • 【养老机器人】核心技术
  • 6. Z 字形变换
  • 决策树与随机森林Python实践
  • 如何测家里是否漏电,4种方法
  • 实时连接,精准监控:风丘科技数据远程显示方案提升试验车队管理效率
  • 倍增法和ST算法 个人学习笔记代码
  • esp32在vscode中仿真调试
  • QT6 源(159)模型视图架构里的文件系统模型 QFileSystemModel 篇二:本类的源代码带注释
  • Building Bridges(搭建桥梁)
  • 【技术追踪】SynPo:基于高质量负提示提升无训练少样本医学图像分割性能(MICCAI-2025)
  • UE5源码模块解析与架构学习
  • 学习软件测试的第十四天(移动端)
  • pyqt-3(QSS、读取带qrc的ui、信号与槽函数)
  • CMake指令:add_custom_command和add_custom_target详解
  • Vue响应式原理五:响应式-自动收集依赖
  • OKHttp 核心知识点详解
  • 页面html,当鼠标点击图标,移开图标,颜色方块消失
  • 【牛客刷题】跳台阶(三种解法深度分析)
  • doker以及网站案例
  • 快速上手ASP .NET Core 8与MongoDB整合
  • 200W 以内的伺服电机 典型应用场景
  • C语言顺序表:从零开始,解锁数据结构之门!
  • YOLO系列pt导出不同onnx方法
  • Renren框架DistributeLock排他锁实现详解
  • 企业内网系统:从传统开发到智能赋能的进化之路
  • 安达发|医疗器械行业APS自动排单:智能化生产管理的未来之路