LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-07-2020, 10:59 AM   #1
alex_0
LQ Newbie
 
Registered: Aug 2020
Posts: 2

Rep: Reputation: Disabled
Trying to extend my LVM encrypted root partition


Hi all

I'm getting short of disk space, so I'd like to extend my root partition as I still have plenty of space available on the disk.

See these lsblk commands : sda5_crypt isn't full but machine--vg-root almost is.

Code:
$ lsblk
NAME                     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                        8:0    0 298,1G  0 disk  
├─sda1                     8:1    0   243M  0 part  /boot
├─sda2                     8:2    0     1K  0 part  
└─sda5                     8:5    0 297,9G  0 part  
  └─sda5_crypt           254:0    0 297,9G  0 crypt 
    ├─machine--vg-root   254:1    0 178,6G  0 lvm   /
    └─machine--vg-swap_1 254:2    0   7,7G  0 lvm   [SWAP]
Code:
$ lsblk -afs
NAME               FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda1               ext2        1.0            7a6d6f6f-3f57-4401-8118-cd28207dfe48    113,7M    47% /boot
└─sda                                                                                               
sda2                                                                                                
└─sda                                                                                               
machine--vg-root   ext4        1.0            58c6d4c9-7d38-449a-891b-5b7ffe4871e6     10,5G    89% /
└─sda5_crypt       LVM2_member LVM2 001       csKLdw-orf1-ZEuN-vHL9-aHKA-rBix-6eMyRU                
  └─sda5           crypto_LUKS 2              39ebf88d-40f7-4f65-98e6-f0c0eca648ba                  
    └─sda                                                                                           
machine--vg-swap_1 swap        1              8e863f14-8a08-4a60-a9d9-89b9e26a0e6f                  [SWAP]
└─sda5_crypt       LVM2_member LVM2 001       csKLdw-orf1-ZEuN-vHL9-aHKA-rBix-6eMyRU                
  └─sda5           crypto_LUKS 2              39ebf88d-40f7-4f65-98e6-f0c0eca648ba                  
    └─sda
Don't ask me why I didn't make use of all that space in the first place ...

So, what do you think is the best way to achieve that ?

I could try and extend machine--vg-root ...

Or maybe add another data partition next to the existing ones. This may be easier and less risky. I mainly need room for data anyway.

I'd like to make a backup too in case something goes wrong. What software would u recommend for this ?


Thanks for your help
 
Old 08-07-2020, 05:04 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Things look pretty good based on that. You might be in a lot more strife if you had to grow the crypt container - been there, done that.
LVM is designed for this sort of thing. If the space is unallocated simply grow the vg for the root, then the lv and filesystem. If the vg already has the space, simply do the lv/filesusyem. Piece of cake. Let's see the full output from these.
As for backup, there are hundreds of options. For a "one-off" like this I like fsarchiver - gives you a compressed verified backup for the entire filesystem as a point in time backup.
Code:
pvs
vgs
lvs

Last edited by syg00; 08-07-2020 at 05:09 PM. Reason: typo
 
Old 08-07-2020, 05:05 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by alex_0 View Post
I could try and extend machine--vg-root ...
That's what I would do. lvextend -r extends both the volume and the filesystem, as long as this filesystem can be extended (ext4, xfs can).
Quote:
Or maybe add another data partition next to the existing ones. This may be easier and less risky. I mainly need room for data anyway.
You mean another volume. Fine as well.
Quote:
I'd like to make a backup too in case something goes wrong. What software would u recommend for this ?
tar is adequate here.
On second thought, no backup required when adding a volume.

Last edited by berndbausch; 08-07-2020 at 05:07 PM.
 
Old 08-11-2020, 09:49 AM   #4
alex_0
LQ Newbie
 
Registered: Aug 2020
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks a lot for your help

syg00's commands are very useful for a noob like me.

I think I'm gonna try benrdbausch's command. But I'm not quite sure for the back-up yet.

Maybe I'll go for tar or even dd. I like simple solutions. But I have to check the man pages first.

I'll let you know how it turns out ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to extend my VM SUSE 12 root partition asif7867 Linux - Newbie 2 07-07-2019 06:31 AM
Extend Linux Partition (Extend LVM) osama.mansoor Linux - Newbie 5 11-27-2015 01:09 AM
Shrink partition (LVM encrypted PVs + encrypted LVs) gedaj Linux - Newbie 2 05-22-2013 03:44 AM
Resizable encrypted LVM requiring just one password on boot (encrypted volume group)? Nyyr Linux - Software 9 01-24-2013 05:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration