How to resize encrypted partition after SSD upgrade
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.
How to resize encrypted partition after SSD upgrade
Thanks for looking,
I have upgraded M.2 drive in my Debian laptop from 500G to 1TB using CloneZilla.
Now I have 500G unallocated and would like to extend my main LUKS partition to the remaining space.
Searching around I found rather confusing info, but understand the main concept.
I've never done it but what links did you find searching, maybe: resize encrypted Linux partition? The first one's outdated but definitely gives you some good starts to cross reference. Here's another example: https://unix.stackexchange.com/quest...etup-resize-do
also old but anyone who's (or not) done it, is just gonna show you what the manuals and searches told them?
Switching drives I'm sure you've backed up data, if you needed to... I'd just go for it and then come back if need be.
Last edited by jamison20000e; 04-25-2023 at 09:22 PM.
For all those that continually bleat that LVM isn't appropriate for home users, take note. This is a piece of cake were LVM in place.
Regardless, the steps are basically the same as for a non-LUKS setup - and much easier than shrinking let it be known. Enlarge the partition, close and open the container, resize the filesystem. Add a few fsck for sanity.
In your case you'll have to get that swap out of the way - is it used for hibernation ?.
I would boot from a live distro, or a rescue system.
With the container *closed*, resize the partition, then the filesystem. Open the container (do *not* mount) and run fsck on the container device (/dev/mapper/luks-b933ced7-96d3-4f5b-87cd-780e5664aca4).
Using something like parted you could simply move that swap partition (warning: math will be involved), or any other tool delete and recreate it. Deleting and recreating will change the UUID and involve editing /etc/crypttab (or you may find you can no longer boot until it's fixed).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.