From 8e2b920fe67d859399945910f8a55209586865c8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 1 Mar 2013 16:25:41 +0000 Subject: [PATCH] FAQ: Add question about running fsck on live filesystems. --- examples/guestfs-faq.pod | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/examples/guestfs-faq.pod b/examples/guestfs-faq.pod index a6408ea7a..cf6703fe9 100644 --- a/examples/guestfs-faq.pod +++ b/examples/guestfs-faq.pod @@ -695,12 +695,6 @@ can't easily do with libguestfs. =end html -=head2 Can I use C as a way to backup my virtual machines? - -Usually this is not a good idea. The question is answered in more -detail in this mailing list posting: -L - =head2 Why can I write to the disk, even though I added it read-only? =head2 Why does C<--ro> appear to have no effect? @@ -737,6 +731,37 @@ In guestfish, if you use the C command, then disk is added read-write (unless you specify the C flag explicitly with the command). +=head2 Can I use C as a way to backup my virtual machines? + +Usually this is I a good idea. The question is answered in more +detail in this mailing list posting: +L + +See also the next question. + +=head2 Why can't I run fsck on a live filesystem using C? + +This command will usually I work: + + guestfish --ro -a /dev/vg/my_root_fs run : fsck /dev/sda + +The reason for this is that qemu creates a snapshot over the original +filesystem, but it doesn't create a strict point-in-time snapshot. +Blocks of data on the underlying filesystem are read by qemu at +different times as the fsck operation progresses, with host writes in +between. The result is that fsck sees massive corruption (imaginary, +not real!) and fails. + +What you have to do is to create a point-in-time snapshot. If it's a +logical volume, use an LVM2 snapshot. If the filesystem is located +inside something like a btrfs/ZFS file, use a btrfs/ZFS snapshot, and +then run the fsck on the snapshot. In practice you don't need to use +libguestfs for this -- just run C directly. + +Creating point-in-time snapshots of host devices and files is outside +the scope of libguestfs, although libguestfs can operate on them once +they are created. + =head2 What's the difference between guestfish and virt-rescue? A lot of people are confused by the two superficially similar tools we