extract files from filesystem.squashfs file

5,544

From your overall question, and comments like:

  • i ran a diskless virtual machine with an iso as a "cd drive", and booted from the "cd".

It sounds to me like you may have only been running "live" with no persistence. Especially given the iso in the VM's "cd drive", I'm suspecting there might not be any saved files to recover, unless the VM saved them somehow...

But, maybe using a USB it did let you save persistent data. If there is a casper-rw file then you should be able to mount it and take a look, as Eric's comment suggests, with

mkdir /tmp/casper
sudo mount -o loop /path/to/casper-rw /tmp/casper
Share:
5,544

Related videos on Youtube

Reuven Karasik
Author by

Reuven Karasik

Updated on September 18, 2022

Comments

  • Reuven Karasik
    Reuven Karasik almost 2 years

    I have installed Xubuntu on a USB stick and created some files. Later there was a problem with Xubuntu, so I made a backup and re-installed it.

    The wayt I made the backup, isn't exacly the right way of doing it (I'm not so familiar with this subject :) ):

    I cnnected the USB stick to a running Windows computer and just copied all the files I found there form the USB stick ("My Computer") to the windows computer.

    The files I copied are some folders (e.g. .disk, boot, casper, dists, EFI and some more.) and some files (e.g. casper-rw, md5sum.txt, menu.c32, README.diskdefines, syslinux.cfg and more.)

    Now I want to recover some files from my desktop in Xubuntu in order to edit them in Windows or even linux.

    I notices in the folder casper there are few files:

    • filesystem.manifest
    • filesystem.manifest-remove
    • filesystem.size
    • filesystem.squashfs
    • initrd.lz
    • vmlinuz.efi

    The biggest file there, filesystem.squashfs, weights almost 1 GB, so I have a reason to beleive that this file contains my files from Xubuntu.

    How can I exctract them? I can use linux (I have a new, working version of Xubuntu on the same USB stick, while the "backup" is located on the C drive of the hosting computer)

    Thanks!!

    • Rinzwind
      Rinzwind over 9 years
      Basically you need to mount the file. Please read tldp.org/HOWTO/SquashFS-HOWTO/whatis.html and then unix.stackexchange.com/questions/80305/…
    • Reuven Karasik
      Reuven Karasik over 9 years
      Thanks! I installed the squashfs tools and I'm trying this right now. It takes a lot of time, (157627 files ;) ) but from what I can see now, it looks just like what I needed. Thank you so much! I'll update you when it's over.
    • Reuven Karasik
      Reuven Karasik over 9 years
      ... :'( the home folder is empty... Perhaps the file I found is... Some sort of initial backup the installer created automatically. Perhaps there's a different file which actually has my files?
    • Xen2050
      Xen2050 over 9 years
      How did you "install" onto the USB? I usually see filesystem.squashfs as part of the live ISO, and "casper" part of the persistent feature, I think casper-rw used to be the "filesystem in a file" that stored your changed/personal files...
    • Eric Carvalho
      Eric Carvalho over 9 years
      The files you create in a LiveUSB are saved in the casper-rw file.
    • Eric Carvalho
      Eric Carvalho over 9 years
    • Reuven Karasik
      Reuven Karasik over 9 years
      Xen2050- i ran a diskless virtual machine with an iso as a "cd drive", and booted from the "cd".
    • Reuven Karasik
      Reuven Karasik over 9 years
      Eric Carvalho - looks like what I need... I'll check it out soon
  • Xen2050
    Xen2050 over 9 years
    Ok. Then it should be in the files you copied, you mentioned "some files (e.g. casper-rw,..."
  • Reuven Karasik
    Reuven Karasik over 9 years
    Dude, you saved my life! It's amazing! always fun to learn something new :)
  • Reuven Karasik
    Reuven Karasik over 9 years
    Actually... hold on.. I copied the files, they contain ry_Certification_Authority_-_G3.crt, mozilla/GeoTrust_Universal_CA.crt, mozilla/GeoTrust_Universal_CA_2.crt, mozilla/GlobalSign_Root_CA.crt, mozilla/GlobalSign_Root_CA_-_R2.crt, mozilla/GlobalSign_Root_.... WHY???
  • Reuven Karasik
    Reuven Karasik over 9 years
    I guess it's my fault, because the XFCE config files were recovered correctly... I don't know why it happened to these files, but fine. thanks again! Next time I'll know not to create files on linux without Dropbox or some other automatic backup services.
  • Xen2050
    Xen2050 over 9 years
    Always best to have a good backup of important data (on a hard drive, another USB/DVD, online... encrypted is good too)