°¡»óÈ À̹ÌÁö ¼öÁ¤Çϴµ¥ Loop devices, kpartx, network block devices ¹æ½Ä »ç¿ëÀ» ¸¹ÀÌ ÇÏ¿´´Âµ¥ OpenStack ¿¡¼´Â guestfish ¿Í guestmount ¸¦ ÀÌ¿ëÇؼ ¼öÁ¤ÇÏ´Â ¹æ¹ýÀ» ¿ì¼±ÀûÀ¸·Î ¼Ò°³ÇÏ°í ÀÖ½À´Ï´Ù.
guestfish
The guestfish program is a tool from the libguestfs project that allows you to modify the files inside of a virtual machine image.
:: °¡»ó¸Ó½Å À̹ÌÁöµé¿¡ ÆÄÀÏÀ» ¼öÁ¤ÇØÁÖ´Â Åø
root@controller:~# apt-get install libguestfs-tools
root@controller:~# wget http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
root@controller:~# guestfish --rw -a trusty-server-cloudimg-amd64-disk1.img
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> run
100% ⟦¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ¢Æ⟧ 00:00
><fs> list-filesystems
/dev/sda1: ext4
><fs> list-filesystems
/dev/sda1: ext4
><fs> mount /dev/sda1 /
><fs> edit /etc/network/interfaces.d/eth0.cfg
><fs> exit
¡Ø Err Message
root@controller:~# guestfish --rw -a trusty-server-cloudimg-amd64-disk1.img
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> run
libguestfs: error: /usr/bin/supermin-helper exited with error status 1.
To see full error messages you may need to enable debugging.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
¾Æ·¡ ¸í·É¾î·Î ÀÇÁ¸¼º Æ®¸® ¾÷µ¥ÀÌÆ®
# update-guestfs-appliance
supermin -v -o supermin.d --names bsdmainutils btrfs-tools cryptsetup e2fsprogs extlinux genisoimage gfs-tools gfs2-tools grub-pc hfsplus iproute libaugeas0 libcap2 libhivex0 libpcre3 libyajl2 linux-image mtools nilfs-tools ntfs-3g openssh-client reiserfsprogs sysvinit ufsutils vim-tiny xz-utils zfs-fuse acl attr bash binutils bzip2 coreutils cpio diffutils dosfstools file findutils gawk gdisk grep gzip jfsutils kmod less libxml2 lsof lsscsi lvm2 lzop mdadm parted procps procps-ng psmisc rsync scrub sed strace syslinux tar udev util-linux util-linux-ng zerofree --exclude ^perl --exclude ^python --exclude ^plymouth --exclude ^linux-firmware --exclude ^kbd-misc --exclude ^file-rc
supermin 4.1.6
selected package handler: debian
packages already present:
.................
.................
unpacking /tmp/supermin3b2944ff20af759693dcec5b7cb8f424.tmp/zlib1g_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb ...
9082 files and directories
writing supermin.d/base.img ...
writing supermin.d/hostfiles ...
guestmount
root@controller:~# guestmount -a trusty-server-cloudimg-amd64-disk1.img -m /dev/sda1 --rw /mnt
root@controller:~# df |grep mnt
/dev/fuse 1386360 783360 514528 61% /mnt
¸¶¿îÆ® Æ÷ÀÎÆ®¸¦ ¸ð¸¥´Ù¸é -i(inspect) À¸·Î...
root@controller:~# guestmount -a trusty-server-cloudimg-amd64-disk1.img -i --rw /mnt
/dev/fuse 1386360 783360 514528 61% /mnt
example)
:: ÇØ´ç À̹ÌÁö³»¿¡ RPM ¼³Ä¡À¯¹« üũ
root@controller:~# rpm -qa --dbpath /mnt/var/lib/${rpm_package}
root@controller:~# umount /mnt