virt-copy-in(1)

πŸ’– virt-copy-in β€” bestie edition ✨

okay so welcome to virt-copy-in(1) from the libguestfs fam πŸŽ€ β€” the little tool that yeets files from your laptop straight into a virtual machine's disk image. iykyk.

🌸 NAME 🌸

virt-copy-in β€” copy files and directories into a virtual machine disk image. that's it. that's the whole job. slay. πŸ’…

✨ SYNOPSIS ✨

 virt-copy-in -a disk.img file|dir [file|dir ...] /destination

 virt-copy-in -d domain file|dir [file|dir ...] /destination

two vibes, same energy: point it at a raw disk image with -a, or at a named libvirt domain with -d. πŸ¦‹

πŸ’€ WARNING πŸ’€

bestie. listen to me. running virt-copy-in on live virtual machines, or at the same time as other disk editing tools, is genuinely dangerous and can corrupt your disk. not cute. not slay. 😭 the VM must be shut down before you use this command, and disk images must not be edited concurrently. no cap.

🌈 DESCRIPTION 🌈

virt-copy-in copies files and directories from your local disk into a virtual machine disk image β€” or into a named libvirt domain. πŸ’–

you can hand it one or more filenames and directories on the command line, and directories get copied in recursively (the way that it just keeps going, obsessed). the final parameter has to be the destination directory inside the disk image, and it must be an absolute path starting with a / character. periodt. ⭐


πŸ“ EXAMPLES πŸ“

update /etc/resolv.conf in a guest

 virt-copy-in -d MyGuest resolv.conf /etc

upload a home directory to a guest

 virt-copy-in -d MyGuest skel /home

both iconic, both take two seconds, both make you look like you know what you're doing 🫢


🧚 JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH 🧚

real talk: this command is literally just a simple shell script wrapper around the guestfish(1) copy-in command. that's the whole tea β˜•. so if you want to do anything more complex than a trivial copy, you're probably better off using guestfish directly β€” she has range, she has main character energy, she can do it all. πŸ‘‘


πŸ”₯ OPTIONS πŸ”₯

since the shell script just passes options straight to guestfish, go read guestfish(1) to see the full list of options. i'm not gatekeeping β€” there's just literally nothing extra here, the whole flag menu lives over there. πŸ’œ

  • -a disk.img β€” point at a disk image (straight from the synopsis, bestie)
  • -d domain β€” point at a named libvirt domain instead

and for everything else: guestfish(1). fr fr.


πŸŽ€ SEE ALSO πŸŽ€

the whole friend group πŸ’–


πŸ‘‘ AUTHORS πŸ‘‘

Richard W.M. Jones (rjones at redhat dot com) β€” the icon who wrote it ✨

Copyright (C) 2011-2025 Red Hat Inc.

πŸ¦‹ LICENSE πŸ¦‹

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

(translation: it's free, it's open, and if it breaks, it breaks without a warranty β€” read the actual license for the real legal tea 😌)


πŸ™ˆ BUGS πŸ™ˆ

got a bug to report? here's where to go:

to get a list of bugs against libguestfs:

https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

to report a new bug against libguestfs:

https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

when reporting a bug, please supply:

  • The version of libguestfs.
  • Where you got libguestfs (eg. which Linux distro, compiled from source, etc)
  • Describe the bug accurately and give a way to reproduce it.
  • Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.

(that last one matters β€” paste it complete and unedited, no filtering, no "i cleaned it up for you" πŸ’€)


<div align="center">β€” πŸ’– xoxo, this page was brought to you by libguestfs-1.61.3, dated 2026-09-16 β€” go copy some files into a VM, bestie, you got this πŸŽ€βœ¨</div>

πŸ“¦ where this page comes from