日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

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

發布時間:2025/4/9 linux 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 怎样调整XenServer下面Linux虚拟机的磁盘大小 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

  • 登錄到XenServer。
  • 修改虛擬機磁盤大小
    修改storage 磁盤大小
  • 啟動虛擬機
  • 修改分區大小
    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
  • 或者?lvextend -l +100%FREE /dev/cl/root
  • ? 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
  • 或者??xfs_growfs /dev/mapper/cl-root
    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
    任務完成
  • 遇到的問題
    linux系統為centos7 時, 用 resize2fs 命令出現報錯 resize2fs: Bad magic number in super-block while trying to open
    xfs_growfs /dev/root_vg/root 用 xfs_growfs 代替命令 resize2fs

  • 轉載于:https://www.cnblogs.com/weifeng1463/p/8421773.html

    總結

    以上是生活随笔為你收集整理的怎样调整XenServer下面Linux虚拟机的磁盘大小的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。