Make filesystem.squashfs from Ubuntu root partition as a backup so we can restore our Ubuntu and we can make Ubuntu live USB by this file.
- boot by Ubuntu live USB
- mount Ubuntu partition to
/mnt
sudo -i
mount -o ro /dev/sdax /mnt # replace x with your (ubuntu) target partition
- mount other partition to save the file
mkdir sdaz
`mount /dev/sdaz sdaz # replace z with your (non Ubuntu) partition`
- make the filesystem.squashfs
mksquashfs /mnt/* /sdaz/filesystem.squashfs
from now you have the file that will help
by my way or by rufus creat live USB by any ubuntu ISO and replace the filesystem.squashfs
in the USB with your one.
frome now you can reboot by your Ubuntu live USB
to restore your Ubuntu partition from filesystem.squashfs
, boot by your live USB, mount Ubuntu partiton, delete all files from Ubuntu partition mount folder, mount filesystem.squashfs
, copy all files from filesystem.squashfs mount folder to Ubuntu partiton mount folder and reboot.
I test all of them today, i delete all Ubuntu files and extracted filesystem.squashfs
to root and rebooted to my Ubuntu. by my live USB that created by rufus i can login after write my pass word.
related problem:
after reboot to Ubuntu or live USB may be you will face "You do not have the permissions necessary to view the...."
when opening some partitions that solved with me by mount any partition in /mnt
or sudo chown -R username /media
if you extracted the filesystem.squashfs to another partition or the partition uuid changed you have to use boot-repair and edit etc/fstab
note: make sure you have same boot kernel files (vmlinuz and initrd) in your filesystem.squashfs
and your iso file or your live usb. if you upgraded the kernel you have to generate new boot kernel files.