当前位置: 首页 > 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.lryc.cn/news/584657.html

相关文章:

  • MySQL数据库调优
  • C++ 中最短路算法的详细介绍(加强版)
  • 【养老机器人】核心技术
  • 深入拆解Spring核心思想之一:IoC
  • vue3中ref和reactive的使用、优化
  • 入门级别的Transformer模型介绍
  • Linux 内核日志中常见错误
  • 学习JNI 二
  • 机器学习1
  • Java线程池原理概述
  • Spring Boot:将应用部署到Kubernetes的完整指南
  • 什么?不知道 MyBatisPlus 多数据源(动态数据源)干什么的,怎么使用,看这篇文章就够了。
  • Windows安装DevEco Studio
  • 深入理解oracle ADG和RAC
  • 高并发导致重复key问题--org.springframework.dao.DuplicateKeyException
  • 企业电商平台搭建:ZKmall开源商城服务器部署与容灾方案
  • Java中实现线程安全的几种方式
  • 华为OD 周末爬山
  • 模块三:现代C++工程实践(4篇)第二篇《性能调优:Profile驱动优化与汇编级分析》
  • 关于k8s Kubernetes的10个面试题
  • 【牛客刷题】跳台阶(三种解法深度分析)
  • Java 21 核心技术:虚拟线程与结构化并发实战
  • Django专家成长路线知识点——AI教你学Django
  • Spring Boot + Javacv-platform:解锁音视频处理的多元场景
  • 处理Web请求路径参数
  • 小程序开发平台,自主开发小程序源码系统,多端适配,带完整的部署教程
  • GitHub上优秀的开源播放器项目介绍及优劣对比
  • PPT 倒计时工具:把控节奏,掌握时间,超简单超实用让演示游刃有余
  • 电脑息屏工具,一键黑屏超方便
  • C语言——预处理详解