libguestfs手册(3): virt命令
guestmount
root# guestmount -a ubuntutest1.img -m /dev/sda1 ubuntutestp1
root# cd ubuntutestp1/
root:/home/cliu8/images/ubuntutestp1# ls
a b c d hello lost+found world
root:/home/cliu8/images/ubuntutestp1# ps aux | grep guest
root 31067 2.5 0.1 2895156 90544 pts/0 Sl 22:05 0:02 /usr/bin/qemu-system-x86_64 -global virtio-blk-pci.scsi=off -nodefconfig -enable-fips -nodefaults -nographic -machine accel=kvm:tcg -m 500 -no-reboot -rtc driftfix=slew -no-hpet -no-kvm-pit-reinjection -kernel /var/tmp/.guestfs-0/kernel.31058 -initrd /var/tmp/.guestfs-0/initrd.31058 -device virtio-scsi-pci,id=scsi -drive file=ubuntutest1.img,cache=writeback,id=hd0,if=none -device scsi-hd,drive=hd0 -drive file=/var/tmp/.guestfs-0/root.31058,snapshot=on,id=appliance,cache=unsafe,if=none -device scsi-hd,drive=appliance -device virtio-serial-pci -serial stdio -device sga -chardev socket,path=/tmp/libguestfsgJ82Aq/guestfsd.sock,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 -append panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 TERM=linux
root 31092 0.0 0.0 91024 1688 ? Ss 22:05 0:00 guestmount -a ubuntutest1.img -m /dev/sda1 ubuntutestp1
root:/home/cliu8/images# guestunmount ubuntutestp1
root:/home/cliu8/images# ps aux | grep guest
root 31477 0.0 0.0 10464 920 pts/0 S+ 22:09 0:00 grep --color=auto guest
virt-builder
Virt-builder is a tool for quickly building new virtual machines. You can build a variety of VMs for local or cloud use, usually within a few minutes or less. Virt-builder also has many ways to customize these VMs. Everything is run from the command line and nothing requires root privileges, so automation and scripting is simple.
List the virtual machines available
# virt-builder --list
centos-6 CentOS 6.5
centos-7.0 CentOS 7.0
cirros-0.3.1 CirrOS 0.3.1
debian-6 Debian 6 (Squeeze)
debian-7 Debian 7 (Wheezy)
fedora-18 Fedora庐 18
fedora-19 Fedora庐 19
fedora-20 Fedora庐 20
rhel-7rc Red Hat Enterprise Linux庐 7 Release Candidate
scientificlinux-6 Scientific Linux 6.5
ubuntu-10.04 Ubuntu 10.04 (Lucid)
ubuntu-12.04 Ubuntu 12.04 (Precise)
ubuntu-14.04 Ubuntu 14.04 (Trusty)
Build a virtual machine
virt-builder fedora-20
virt-builder fedora-20 -o mydisk.img
virt-builder fedora-20 --format qcow2
virt-builder fedora-20 --size 20G
Setting the root password
virt-builder fedora-20 --root-password file:/tmp/rootpw
Set the hostname
virt-builder fedora-20 --hostname virt.example.com
Installing software
virt-builder fedora-20 --install "inkscape,@Xfce Desktop"
Customizing the installation
cat <<'EOF' > /tmp/yum-update.sh
yum -y update
EOF
virt-builder fedora-20 --firstboot /tmp/yum-update.sh
virt系列
root:/home/cliu8/images# virt-ls -a ubuntutest.img /home/openstack
.bash_history
.bash_logout
.bashrc
.cache
.profile
sdb
testupload
root:/home/cliu8/images# while true; do sleep 1; ps aux | grep guest; done;
root 2381 0.0 0.0 10464 920 pts/22 S+ 22:21 0:00 grep --color=auto guest
root 2392 22.0 0.0 938600 25116 pts/0 Sl+ 22:21 0:00 /usr/bin/qemu-system-x86_64 -global virtio-blk-pci.scsi=off -nodefconfig -enable-fips -nodefaults -nographic -machine accel=kvm:tcg -m 500 -no-reboot -rtc driftfix=slew -no-hpet -no-kvm-pit-reinjection -kernel /var/tmp/.guestfs-0/kernel.2383 -initrd /var/tmp/.guestfs-0/initrd.2383 -device virtio-scsi-pci,id=scsi -drive file=ubuntutest.img,snapshot=on,cache=writeback,id=hd0,if=none -device scsi-hd,drive=hd0 -drive file=/var/tmp/.guestfs-0/root.2383,snapshot=on,id=appliance,cache=unsafe,if=none -device scsi-hd,drive=appliance -device virtio-serial-pci -serial stdio -device sga -chardev socket,path=/tmp/libguestfsxG2Amp/guestfsd.sock,id=channel0 -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 -append panic=1 console=ttyS0 udevtimeout=600 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 TERM=linux
root 2417 0.0 0.0 10464 920 pts/22 S+ 22:21 0:00 grep --color=auto guest
root 2426 0.0 0.0 10464 924 pts/22 S+ 22:21 0:00 grep --color=auto guest
virt-cat(1) — display a file
virt-copy-in(1) — copy files and directories into a VM
virt-copy-out(1) — copy files and directories out of a VM
virt-customize(1) — customize virtual machines
virt-df(1) — free space
virt-diff(1) — differences
virt-edit(1) — edit a file
virt-filesystems(1) — display information about filesystems, devices, LVM
virt-format(1) — erase and make blank disks
virt-inspector(1) — inspect VM images
virt-list-filesystems(1) — list filesystems
virt-list-partitions(1) — list partitions
virt-log(1) — display log files
virt-ls(1) — list files
virt-make-fs(1) — make a filesystem
virt-rescue(1) — rescue shell
virt-resize(1) — resize virtual machines
virt-sparsify(1) — make virtual machines sparse (thin-provisioned)
virt-sysprep(1) — unconfigure a virtual machine before cloning
virt-tar(1) — archive and upload files
virt-tar-in(1) — archive and upload files
virt-tar-out(1) — archive and download files
virt-win-reg(1) — export and merge Windows Registry keys
libguestfs手册(3): virt命令的更多相关文章
- libguestfs手册(2):guestfish command
添加一个drive:guestfs_add_drive_opts add-drive filename [readonly:true|false] [format:..] [iface:..] [na ...
- libguestfs手册(1): 架构
要编辑一个image,则运行下面的命令 guestfish -a ubuntutest.img ><fs> 会弹出一个命令行工具 运行run ><fs> run 我 ...
- VI使用手册(常见命令)
VI使用手册 模式切换 i键开始进入编辑模式,Esc进入一般模式,保存退出:wq,不保存退出q,强制退出q! 如何定位到行文档首位,行首位? gg或者1G命令将光标移动到文档开头G命令将光标移动到文档 ...
- MySQL命令大全:MySQL常用命令手册、MySQL命令行大全、查询工具
1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root ...
- git 命令参考手册 git中文命令参考手册大全
git init # 初始化本地git仓库(创建新仓库)git config --global user.name "xxx" # 配置用户名git config --global ...
- nginx使用手册--nginx的命令行参数
nginx的命令行参数 -? 或者 -h 打印命令行参数帮助信息 -c file 为 Nginx 指定一个配置文件,来代替缺省的. -t 不运行,而仅仅测试配置文件.nginx 将检查配置文件的语法的 ...
- 容器化-Docker-1-速查手册-Docker常用命令
目录 备注 常用命令 Docker镜像管理(操作对象是镜像) Docker容器管理(操作对象是容器) 容器外挂目录(宿主目录映射到容器中) 这篇文章的目的就是把最常用的命令列出来,没时间看速查命令使用 ...
- GIT权威手册及常用命令用法
http://git-scm.com/book/zh Git Stash用法 http://www.cppblog.com/deercoder/archive/2011/11/13/160007.ht ...
- 别以为真懂Openstack: 虚拟机创建的50个步骤和100个知识点(3)
四.Nova-compute 步骤17:nova-compute接收到请求后,通过Resource Tracker将创建虚拟机所需要的资源声明占用 步骤18:调用Neutron API配置Networ ...
随机推荐
- python正则表达式--分组、后向引用、前(后)向断言
无名.有名分组 (1)正则表达式—无名分组 从正则表 达式的左边开始看,看到的第一个左括号“(”表示表示第一个分组,第二个表示第二个分组, 依次类推. 需要注意的是,有一个隐含的全局分组(就是索引号为 ...
- js 字符串切割
对于字符串的切割截取平时所用可能不是特别多,而且分的比较细,所以自备自查.有备无患. 由于之前所有均在一个demo测试,若是哪里打错了,敬请谅解.一些其余属性找时间继续添加. 1.函数:split() ...
- JS监听浏览器的返回、后退、上一页按钮的事件方法
在实际的应用中,我们常常需要实现在移动app和浏览器中点击返回.后退.上一页等按钮实现自己的关闭页面.调整到指定页面或执行一些其它操作的需求,那在代码中怎样监听当点击微信.支付宝.百度糯米.百度钱包等 ...
- lombok @Accessors用法
@Accessors 翻译是存取器.通过该注解可以控制getter和setter方法的形式. fluent 若为true,则getter和setter方法的方法名都是属性名,且setter方法返回当前 ...
- FreeRTOS 启动进程调度后,程序卡死的部分原因分析。
现象:1,RTOS 使用时 系统卡启动文件 B .处. 原因分析:该种情况是由于定义开启了中断,但是未开启中断处理服务.程序执行到中断响应式无对应的程序响应 ...
- 第三次java作业
编写“学生”类及其测试类. 5.1 “学生”类: ² 类名:Student ² 属性:姓名.性别.年龄.学号.5门课程的成绩 ² 方法1:在控制台输出各个属性的值. ² 方法2:计算平均成绩 ² 方法 ...
- .NET英文技术文章导读(2017-03-23)
关键字:VS2017.扩展.Service Fabric.Unit Test.ELMAH Web开发人员必装的5个VS2017扩展 作者:Jeffrey T. Fritz 链接:https://blo ...
- 在SSL / https下托管SignalR
https://weblog.west-wind.com/posts/2013/Sep/23/Hosting-SignalR-under-SSLhttps 2013年9月23日•来自毛伊岛,HI• ...
- C&C++ Calling Convention
tkorays(tkorays@hotmail.com) 调用约定(Calling Convention) 是计算机编程中一个比较底层的设计,它主要涉及: 函数参数通过寄存器传递还是栈? 函数参数从左 ...
- Shell编程-条件测试 | 基础篇
什么是Shell Shell是一个命令解释器,它会解释并执行命令行提示符下输入的命令.除此之外,Shell还有另一个功能,如果要执行多条命令,它可以将这组命令存放在一个文件中,然后可以像执行Linux ...