[bootlin/training-materials updates] master: slides/sysdev-block-filesystems: how to mount partitions in a disk image (ed32f69a)

Michael Opdenacker michael.opdenacker at bootlin.com
Thu Sep 29 14:10:29 CEST 2022


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/ed32f69a4ed3b6d5a28c77475f55bfc7c5b355e3

>---------------------------------------------------------------

commit ed32f69a4ed3b6d5a28c77475f55bfc7c5b355e3
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Thu Sep 29 14:10:29 2022 +0200

    slides/sysdev-block-filesystems: how to mount partitions in a disk image
    
    Something I always show manually in my training sessions
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>


>---------------------------------------------------------------

ed32f69a4ed3b6d5a28c77475f55bfc7c5b355e3
 .../sysdev-block-filesystems.tex                   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/slides/sysdev-block-filesystems/sysdev-block-filesystems.tex b/slides/sysdev-block-filesystems/sysdev-block-filesystems.tex
index 01dbb4f6..cff01037 100644
--- a/slides/sysdev-block-filesystems/sysdev-block-filesystems.tex
+++ b/slides/sysdev-block-filesystems/sysdev-block-filesystems.tex
@@ -329,6 +329,34 @@ major minor #blocks name
   \end{itemize}
 \end{frame}
 
+\begin{frame}[fragile]
+  \frametitle{How to access partitions in a disk image}
+  \begin{itemize}
+  \item You may have dumped a complete block device (with partitions) into a disk image.
+  \item The \code{losetup} command allows to manually associate
+    a loop device to a file, and offers a \code{--partscan} option
+    allowing to also create extra block device files for the partitions
+    inside the image:
+    \begin{block}{}
+    \begin{verbatim}
+$ sudo losetup -f --show --partscan disk.img
+/dev/loop2
+
+$ ls -la /dev/loop2*
+brw-rw---- 1 root disk   7,  2 Jan 14 10:50 /dev/loop2
+brw-rw---- 1 root disk 259, 11 Jan 14 10:50 /dev/loop2p1
+brw-rw---- 1 root disk 259, 12 Jan 14 10:50 /dev/loop2p2
+\end{verbatim}
+    \end{block}{}
+  \item Each partition can then be accessed indidually, for example:
+    \begin{block}{}
+    \begin{verbatim}
+$ mount /dev/loop2p2 /mnt/rootfs
+\end{verbatim}
+    \end{block}{}
+  \end{itemize}
+\end{frame}
+
 \begin{frame}
   \frametitle{Creating squashfs filesystems}
   \begin{itemize}




More information about the training-materials-updates mailing list