Scenario
- I have 2 working Ubuntu partitions on my hard drive, let's call them A and B. They use a single swap partition.
- I have booted into A and logged into the desktop. Now I want to make partition A larger (there is enough space) without reboot.
Question
Can I use chroot to
- switch execution to B and then unmount partition A.
- Then from B start gparted and resize partition A.
- Then (in B) mount A into a /mnt/temp and use chroot to switch execution back to A?
Please comment or answer if you know whether or not that is possible at all. Even when you do not know the exact steps. It would already help me and is a lot better than no answer at all.
Of course more helpful would be a step by step command line procedure to go to B, unmount partition A and how to start the graphical gparted.
What I did
- I used chroot to switch from a live CD or other partition to fix grub. It was in text mode only. I used the standard procedure that is explained in many posts (mount other partition, mount --bind the virtual folders and then move with chroot to the mounted drive).
- I created a clone of A to a newly created partition B. The clone works fine and completely when booted from grub, so I know its fully functional. I did access the command line with chroot ('#' prompt) from A.
- I did not find a way to start a desktop in B, or fully switch over to work in B like if I would have rebooted the system into B.
- I did not see another post that contained that question
As I know: chroot means changing root.
You are changing your running system's root; So your system (A) is still running everything you see is a part of your running system and you can't simply unmount its busy resources (block devices).
Also the system you are changing your root to (B), is not capable of doing any stuff without A's help. As an example, I guess you used a command like
mount --bind /xxx /mnt/xxx
to bind paths like/proc
or/dev
as a part ofchroot
process; These paths are being manged by your running system's (A) and are necessary to the chrooted environment (B).You simply can't do what you are tring to do.
As Wikipedia says, the usages of
chroot
are:To run a graphical program from your chrooted environment (B inside A); You should permit the access to the running X.
Out side of chroot environment run (open another terminal):
Then export what you get as an output into your chrooted environment:
Now you should be able to run graphical applications.
Source
I can't get why are you doing this, just boot into a live disk, apply your changes, chroot to your different machines to fix anything if it's necessary. then reboot and use your systems.