zoukankan      html  css  js  c++  java
  • unexpected output in sfdisk --version [sfdisk,来自 util-linux 2.23.2]后端盘问题

    虚拟机两个组成部分,镜像文件和xml 配置声明文件

    1.根据后端盘做一个镜像文件

    [root@xq images]# qemu-img create -f qcow2 -b xq.qcow2 xq.img 20G   

    2.cp一个虚拟机配置声明文件

    [root@xq~]# cp node.xml /etc/libvirt/qemu/xq.xml

     1 <!--
     2 WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
     3 OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
     4   virsh edit xq
     5 or other application using the libvirt API.
     6 -->
     7 
     8 <domain type='kvm'>
     9   <name>xq</name>
    10   <uuid>1b559fbd-ecf1-41cf-8426-0a39af30a640</uuid>
    11   <memory unit='KiB'>1488282</memory>
    12   <currentMemory unit='KiB'>1488282</currentMemory>
    13   <vcpu placement='static'>2</vcpu>
    14   <os>
    15     <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
    16     <boot dev='hd'/>
    17     <bootmenu enable='yes'/>
    18     <bios useserial='yes'/>
    19   </os>
    20   <features>
    21     <acpi/>
    22     <apic/>
    23   </features>
    24   <cpu mode='host-passthrough' check='none'/>
    25   <clock offset='localtime'/>
    26   <on_poweroff>destroy</on_poweroff>
    27   <on_reboot>restart</on_reboot>
    28   <on_crash>restart</on_crash>
    29   <devices>
    30     <emulator>/usr/libexec/qemu-kvm</emulator>
    31     <disk type='file' device='disk'>
    32       <driver name='qemu' type='qcow2'/>
    33       <source file='/var/lib/libvirt/images/xq.img'/>
    34       <target dev='vda' bus='virtio'/>
    35       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    36     </disk>
    37     <controller type='usb' index='0' model='piix3-uhci'>
    38       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    39     </controller>
    40     <controller type='pci' index='0' model='pci-root'/>
    41     <controller type='virtio-serial' index='0'>
    42       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    43     </controller>
    44     <interface type='bridge'>
    45       <mac address='52:54:00:a5:57:bb'/>
    46       <source bridge='vbr'/>
    47       <model type='virtio'/>
    48       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    49     </interface>
    50     <serial type='pty'>
    51       <target port='0'/>
    52     </serial>
    53     <console type='pty'>
    54       <target type='serial' port='0'/>
    55     </console>
    56     <channel type='unix'>
    57       <target type='virtio' name='org.qemu.guest_agent.0'/>
    58       <address type='virtio-serial' controller='0' bus='0' port='1'/>
    59     </channel>
    60     <input type='mouse' bus='ps2'/>
    61     <input type='keyboard' bus='ps2'/>
    62     <memballoon model='virtio'>
    63       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    64     </memballoon>
    65   </devices>
    66 </domain>
    View Code

    [root@xq~]# virsh define /etc/libvirt/qemu/xq.xml

    [root@xq~]#virsh start xq

    [root@xq~]#ssh 192.168.1.154

    [root@localhost ~]# df -h

    文件系统 容量 已用 可用 已用% 挂载点
    /dev/vda1 2.0G 1.1G 995M 52% /
    devtmpfs 698M 0 698M 0% /dev
    tmpfs 708M 0 708M 0% /dev/shm
    tmpfs 708M 17M 691M 3% /run
    tmpfs 708M 0 708M 0% /sys/fs/cgroup
    tmpfs 142M 0 142M 0% /run/user/0

    [root@localhost ~]# lsblk

    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    vda 253:0 0 20G 0 disk
    └─vda1 253:1 0 2G 0 part /

    [root@localhost ~]# growpart  /dev/vda 1

    unexpected output in sfdisk --version [sfdisk,来自 util-linux 2.23.2]

    解决办法:定义全局变量,语言改为英文 (编码)

    export LANG=en_US.UTF-8export LANG=en_US.UTF-8

    语言可以用 echo $LANG查看(locale查语言类型)

    en_US.UTF-8

    [root@localhost ~]# growpart /dev/vda 1

    CHANGED: partition=1 start=2048 old: size=4192256 end=4194304 new: size=41940959,end=41943007

    [root@localhost~]# xfs_growfs /

    最后使用lsblk和df -h 查看磁盘情况

    扩容问题就ok了

    扩容问题也是弹性云主机的奥秘所在(通过已有资源,自己分配磁盘大小)

    改完编码还不可以试试重启机子

  • 相关阅读:
    Server.UrlEncode UrlDecode 动态绑定gridview列发送接收乱码的问题
    gridview新用法,一直不知道gridview可以这么用
    vm workstation15 迁移至ESXi6.7步骤
    http 502与504的区别
    Asp.net项目部署ActiveReport
    不能在 Page 回调中调用 Response.Redirect 解决方法
    JQuery TextExt 控件使用
    通过ashx获取JSON数据的两种方式
    jQuery Mobile对话框插件
    替换文本框title提示文本
  • 原文地址:https://www.cnblogs.com/lsgo/p/10387609.html
Copyright © 2011-2022 走看看