11

I have an Ubuntu installation backed up as a .squashfs file. I would like to extract it to the root of a partition, but when I try gives me an error saying the directory exists. I can extract just fine to non-existent directories. I've searched for information about using squashfs-tools, but can't find what commands would be used to extract to an existing location such as an empty partition.

This is the command I'm using that works for extracting to non-existent locations:

sudo unsquashfs -d /media/location1/locationthatdoesntexist /media/location2/file.squashfs

I tried using this to extract to an empty partition,but it doesn't work:

sudo unsquashfs -d /media/location1 /media/location2/file.squashfs

Source

18

The source you link to tells you what you need to do:

The tool does not extract a squashed file system on already exsisting directory unless the -f option is specified.

So this should work

sudo unsquashfs -f -d /media/location1 /media/location2/file.squashfs
| improve this answer | |
  • Tested and works. – please delete me May 1 '14 at 4:14
  • Nice one, much better answer than mine :D – MrVaykadji May 1 '14 at 21:02
10
  1. Mount the squashfs FILE.SQUASHFS :

    sudo mount -t squashfs PATH/TO/FILE.SQUASHFS /mnt
    
  2. Copy his content to DIRECTORY (must exist) :

    sudo cp -av /mnt/. PATH/TO/DIRECTORY
    
  3. Unmount the squashfs FILE.SQUASHFS :

    sudo umount /mnt
    
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.