问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

怎样调整XenServer下面Linux虚拟机的磁盘大小

发布网友 发布时间:2022-04-20 12:18

我来回答

1个回答

热心网友 时间:2023-09-13 22:27

登录到XenServer。
修改虚拟机磁盘大小
xe vdi-resize uuid=17e350e3-1528-4e8f-965b-d33d352e73ed disk-size=40GiB

启动虚拟机

修改分区大小
fdisk /dev/xvda

The number of cylinders for this disk is set to 5221.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot

Start

End

Blocks

Id
System
/dev/xvda1

*

1

13

104391

83
Linux
/dev/xvda2

14

2610

20860402+
8e
Linux LVM

Command (m for help): Command (m for help): p
DOS Compatibility flag is not set

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action

e

extended

p

primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-5221, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-5221, default 5221):
Using default value 5221

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot

Start

End

Blocks

Id
System
/dev/xvda1

*

1

13

104391

83
Linux
/dev/xvda2

14

5221

41833260

8e
Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

重启虚拟机:reboot

调整PV大小
pvs

PV

VG

Fmt
Attr PSize
PFree

/dev/xvda2 VolGroup00 lvm2 a-

19.88G

0

pvresize -v /dev/xvda2

Using physical volume(s) on command line

Archiving volume group "VolGroup00" metadata (seqno 3).

Resizing physical volume /dev/xvda2 from 636 to 1276 extents.

Resizing volume "/dev/xvda2" to 83666136 sectors.

Updating physical volume "/dev/xvda2"

Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 4).

Physical volume "/dev/xvda2" changed

1 physical volume(s) resized / 0 physical volume(s) not resized

pvs

PV

VG

Fmt
Attr PSize
PFree

/dev/xvda2 VolGroup00 lvm2 a-

39.88G 20.00G

调整LV大小
lvs

LV

VG

Attr

LSize
Origin Snap%
Move Log Copy%
Convert

LogVol00 VolGroup00 -wi-ao 17.84G

LogVol01 VolGroup00 -wi-ao
2.03G

lvextend -l +100%FREE /dev/VolGroup00/LogVol00

Extending logical volume LogVol00 to 37.84 GB

Logical volume LogVol00 successfully resized

lvs

LV

VG

Attr

LSize
Origin Snap%
Move Log Copy%
Convert

LogVol00 VolGroup00 -wi-ao 37.84G

LogVol01 VolGroup00 -wi-ao
2.03G
调整分区大小
df -h
Filesystem

Size
Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00

5.7G
4.5G
950M
83% /
/dev/xvda1

99M

22M

73M
24% /boot
tmpfs

2.0G

0
2.0G

0% /dev/shm

resize2fs /dev/mapper/VolGroup00-LogVol00
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 9920512 (4k) blocks.
The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 9920512 blocks long.

df -h
Filesystem

Size
Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00

37G
4.5G

31G
13% /
/dev/xvda1

99M

22M

73M
24% /boot
tmpfs

2.0G

0
2.0G

0% /dev/shm

任务完成
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
易企秀如何分享链接给微信好友?-易企秀分享链接给微信好友的方法 华为荣耀3c系统辅助功能服务老是自动关闭,求解决方案。 我用一键清理忽... 华为荣耀3c手机双击唤醒屏幕不好用了怎么办? 荣耀手机刷机包从哪下 木地板为啥走过会响 瓷砖块要斜成几度角人踩上去不会烂 刚出生的婴儿肚子胀怎么办 新生儿涨肚子按摩图 刚生小宝宝胀气怎么办 白果怎么炒好吃 白果可以制作哪些美食 vmware 虚拟机怎么扩大linux磁盘空间 如何减少qcow2虚拟磁盘文件实际占用的存储空间 如何在 Linux 中安全擦除删除的文件内容 怎么压缩linux虚拟机磁盘空间 iphone11 pro2700元售出,你知道苹果手机有什么好处吗? 怎样自己搞QQ 国外QQ如何登陆 QQ怎样升级更快 养在室内的绿萝为什么烂根了? 绿萝烂根了怎么办?遇到这种情况它还有救吗? 盆栽绿萝出现烂根怎么处理? 为什么我的绿萝老是烂根 绿萝烂根了耶,叶子发黄了咋办? 视频:绿萝烂根怎么办 绿萝为啥会烂根? 绿萝烂根如何处理 家中的盆栽绿萝出现烂根怎么处理 绿萝根茎烂了一碰就掉怎么办? 发现家养绿萝烂根了,有什么方法可以救它吗? 绿萝烂根是什么原因 linux 挂载磁被清空 怎么恢复 服务器LINUX系统组建RAID 1究意是不是两个硬盘都要... 磁盘修复命令 linux怎么用awk和sed删除文本中只有一列的行? rhel server5系统启动时默认由以下哪个系统引导程... 关于GHOST... 如何备份,什么软件好用 苹果11promax比苹果13少了哪些功能 红豆杉果实怎么保存 请问红豆和麦冬的种子如何保存? 红豆沙太甜怎么办.? 红豆有保质期吗 中国红豆果有何功效?如何食用? 红豆沙的果子能吃吗?会中毒吗? 蜜红豆的保存方法,都有什么? 红豆杉果子有什么作用? 红豆沙果吃了有什么好处 红豆沙果实和什么泡酒 什么是留学生免税车? 归国留学生免税车政策