[SOLVED] Resize home partition without powering off
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From the search I have done, most of the answers were to su as root, unmount /home, resize, mount /home and su user.
What will happen to the GUI session when I unmount /home?
I am not familiar with command line resizing and will be using GParted for the resize. Can I start a GUI session as root and how, or just only start GParted if possible as that is the only thing I will be using as root.
living filesystem cannot be [easily] resized, so you need to umount it first.
if the GUI session uses that /home it will just crash, or umount will be refused.
I would suggest you to boot a live CD (or another OS) to resize that filesystem.
+1 to pan64.
Just unmounting your home directory to resize is problematic at best. Better to boot into rescue or from a live USB and performing your block device changes.
If you resize a partition while it is in use then you are risking data corruption. You don't know what files are in use or in the process of being written and changing the partitions for a live system can cause it to overwrite other data. In fact even imaging an in use filesystem (using dd) can cause in consistencies in the target.
Why don't you want to boot using a rescue or live CD to do the resize?
Also, I highly recommend that you make a full backup of all data on the drive (not just the partition being resized) before resizing it.
LVM = Logical Volume Management can also be useful in situations like this. This subsystem cleanly separates the physical storage picture from the logical view seen by the operating system and its users. A "logical volume" can span multiple physical devices – all of which are made part of the same "storage pool." It is a very flexible and well-thought-out system that is readily available (maybe the default) in most Linux distros. You might be unaware that you even have it ... until you need it. It trivializes the response to what is otherwise a very difficult-to-handle situation: "running out of space somewhere."
In addition, useful commands exist to take care of "the drive that suddenly begins to make ominous clicking noises." You can migrate everything off the potentially-failing drive without downtime. Very nice. Even elegant.
So in this case you wouldn't have to "resize the partition." You'd simply carve out another partition, add it to the storage pool, and let the logical volume continue to expand into it. You can now manage the physical situation and the logical situation independently.
Last edited by sundialsvcs; 06-22-2022 at 12:09 PM.
Resizing a partition implies that you have some unused spare space. If you have enough unused space I would advise that you create a new partition in the spare space, format the new partition, copy /home to the new partition, and then change /etc/fstab to mount /home on the new partition.
At that point you can either reboot or umount /home and then mount it again.
I do not use LVM, I consider my system small for that. I just use GPT disks with partitions formatted with ext4 file systems.
The home partition was big, more than 800 GB and I use less than 200 GB. So I decided to make it smaller and create a dedicated partition for VMs. Since I backup the home partition, I wouldn't want to backup the VMs too, since they are just for looking/checking different distros. It would have been a waste of backup space.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.