Can I shrink my main partition without losing data?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Can I shrink my main partition without losing data?
I'd like to use Gparted to shrink my main partition so that I can split my second partition and install a 3rd Linux OS.
Can I do that or will it corrupt my first partition (almost empty)
Yes, theoretically you can do that, but obviously it depends on the details. Most probably you need to boot another OS and use a tool like gparted to do that.
It may [at least] depend on the usage, type of that partition.
Most installers have the option of using a partition manager to help resize. It may not be easy to use so I agree that a live boot to Gparted AFTER you make a backup of important data is the typical way.
Backups protect you from yourself sometimes. Ask me how I know that.
You can shrink partitions, but it's generally not recommended.
Basically, when you shrink a partition, you are just changing values in the partition table.
When we shrink, we change the pointer to where a given partition ends in your disk.
What partitioning software do, it's changing that end pointer, and moving the "off-range" bits to the new range of disk that partition has.
The thing is, shrinking it's never a safe technique. Extending, is.
Actually, if you ever need to shrink, that means that you previously planned badly your partitioning scheme.
So going back to your question...
Can you shrink?
Yes, you can. At your own risk.
Please, perform a backup on the partition you are going to shrink before doing anything. Just in case.
I hope this answer was helpful, and above all, easy to understand.
Hi.
Yes, it is possible* and yes you can use GParted live CD.
BUT it is risky. I've seen experienced users who failed to do it and lost all his information.
Backup and then do a backup of the backup. Do not store the backup in a partition in the SAME disk. If you are backing up in a USB HDD, disconect it while doing working on the shrink. Have a plan to reinstall everything in case you fail to do the shrink, for example if you are currently running Ubuntu 19, then make a live/install CD beforehand. I highly recommend using GParted and not using other built in utilities.
I second the suggestions by juanbot386 and others concerning the backup. A double backup of important data (on different media) increases safety level. If you have a good backup, it is unlikely that anything bad happens. If you don't take any backup, it seems strangely that it attracts problems.
GParted is the right tool. The GParted Live CD/USB is a very good choice as it contains all needed dependencies and is up to date. Please keep in mind to leave enough free space in the partition to work. Moving the starting sector of the partition can be long. Moving the right end only is much faster.
You can't stop a resizing operation after starting, as doing this can leave the filesystem corrupted. This is something you have to take into account if you want to resize big partitions. Power failure is to avoid during resizing.
These safety instructions are valid for any resizing software, not just for GParted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.