您的位置:首页 > 产品设计 > UI/UE

guestfish 命令修改镜像文件

2016-06-07 14:13 537 查看
http://libguestfs.org/guestfish.1.html guestfish命令使用方法详解

此操作在centos7进行

1、安装guestfish 命令

[root@localhost etc]# yum install guestfish

Your transaction was saved, rerun it with:

yum load-transaction /tmp/yum_save_tx.2016-05-28.00-34._SrfSu.yumtx

[root@localhost etc]# yum load-transaction /tmp/yum_save_tx.2016-05-28.00-34._SrfSu.yumtx

Installed:

libguestfs-tools-c.x86_64 1:1.28.1-1.55.el7.centos.4

Dependency Installed:

hexedit.x86_64 0:1.2.13-5.el7 libconfig.x86_64 0:1.4.9-5.el7

Complete!

[root@localhost etc]# guest

guestfish guestmount guestunmount

安装完成后有三个命令!

2、用root用户挂载这个镜像为可读可写模式

[root@localhost ~]#guestfish --rw -a cirros-0.3.4-x86_64-uec.tar.gz

Welcome to guestfish, the guest filesystem shell for

editing virtual machine filesystems and disk images.

Type: 'help' for help on commands

'man' to read the manual

'quit' to quit the shell

><fs>

进入了 guestfish 会话

在做任何操作之前,必须先在 guestfish提示符运行run命令。它会启动一个虚拟机,用于完成我们所以的对文件的操作。

><fs>run

libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock':
No such file or directory

libguestfs: error: could not connect to libvirt (URI = qemu:///system): Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
源码安装libvirt:
 http://www.mamicode.com/info-detail-247948.html 
[root@localhost ~]# wget http://libvirt.org/sources/libvirt-1.2.5.tar.gz 
通过list-filesystems命令,我们可查看镜像内的文件系统列表:

[code]><fs> list-filesystems


未完待续。。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: