AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-310825

jython.li's questions

Martin Hope
jython.li
Asked: 2016-10-10 21:43:25 +0800 CST

如何在 KVM 来宾上增加根分区

  • 1

我有一个 kvm 来宾,如下,来宾磁盘/dev/vda实际上是 Host 中的一个 qcow2 文件

[root@guest ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

[root@guest ~]# uname -a
Linux guest 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@guest ~]# parted -l
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  8590MB  8589MB  primary  xfs          boot

但我只看到命令8G,df如何将根分区增加到64G?我有尝试xfs_growfs /dev/vda1,但不起作用

[root@guest ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       8.0G  1.1G  6.9G  14% /
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           1.9G   17M  1.9G   1% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           380M     0  380M   0% /run/user/0
linux xfs
  • 1 个回答
  • 1956 Views
Martin Hope
jython.li
Asked: 2016-08-03 02:07:46 +0800 CST

使用“exec 1>ok.log”时,如何在 shell 脚本中将指定的内容输出到屏幕?

  • 0

如下,我只希望命令echo "this is to stdout"输出到我的屏幕而不是文件ok.log,我该怎么办?
我搜索了execshell命令的用法,但没有结果,请指教

[root@161 tmp]# bash --version
GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.

[root@161 tmp]# cat 2.sh
#!/bin/bash
exec 1>ok.log
exec 2>error.log
#exist dir
ls /home/
#no exist dir
ls /etca/
#to stdout
echo "this is to stdout"
#other cmds
...
shell stdout exec
  • 1 个回答
  • 632 Views
Martin Hope
jython.li
Asked: 2016-06-17 23:01:35 +0800 CST

在 kvm guest 中看到的 cpu L1/L2/L3 缓存真的很重要吗?

  • 1
[root@centos7 opt]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

[root@centos7 opt]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 42
Model name:            Intel(R) Xeon(R) CPU E31220 @ 3.10GHz
Stepping:              7
CPU MHz:               1627.984
BogoMIPS:              6185.67
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-3

[root@centos7 opt]# rpm -qa |grep qemu
qemu-kvm-1.5.3-105.el7.x86_64
...

如上,Host和guest都是centos7

在 Host 中,“lscpu”将显示 L1/L2/L3 缓存信息。Guest在使用“lscpu”时也有这样的缓存信息,因为guest是作为主机标准进程实现的,我想知道在guest中看到的L1/L2/L3缓存对guest来说真的很重要吗? 在访客中缓存信息

cache kvm-virtualization
  • 2 个回答
  • 4298 Views
Martin Hope
jython.li
Asked: 2016-01-21 23:52:47 +0800 CST

如何使用 awk,sed 修改文本?

  • -1

如下,部分文字

16G    16G    1.9G    40G
4G     4G     952M    60G
16G    16G    1.6G    40G
5G     780M   5G      80G

我想将所有单位从“M”更改为“G”,就像这样

16G    16G    1.9G    40G
4G     4G     0.92G   60G
16G    16G    1.6G    40G
5G     0.76G  5G      80G

我可以用python来做,但是不知道用shell怎么实现?awk,sed,perl... 可以吗?

shell
  • 1 个回答
  • 85 Views
Martin Hope
jython.li
Asked: 2015-11-20 20:12:08 +0800 CST

如何在 kvm guest 上启用 L3 缓存?

  • 2

我在 Intel 机器(centos6.5)上启动了一个 kvm guest(centos6.5),使用 libvirt,guest 的 xml 如下

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>test-1</name>
  <uuid>9377bce1-ae83-e356-ed15-919c8625fb4b</uuid>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static' current='2'>8</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.5.0'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
    <bootmenu enable='yes'/>
    <bios useserial='yes' rebootTimeout='0'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <cpu mode='host-passthrough'>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/data/vhosts//test-1.disk'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:ea:12:d9'/>
      <source bridge='br-ex'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:env name='SPICE_DEBUG_ALLOW_MC' value='1'/>
  </qemu:commandline>
</domain>

现在我很困惑,尽管使用了“host-passthrough”,我仍然看不到guest中的L3缓存,只有L1,L2缓存,如下

[root@vm-kvm-115 results]# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 26
Stepping:              5
CPU MHz:               2266.746
BogoMIPS:              4533.49
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              4096K
NUMA node0 CPU(s):     0,1

以下是我的物理机信息

[root@host-kvm-22 linux]# rpm -qa | grep libvirt
libvirt-client-0.10.2-54.el6_7.2.x86_64
libvirt-0.10.2-54.el6_7.2.x86_64
libvirt-devel-0.10.2-54.el6_7.2.x86_64
libvirt-python-0.10.2-54.el6_7.2.x86_64

[root@host-kvm-22 linux]# rpm -qa | grep qemu
qemu-img-0.12.1.2-2.479.el6_7.2.x86_64
gpxe-roms-qemu-0.9.7-6.14.el6.noarch
qemu-kvm-0.12.1.2-2.479.el6_7.2.x86_64

[root@host-kvm-22 linux]# uname -r
2.6.32-573.8.1.el6.x86_64

[root@host-kvm-22 linux]# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 26
Stepping:              5
CPU MHz:               2266.743
BogoMIPS:              4532.68
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-3,8-11
NUMA node1 CPU(s):     4-7,12-15

谁能告诉我如何在来宾上启用 L3 缓存?

kvm-virtualization
  • 2 个回答
  • 4367 Views
Martin Hope
jython.li
Asked: 2015-09-12 08:43:15 +0800 CST

在centos6.x kvm guest 中,有什么区别 关于以下两种磁盘格式?

  • 1

我向 KVM 来宾(centos6.5)添加了一个新的虚拟硬盘 vdb,就像这样

[root@centos ~]# fdisk -l | grep vdb
Disk /dev/vdb: 8589 MB, 8589934592 bytes

然后,有两种方法可以格式化磁盘

一个。

[root@centos ~]# mkfs.ext4 /dev/vdb
[root@centos ~]# mount /dev/vdb /data/

湾。

[root@boss ~]# fdisk /dev/sdb 
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1044, default 1044): 
Using default value 1044

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos ~]# mkfs.ext4 /dev/vdb1
[root@centos ~]# mount /dev/vdb1 /data/

以上两种方式都可以,但是有什么区别呢?

hard-drive
  • 1 个回答
  • 82 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve