libguestfs modifying a guest image

Here we have a virtual machine image (test1.img) that contains an MBR-style partition with an ext2 filesystem on the first partition, and we create a file /hello on that filesystem. For more explanation see this posting. Very experimental code is in this git repository. Note that we aren’t building or running any of this as root.

$ guestfish 

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help with commands
      'quit' to quit the shell

><fs> help
    Command         Description
help            display a list of commands or help on a command
quit            quit guestfish
add             add a guest image to be examined or modified
cdrom           add a CD-ROM image to be examined
launch          launch the subprocess
mount           mount a guest disk at a position in the filesystem
sync            sync disks, writes are flushed through to the disk image
touch           update file timestamps or create a new file
    Use -h <cmd> / help <cmd> to show detailed help for a command.
><fs> add test1.img
><fs> launch
><fs> mount /dev/sda1 /
><fs> touch /hello
><fs> sync
><fs> exit

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.