Posted: . At: 10:16 AM. This was 6 years ago. Post ID: 12002
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to unpack a Live CD image on Linux.


Unpacking a Live CD on Linux is very easy, if the user wants the files within the Live disc and is running Linux.

Firstly, install the 7zip software.

sudo apt-get install p7zip-full

Now copy a Live CD ISO to an empty directory and run this command.

7z x Fedora-Workstation-Live-x86_64-27-1.6.iso

This will unpack the files to the directory.

This is what I ended up with.

jason@Yog-Sothoth:~/fedora$ ls -hula
total 1.6G
drwxrwxr-x  7 jason jason 4.0K Mar 28 07:56 .
drwxr-xr-x 57 jason jason 4.0K Mar 28 07:54 ..
drwx------  2 jason jason 4.0K Mar 28 07:56 [BOOT]
drwx------  3 jason jason 4.0K Mar 28 07:56 EFI
-rw-rw-r--  1 jason jason 2.5K Mar 28 07:56 Fedora-Legal-README.txt
-rw-rw-r--  1 jason jason 1.6G Mar 28 07:56 Fedora-Workstation-Live-x86_64-27-1.6.iso
drwx------  3 jason jason 4.0K Mar 28 07:56 images
drwx------  2 jason jason 4.0K Mar 28 07:56 isolinux
-rw-rw-r--  1 jason jason 1.1K Mar 28 07:56 LICENSE
drwx------  2 jason jason 4.0K Mar 28 07:56 LiveOS
-rw-rw-r--  1 jason jason  454 Mar 28 07:56 TRANS.TBL

In the LiveOS directory is the squashfs filesystem, this contains the files actually used by the live operating system.

Mount this to a directory under /mnt, and it can be explored.

sudo mount -t squashfs squashfs.img /mnt/contents/

In my case, it contained a rootfs.img.

jason@Yog-Sothoth:/mnt/contents/LiveOS$ ls -hula
total 4.4G
drwxrwxr-x. 2 root root   33 Nov  5 18:36 .
drwxrwxr-x. 3 root root   29 Nov  5 18:36 ..
-rw-rw-r--. 1 root root 6.6G Nov  5 18:36 rootfs.img

I extracted this file to my ~/fedora directory and then, as it was loopfs, I mounted it like this.

sudo mount -o loop rootfs.img /mnt/contents/

Then I could explore the contents.

jason@Yog-Sothoth:/mnt/contents$ ls -hula
total 92K
dr-xr-xr-x.  18 root root 4.0K Mar 28 08:41 .
drwxr-xr-x    5 root root 4.0K Mar 28 08:04 ..
lrwxrwxrwx.   1 root root    7 Nov  5 18:29 bin -> usr/bin
dr-xr-xr-x.   6 root root 4.0K Nov  5 18:36 boot
drwxr-xr-x.   2 root root 4.0K Nov  5 18:28 dev
drwxr-xr-x. 133 root root  12K Nov  5 18:35 etc
drwxr-xr-x.   2 root root 4.0K Nov  5 18:35 home
lrwxrwxrwx.   1 root root    7 Nov  5 18:29 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 Nov  5 18:29 lib64 -> usr/lib64
drwx------.   2 root root  16K Nov  5 18:35 lost+found
drwxr-xr-x.   2 root root 4.0K Nov  5 18:35 media
drwxr-xr-x.   2 root root 4.0K Nov  5 18:35 mnt
drwxr-xr-x.   2 root root 4.0K Nov  5 18:36 opt
drwxr-xr-x.   2 root root 4.0K Nov  5 18:28 proc
dr-xr-x---.   2 root root 4.0K Nov  5 18:35 root
drwxr-xr-x.   2 root root 4.0K Nov  5 18:35 run
lrwxrwxrwx.   1 root root    8 Nov  5 18:29 sbin -> usr/sbin
drwxr-xr-x.   2 root root 4.0K Nov  5 18:35 srv
drwxr-xr-x.   2 root root 4.0K Nov  5 18:28 sys
drwxrwxrwt.  10 root root 4.0K Nov  5 18:36 tmp
drwxr-xr-x.  12 root root 4.0K Nov  5 18:35 usr
drwxr-xr-x.  22 root root 4.0K Nov  5 18:35 var

This is how easy it is to extract and view the contents of a Live CD ISO and extract files. Very useful Linux trick.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.