虚拟设备管理

[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
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐于技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值