a5bd9f6
From 9a3cdbccd18ddda45d3e69de75d6c4865da72aae Mon Sep 17 00:00:00 2001
a5bd9f6
From: Colin Watson <cjwatson@ubuntu.com>
a5bd9f6
Date: Thu, 3 Jan 2013 10:32:57 +0000
a5bd9f6
Subject: [PATCH 078/364] * docs/grub.texi (Invoking grub-mount): New section.
a5bd9f6
 Reported by: Filipus Klutiero.  Fixes Debian bug #666427.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog      |  5 ++++
a5bd9f6
 docs/grub.texi | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
a5bd9f6
 2 files changed, 95 insertions(+), 1 deletion(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 0585437..c91fe35 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,3 +1,8 @@
a5bd9f6
+2013-01-03  Colin Watson  <cjwatson@ubuntu.com>
a5bd9f6
+
a5bd9f6
+	* docs/grub.texi (Invoking grub-mount): New section.
a5bd9f6
+	Reported by: Filipus Klutiero.  Fixes Debian bug #666427.
a5bd9f6
+
a5bd9f6
 2013-01-02  Colin Watson  <cjwatson@ubuntu.com>
a5bd9f6
 
a5bd9f6
 	* grub-core/tests/lib/test.c (grub_test_run): Return non-zero on
a5bd9f6
diff --git a/docs/grub.texi b/docs/grub.texi
a5bd9f6
index e9af377..60b18b5 100644
a5bd9f6
--- a/docs/grub.texi
a5bd9f6
+++ b/docs/grub.texi
a5bd9f6
@@ -20,7 +20,7 @@
a5bd9f6
 This manual is for GNU GRUB (version @value{VERSION},
a5bd9f6
 @value{UPDATED}).
a5bd9f6
 
a5bd9f6
-Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012 Free Software Foundation, Inc.
a5bd9f6
+Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012,2013 Free Software Foundation, Inc.
a5bd9f6
 
a5bd9f6
 @quotation
a5bd9f6
 Permission is granted to copy, distribute and/or modify this document
a5bd9f6
@@ -37,6 +37,7 @@ Invariant Sections.
a5bd9f6
 * grub-mkconfig: (grub)Invoking grub-mkconfig.  Generate GRUB configuration
a5bd9f6
 * grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
a5bd9f6
 * grub-mkrescue: (grub)Invoking grub-mkrescue.  Make a GRUB rescue image
a5bd9f6
+* grub-mount: (grub)Invoking grub-mount.        Mount a file system using GRUB
a5bd9f6
 * grub-probe: (grub)Invoking grub-probe.        Probe device information
a5bd9f6
 @end direntry
a5bd9f6
 
a5bd9f6
@@ -101,6 +102,7 @@ This edition documents version @value{VERSION}.
a5bd9f6
 * Invoking grub-mkpasswd-pbkdf2::
a5bd9f6
                                 Generate GRUB password hashes
a5bd9f6
 * Invoking grub-mkrescue::      Make a GRUB rescue image
a5bd9f6
+* Invoking grub-mount::         Mount a file system using GRUB
a5bd9f6
 * Invoking grub-probe::         Probe device information for GRUB
a5bd9f6
 * Obtaining and Building GRUB:: How to obtain and build GRUB
a5bd9f6
 * Reporting bugs::              Where you should send a bug report
a5bd9f6
@@ -4830,6 +4832,93 @@ built-in default.
a5bd9f6
 @end table
a5bd9f6
 
a5bd9f6
 
a5bd9f6
+@node Invoking grub-mount
a5bd9f6
+@chapter Invoking grub-mount
a5bd9f6
+
a5bd9f6
+The program @command{grub-mount} performs a read-only mount of any file
a5bd9f6
+system or file system image that GRUB understands, using GRUB's file system
a5bd9f6
+drivers via FUSE.  (It is only available if FUSE development files were
a5bd9f6
+present when GRUB was built.)  This has a number of uses:
a5bd9f6
+
a5bd9f6
+@itemize @bullet
a5bd9f6
+@item
a5bd9f6
+It provides a convenient way to check how GRUB will view a file system at
a5bd9f6
+boot time.  You can use normal command-line tools to compare that view with
a5bd9f6
+that of your operating system, making it easy to find bugs.
a5bd9f6
+
a5bd9f6
+@item
a5bd9f6
+It offers true read-only mounts.  Linux does not have these for journalling
a5bd9f6
+file systems, because it will always attempt to replay the journal at mount
a5bd9f6
+time; while you can temporarily mark the block device read-only to avoid
a5bd9f6
+this, that causes the mount to fail.  Since GRUB intentionally contains no
a5bd9f6
+code for writing to file systems, it can easily provide a guaranteed
a5bd9f6
+read-only mount mechanism.
a5bd9f6
+
a5bd9f6
+@item
a5bd9f6
+It allows you to examine any file system that GRUB understands without
a5bd9f6
+needing to load additional modules into your running kernel, which may be
a5bd9f6
+useful in constrained environments such as installers.
a5bd9f6
+
a5bd9f6
+@item
a5bd9f6
+Since it can examine file system images (contained in regular files) just as
a5bd9f6
+easily as file systems on block devices, you can use it to inspect any file
a5bd9f6
+system image that GRUB understands with only enough privileges to use FUSE,
a5bd9f6
+even if nobody has yet written a FUSE module specifically for that file
a5bd9f6
+system type.
a5bd9f6
+@end itemize
a5bd9f6
+
a5bd9f6
+Using @command{grub-mount} is normally as simple as:
a5bd9f6
+
a5bd9f6
+@example
a5bd9f6
+grub-mount /dev/sda1 /mnt
a5bd9f6
+@end example
a5bd9f6
+
a5bd9f6
+@command{grub-mount} must be given one or more images and a mount point as
a5bd9f6
+non-option arguments (if it is given more than one image, it will treat them
a5bd9f6
+as a RAID set), and also accepts the following options:
a5bd9f6
+
a5bd9f6
+@table @option
a5bd9f6
+@item --help
a5bd9f6
+Print a summary of the command-line options and exit.
a5bd9f6
+
a5bd9f6
+@item --version
a5bd9f6
+Print the version number of GRUB and exit.
a5bd9f6
+
a5bd9f6
+@item -C
a5bd9f6
+@itemx --crypto
a5bd9f6
+Mount encrypted devices, prompting for a passphrase if necessary.
a5bd9f6
+
a5bd9f6
+@item -d @var{string}
a5bd9f6
+@itemx --debug=@var{string}
a5bd9f6
+Show debugging output for conditions matching @var{string}.
a5bd9f6
+
a5bd9f6
+@item -K prompt|@var{file}
a5bd9f6
+@itemx --zfs-key=prompt|@var{file}
a5bd9f6
+Load a ZFS encryption key.  If you use @samp{prompt} as the argument,
a5bd9f6
+@command{grub-mount} will read a passphrase from the terminal; otherwise, it
a5bd9f6
+will read key material from the specified file.
a5bd9f6
+
a5bd9f6
+@item -r @var{device}
a5bd9f6
+@itemx --root=@var{device}
a5bd9f6
+Set the GRUB root device to @var{device}.  You do not normally need to set
a5bd9f6
+this; @command{grub-mount} will automatically set the root device to the
a5bd9f6
+root of the supplied file system.
a5bd9f6
+
a5bd9f6
+If @var{device} is just a number, then it will be treated as a partition
a5bd9f6
+number within the supplied image.  This means that, if you have an image of
a5bd9f6
+an entire disk in @file{disk.img}, then you can use this command to mount
a5bd9f6
+its second partition:
a5bd9f6
+
a5bd9f6
+@example
a5bd9f6
+grub-mount -r 2 disk.img mount-point
a5bd9f6
+@end example
a5bd9f6
+
a5bd9f6
+@item -v
a5bd9f6
+@itemx --verbose
a5bd9f6
+Print verbose messages.
a5bd9f6
+@end table
a5bd9f6
+
a5bd9f6
+
a5bd9f6
 @node Invoking grub-probe
a5bd9f6
 @chapter Invoking grub-probe
a5bd9f6
 
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6