首页 > 其他分享 >ESXi给虚拟机分区扩容

ESXi给虚拟机分区扩容

时间:2025-01-15 10:46:49浏览次数:1  
标签:tmpfs ESXi 虚拟机 bytes dev rl 512 root 分区

ESXI虚拟机磁盘原有是40G现扩容到240G。

df -Th 这是参数连着写。相当于df -T -h

-T:代表type类型,可以查看到磁盘的类型。

-h:代表human人类,就是以人们熟悉的单位来表示磁盘大小,如K、M、G。如果不加这个参数,默认以KB字节单位显示,可读性差。

查询结果含义:size代表磁盘总大小,used代表已使用的空间,avail代表剩余可用空间。我们重点关注根目录的磁盘使用情况即可。

[root@localhost ~]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
devtmpfs            devtmpfs  890M     0  890M   0% /dev
tmpfs               tmpfs     908M     0  908M   0% /dev/shm
tmpfs               tmpfs     908M  8.7M  900M   1% /run
tmpfs               tmpfs     908M     0  908M   0% /sys/fs/cgroup
/dev/mapper/rl-root xfs        37G   15G   23G  40% /
/dev/sda2           xfs      1014M  208M  807M  21% /boot
/dev/sda1           vfat      599M  5.8M  594M   1% /boot/efi
tmpfs               tmpfs     182M     0  182M   0% /run/user/0

lsblk命令的英文是“list block”,即用于列出所有可用块设备的信息,而且还能显示他们之间的依赖关系。

[root@localhost ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  240G  0 disk 
├─sda1        8:1    0  600M  0 part /boot/efi
├─sda2        8:2    0    1G  0 part /boot
└─sda3        8:3    0 38.4G  0 part 
  ├─rl-root 253:0    0 36.4G  0 lvm  /
  └─rl-swap 253:1    0  2.1G  0 lvm  [SWAP]
sr0          11:0    1 1024M  0 rom   

fdisk -l //查看磁盘分区情况

[root@localhost ~]# fdisk -l
GPT PMBR size mismatch (83886079 != 503316479) will be corrected by write.
Disk /dev/sda: 240 GiB, 257698037760 bytes, 503316480 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: 98C577F9-5440-4CA8-B519-8E54635464D4

Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 83884031 80556032 38.4G Linux LVM

 Disk /dev/mapper/rl-root: 36.4 GiB, 39036387328 bytes, 76242944 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/rl-swap: 2.1 GiB, 2206203904 bytes, 4308992 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

fdisk/dev/sda 创建分区

[root@localhost ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (83886079 != 503316479) will be corrected by write.

打印分区表

Command (m for help): p

Disk /dev/sda: 240 GiB, 257698037760 bytes, 503316480 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: 98C577F9-5440-4CA8-B519-8E54635464D4

Device Start End Sectors Size Type
/dev/sda1 2048 1230847 1228800 600M EFI System
/dev/sda2 1230848 3327999 2097152 1G Linux filesystem
/dev/sda3 3328000 83884031 80556032 38.4G Linux LVM

打印菜单

Command (m for help): m

Help:

GPT
M enter protective/hybrid MBR

Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition

Misc
m print this menu
x extra functionality (experts only)

Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file

Save & Exit
w write table to disk and exit
q quit without saving changes

Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table

创建一个新分区
Command (m for help): n
Partition number (4-128, default 4):
First sector (83884032-503316446, default 83884032):
Last sector, +sectors or +size{K,M,G,T,P} (83884032-503316446, default 503316446):

Created a new partition 4 of type 'Linux filesystem' and of size 200 GiB.

Command (m for help): t
Partition number (1-4, default 4):
Partition type (type L to list all types): 31

Changed type of partition 'Linux filesystem' to 'Linux LVM'.

写入分区并退出

Command (m for help): w
The partition table has been altered.
Syncing disks.

[root@localhost ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  240G  0 disk 
├─sda1        8:1    0  600M  0 part /boot/efi
├─sda2        8:2    0    1G  0 part /boot
├─sda3        8:3    0 38.4G  0 part 
│ ├─rl-root 253:0    0 36.4G  0 lvm  /
│ └─rl-swap 253:1    0  2.1G  0 lvm  [SWAP]
└─sda4        8:4    0  200G  0 part 
sr0          11:0    1 1024M  0 rom 

 格式化新建的分区  mkfs.ext4 /dev/sda4

[root@localhost ~]# mkfs.ext4 /dev/sda4
mke2fs 1.45.6 (20-Mar-2020)
Discarding device blocks: done                            
Creating filesystem with 52428800 4k blocks and 13132800 inodes
Filesystem UUID: 9fa537ed-7990-4173-999d-653a7a225761
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done     

逻辑卷管理器LVM

[root@localhost ~]# lvm

创建物理卷 pvcreate

lvm> pvcreate /dev/sda4
WARNING: ext4 signature detected on /dev/sda4 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sda4.
  Physical volume "/dev/sda4" successfully created.
lvm> vgextend rl /dev/sda4
  Volume group "rl" successfully extended

显示物理卷属性 pvdisplay

lvm> vgdisplay -v

--- Volume group ---
  VG Name               rl
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <238.41 GiB
  PE Size               4.00 MiB
  Total PE              61032
  Alloc PE / Size       9833 / 38.41 GiB
  Free  PE / Size       51199 / <200.00 GiB
  VG UUID               1rRNwf-Hn1K-Gm1M-tkZW-2V86-zIFC-hIdRWZ
   
  --- Logical volume ---
  LV Path                /dev/rl/root
  LV Name                root
  VG Name                rl
  LV UUID                B46CgP-AocJ-uDGF-AAZw-I2mS-wLtt-k8haf1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2024-05-31 14:33:21 +0800
  LV Status              available
  # open                 1
  LV Size                <36.36 GiB
  Current LE             9307
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/rl/swap
  LV Name                swap
  VG Name                rl
  LV UUID                x04tXm-Nv8M-z3QL-HFZr-NQjB-YCbr-SbEC8y
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2024-05-31 14:33:21 +0800
  LV Status              available
  # open                 2
  LV Size                2.05 GiB
  Current LE             526
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Physical volumes ---
  PV Name               /dev/sda3     
  PV UUID               qA408B-lu9c-okAP-Ll3Z-aUOj-bjfM-ntse1u
  PV Status             allocatable
  Total PE / Free PE    9833 / 0
   
  PV Name               /dev/sda4     
  PV UUID               EMTUp0-7wcX-vkdd-45jo-qtES-Wapb-kk2ijC
  PV Status             allocatable
  Total PE / Free PE    51199 / 51199

扩展逻辑卷的大小 lvextend

lvextend -L +扩容大小 -r 逻辑卷 //扩展逻辑卷

-r 立刻刷新文件系统

lvm> lvextend -l+51199 /dev/mapper/rl-root
  Size of logical volume rl/root changed from <36.36 GiB (9307 extents) to 236.35 GiB (60506 extents).
  Logical volume rl/root successfully resized.
lvm> quit
  Exiting.

使用xfs_growfs命令增加 XFS 文件系统的大小。必须挂载 XFS 文件系统,并且底层设备上必须有可用空间。xfs_growfs 实用程序最常用于逻辑卷。

xfs_growfs 命令的语法如下: xfs_growfs [options] mount-point

[root@localhost ~]# xfs_growfs /dev/mapper/rl-root
meta-data=/dev/mapper/rl-root    isize=512    agcount=4, agsize=2382592 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=9530368, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=4653, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 9530368 to 61958144

查看磁盘信息,分区已扩容成功。
[root@localhost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 890M 0 890M 0% /dev tmpfs tmpfs 908M 0 908M 0% /dev/shm tmpfs tmpfs 908M 8.7M 900M 1% /run tmpfs tmpfs 908M 0 908M 0% /sys/fs/cgroup /dev/mapper/rl-root xfs 237G 16G 221G 7% / /dev/sda2 xfs 1014M 208M 807M 21% /boot /dev/sda1 vfat 599M 5.8M 594M 1% /boot/efi tmpfs tmpfs 182M 0 182M 0% /run/user/0

 

标签:tmpfs,ESXi,虚拟机,bytes,dev,rl,512,root,分区
From: https://www.cnblogs.com/niewd/p/18672527

相关文章

  • 嵌入式杂谈(问题解决一:使用HAL库时keil中代码的分区)
     如图,代码分区代码区域作用Privateincludes引入所需头文件,提供函数声明、类型定义和宏等Privatetypedef创建自定义数据类型,增强代码可读性与维护性Privatedefine定义常量和宏,方便代码修改与简化Privatemacro实现简单代码替换,简化代码逻辑Privatevariables声明和初始化......
  • Linux虚拟机vim编辑器
    Linux虚拟机vim编辑器所有的UnixLike系统都会内建vi文书编辑器,其他的文书编辑器则不一定会存在。但是目前我们使用比较多的是vim编辑器。vim具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序设计。相关文章:史上最全Vim快捷键键位图—入门到进阶什么......
  • VMware17Pro虚拟机安装macOS教程
    下载所需文件官方正版VMware下载(17pro):通过网盘分享的文件:VMware17.5.rar链接:https://pan.baidu.com/s/15EtL6XUGCIxLpvOcDwL9Ew提取码:r6ic下载系统镜像:通过网盘分享的文件:macOS.Sonoma.14.5.K3.iso链接:https://pan.baidu.com/s/1H14E7snWdPhdcrRcQBtFew提取码:a6u2......
  • 记录在虚拟机中达梦数据库DEM安装过程遇到的问题解决方法
    本篇博客是记录了在寒假课程设计中在虚拟机麒麟银河系统安装达梦数据库DEM遇到的各种刁钻问题的解决方法,希望同样遇到这些问题的小伙伴们能够在查看本篇博客后真正解决问题。废话不多说,直接往下看吧! dem服务器的安装与部署1、上传dem和tomcat压缩包2、./dminitpath=/d......
  • Linux 硬盘扩容 分区 & 挂载
    Linux硬盘扩容分区&挂载1.添加分区1.1.查看新添加的硬盘fdisk-l假设当前未挂载的盘符是/dev/sdb,后文中所有操作都按挂载/dev/sdb操作1.2.分区管理小硬盘fdisk/dev/sdb大硬盘(2TB以上)gdisk/dev/sdb1.3.编辑分区⚠️下方注释一行一行看,不要跳过#执行......
  • Windows10中安装了ubuntu虚拟机后xshell无法连接到ubuntu
    Windows10中安装了ubuntu虚拟机后xshell无法连接到ubuntu安装了ubuntu虚拟机后发现shell无法连接到ubuntu的排查步骤:步骤1:检查虚拟机网络配置确认虚拟机网络模式:确认虚拟机的网络模式是否设置为桥接模式或NAT模式。桥接模式可以让你的虚拟机在网络中拥有独立的IP地址,而NAT模式......
  • utm虚拟机ubuntu网络问题
    背景更换网络环境导致虚拟机网络不通,mac-utm-ubuntu问题分析在原有配置状态下,查找原因network:ethernets:enp0s1:dhcp4:noaddresses:-10.1.2.222/24routes:-to:default......
  • 如何使用虚拟机连接到SSH
    第一步:安装SHH服务登录虚拟机后,从活动页面进入端口输入下列命令:sudoyuminstallopenssh-clients命令解释:sudo 以超级用户权限执行此命令,使用yum包管理器来安装openssh-clients软件包输入以上命令后按回车键,提示输入密码,输完后回车即可.注:输入密码时密......
  • Q:群晖磁盘断电导致,无法访问系统分区
     1、群晖磁盘断电导致,无法访问系统分区 2、点击存储空间管理员-总览-点击修复 3、存储空间-文件系统检查-重启 4、重启后正常 ......
  • VMware ESXi 8.0U3c macOS Unlocker & OEM BIOS 集成驱动版,新增 12 款 I219 网卡驱动
    VMwareESXi8.0U3cmacOSUnlocker&OEMBIOS集成驱动版,新增12款I219网卡驱动VMwareESXi8.0U3cmacOSUnlocker&OEMBIOS集成网卡驱动和NVMe驱动(集成驱动版)发布ESXi8.0U3c集成驱动版,在个人电脑上运行企业级工作负载请访问原文链接:https://sysin.org/blog/v......