copy-in/copy-out

The guestfish copy-in command is a useful way to recursively copy files and directories into a disk image or virtual machine:

$ guestfish -N fs -m /dev/sda1

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

Type: 'help' for a list of commands
      'man' to read the manual
      'quit' to quit the shell

><fs> copy-in fuse /
><fs> ll /
total 18
drwxr-xr-x  4 root root  1024 Sep 10 09:03 .
drwxr-xr-x 20  500  500  4096 Sep 10 09:03 ..
drwxrwxr-x  4  500  500  1024 Sep  9 23:24 fuse
drwx------  2 root root 12288 Sep 10 09:03 lost+found
><fs> ll /fuse/
total 1549
drwxrwxr-x 4  500  500    1024 Sep  9 23:24 .
drwxr-xr-x 4 root root    1024 Sep 10 09:03 ..
drwxrwxr-x 2  500  500    1024 Sep  9 23:24 .deps
drwxrwxr-x 2  500  500    1024 Sep  9 23:24 .libs
-rw-rw-r-- 1  500  500   50999 Sep  9 23:15 Makefile
-rw-rw-r-- 1  500  500    2192 Aug 25 11:30 Makefile.am
-rw-rw-r-- 1  500  500   59337 Sep  9 23:14 Makefile.in
-rw-rw-r-- 1  500  500    9822 Aug  3 13:58 dircache.c
-rw-rw-r-- 1  500  500    1859 Aug  3 13:58 dircache.h
-rwxrwxr-x 1  500  500    6482 Sep  9 23:24 guestmount
-rw-rw-r-- 1  500  500   35472 Sep  9 23:24 guestmount-dircache.o
-rw-rw-r-- 1  500  500   77768 Sep  9 23:24 guestmount-guestmount.o
-rw-rw-r-- 1  500  500   11165 Aug 17 10:48 guestmount.1
-rw-rw-r-- 1  500  500   28141 Aug 27 13:36 guestmount.c
-rw-rw-r-- 1  500  500    1821 Aug  3 13:58 guestmount.h
-rw-rw-r-- 1  500  500    6033 Aug  3 13:58 guestmount.pod
-rwxrwxr-x 1  500  500 1269016 Sep  1 18:43 guestmount.static
-rwxrwxr-x 1  500  500    5931 Aug  3 13:58 test-fuse.sh

copy-out recursively copies files or directories out of a disk image or virtual machine:


$ guestfish --ro -i -c qemu:///system -d CentOS5x32

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

Type: 'help' for a list of commands
      'man' to read the manual
      'quit' to quit the shell

Operating system: CentOS release 5.4 (Final)
/dev/VolGroup00/LogVol00 mounted on /
/dev/vda1 mounted on /boot

><fs> lcd /tmp
><fs> copy-out /home .

1 Comment

Filed under Uncategorized

One response to “copy-in/copy-out

  1. Pingback: New in guestfish 1.5.15: “list-filesystems” « Richard WM Jones

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s