Solved Extract home directory from an ISO

Solved issue

LinuxHub

New Member
Joined
Apr 8, 2024
Messages
14
Reaction score
2
Credits
143
I have searched around and found ways to mount the iso. But my goal is to extract the home folder. Is this possible? This is for an Arch based ISO.
These are the only folders I see when I mount the ISO:
arch boot EFI shellia32.efi shellx64.efi
Thanks
 


The short answer to the query about the home directory in the arch iso, is that there is none to extract. In this case, using the iso: archlinux-2024.05.01-x86_64.iso, since you mentioned arch.

To demonstrate that that is the case, you can list all the files from the mount point on the mounted iso with the command:
Code:
ls -R
Or it's possible to search directly for "home", without seeing all the files on screen, with a command like:
Code:
ls -R | grep -i home
There is no file with the name home in the arch iso.

For a deeper search, you could extract the contents of the initramfs image file which you would be able to find from an inspection of the output of the above command: ls -R. Run a command such as the following:
Code:
lsinitramfs -l /mnt/arch/boot/x86_64/initramfs-linux.image > /home/<user>/initramfsContents
which has the lsinitramfs command sending its contents to a file in the user's home directory since the output is large, and it's easier to inspect it all in a file rather than on the terminal screen.

Within that file is a list of the files and directories used to create the initial linux system that will be used to create the more fully featured installed system which the installer creates upon its successful completion.

Once again, there is no home to be found.

The home directory is usually created by the installer when the root filesystem is set up during installation, and if there is a partitioner, it will allow the user to configure it. The home directory will however, not contain anything, so there will be nothing to see. When a user is created on the system either by the installer, or post installation, then some files may appear in the /home directory such as a user's directory under a user name, and then perhaps some standard directories and files in the user's now home directory.

The upshot is that there is no home in the iso to extract, and it's only after full installation that one may or may not appear, but usually does appear.
 
In this case I created the ISO myself so I know the files are there somewhere. My internet is limited so it is a long shot for me to just extra the files from my fileserver instead of the entire iso. My internet will be fixed in a few days so I may just have to play the waiting game. But I will give this a shot and report if it works or not for future enquirerers. Thanks for the helpful response.
lsinitramfs -l /mnt/arch/boot/x86_64/initramfs-linux.image > /home/<user>/initramfsContents
 
In this case I created the ISO myself so I know the files are there somewhere. My internet is limited so it is a long shot for me to just extra the files from my fileserver instead of the entire iso. My internet will be fixed in a few days so I may just have to play the waiting game. But I will give this a shot and report if it works or not for future enquirerers. Thanks for the helpful response.
Thanks for that extra info about creating your own iso. It makes a difference. The inspection of the iso as described in post #2 won't find a home to extract, but as mentioned, the home directory will be created when the root file system is set up.

When that final main root filesystem is set by the end of a successful installation, it's usually the result of the small linux system from the initramfs changing from its small root filesystem to that main one. That main root filesystem in the arch iso used as an example in post #1 is in a squashfs filesystem at
/mnt/arch/x86_64/airootfs.sfs. To see what is in that main root filesystem, one needs to unsquash it and place the contents in a directory since it's a large output. For example, a command such as the following will extract the contents to a directory, named here as <some-directory>:
Code:
unsquashfs -d <some-directory>/  /mnt/arch/x86_64/airootfs.sfs
given that the iso is mounted at /mnt on a loop device.
The package: squashfs-tools contains the commands to manipulate squashfs files.

Then an inspection of the directory <some-directory>, will show the filesystem with a /home directory. There's nothing in it in the arch iso, however, since you made your own iso, and included files to be in the /home directory, they are likely to have been placed inside the /home directory in the squashfs by the software that you have used to create the iso. Without knowing the software you have used, what I have described is not uncommon.
 
Last edited:
Yup, That is what I was looking for. Thank You!
some helpful tips on the matter on methods I used.
first I navigate to the said mount:
cd arch/boot/x86_64
then extract said img:
dd if=initramfs-linux.img of=/home/contents
cd into folder:
cd /home/contents
create a new directory:
mkdir initcontents
display contents of extracted content:
zcat contents | cpio -ivD initcontents
 
as root:
mkdir /mnt/iso
mkdir /mnt/home
mount ISO:
mount -o loop /path/to/iso/distro.iso /mnt/iso
mount live iso environment:
mount -o loop /mnt/iso/arch/x86_64/airootfs.sfs /mnt/home
from here you can copy the home folder files or any live cd files. In case anyone needs to do this in the future. This works 100%
 

Staff online

Members online


Latest posts

Top