虚拟设备管理

[root@localhost ~]# cat /etc/rc.local 
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.


touch /var/lock/subsys/local
###
/usr/bin/growpart /dev/vda 1
/usr/sbin/xfs_growfs /
/usr/bin/sed '/^###/,$d' -i /etc/rc.d/rc.local
[root@localhost ~]# [   94.391711] random: crng init done

[root@localhost ~]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk 
└─vda1 253:1    0  16G  0 part /

[root@rootroom9pc01 ~]# virsh
欢迎使用 virsh,虚拟化的交互式终端。

输入:'help' 来获得命令的帮助信息
       'quit' 退出

virsh # start node1
域 node1 已开始

virsh # lsblk
错误:未知的命令:'lsblk'
virsh # console node1
连接到域 node1
换码符为 ^]


CentOS Linux 7 (Core)
Kernel 3.10.0-693.el7.x86_64 on an x86_64

localhost login: root
Password: 
Last login: Fri Jul 20 01:11:22 on ttyS0
[root@localhost ~]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk 
└─vda1 253:1    0  16G  0 part /
[root@localhost ~]# cat /etc/rc.local 
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.


touch /var/lock/subsys/local
###
/usr/bin/growpart /dev/vda 1
/usr/sbin/xfs_growfs /
/usr/bin/sed '/^###/,$d' -i /etc/rc.d/rc.local
[root@localhost ~]# [   94.391711] random: crng init done

[root@localhost ~]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk 
└─vda1 253:1    0  16G  0 part /
[root@localhost ~]# /usr/bin/growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=33552384 end=33554432 new: size=62912479,end=62914527
[root@localhost ~]# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    253:0    0  30G  0 disk 
└─vda1 253:1    0  30G  0 part /
[root@localhost ~]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda1       16765952 1151084  15614868   7% /
devtmpfs          989700       0    989700   0% /dev
tmpfs             999588       0    999588   0% /dev/shm
tmpfs             999588    8452    991136   1% /run
tmpfs             999588       0    999588   0% /sys/fs/cgroup
tmpfs             199920       0    199920   0% /run/user/0
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        16G  1.1G   15G   7% /
devtmpfs        967M     0  967M   0% /dev
tmpfs           977M     0  977M   0% /dev/shm
tmpfs           977M  8.3M  968M   1% /run
tmpfs           977M     0  977M   0% /sys/fs/cgroup
tmpfs           196M     0  196M   0% /run/user/0
[root@localhost ~]# /usr/sbin/xfs_growfs /
meta-data=/dev/vda1              isize=512    agcount=4, agsize=1048512 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=4194048, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 4194048 to 7864059
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        30G  1.1G   29G   4% /
devtmpfs        967M     0  967M   0% /dev
tmpfs           977M     0  977M   0% /dev/shm
tmpfs           977M  8.3M  968M   1% /run
tmpfs           977M     0  977M   0% /sys/fs/cgroup
tmpfs           196M     0  196M   0% /run/user/0
 

猜你喜欢

转载自blog.csdn.net/weixin_40018205/article/details/81120287