How to create an image of system partition without booting from live DVD or USB? (Emergeny mode?)
I'd like to create an image of my 20.04 system partition as a backup in case that anything goes wrong so that I can restore it later.
Additionally I want to make the system partition smaller (maybe after having it backed up...) so I can create a seperate partition for some photos and other data (which shouldn't be auto-mounted, but can be mounted when needed)
My problem is that the laptop doesn't have an optical drive and currently I don't have anything here that I could boot from (except a live DVD, which obviously doesn't help much without an optical drive)
So I thought it should somehow be possible to do this when I manually unmount / first, maybe after booting to emergeny mode? Or isn't it possible to unmount / even in emergeny mode?
Might using dd also work when / is mounted read-only?
Any ideas how I can get these simple tasks done without having to reboot from USB media?
Any help is appreciated.
edit:
I've given up on the modifying partitions part now as there really doesn't seem to be a good solution for shrinking a system partition that is mounted - But still I cannot believe there is no way to create a "live" image from a running system, as this is often needed for servers or other computers that you don't have physical access to...?! (And it was already possible in some other OS years ago)
Solution 1:
If you don’t have the means to boot from an optical drive or usb you can boot most live iso files by placing them on your local hard drive and adding custom menu entry to grub.
I’ve described how to do this with GParted in the link below and expect you could do the same with something like clonezilla to image your system
How to modify partitions without a live USB/CD
I have GParted set up to run like this on most of my systems and it works just like booting from a usb
Solution 2:
I've marked PonJar's answer as accepted as it is the best solution I got (and found), and there isn't a good way to shrink a system partition while the system is running anyway.
But in case one wants to boot some other ISO image from hard drive, the GRUB entry probably needs to be modified.
Here is a detailed and more general guide on how to do this: https://help.ubuntu.com/community/Grub2/ISOBoot
It is even possible to use this method for installing Ubuntu without a USB drive or DVD (as long as GRUB is present and working)