[SOLVED] Resize /home filesystem Debian Buster 10.4

Kernels & Hardware, configuring network, installing services

[SOLVED] Resize /home filesystem Debian Buster 10.4

Postby 4joeyirosh1 » 2020-07-23 14:01

Hi!I have Debian Buster 10.4 installed on my machine.

During my first installation of the Linux OS,I allocated too small a size to the /home ext4 filesystem /dev/sda6 and its fast getting filled up and I had hoped to extend it by taking some storage from physical volume /dev/sda7 thats part of a volume group and logical volume.The /home filesystem isnt part of the same volume group as /dev/sda7 or maybe I could shrink linux-swap and copy the unallocated partition and extend it to /dev/sda6.What I mean is if I run pvdisplay the /home /dev/sda6 volume isnt displayed as the result is as below thus its maybe not an LVM partition like sda7.I am unable to resize sda7 partition from gparted as it says there is no free space though the filesystem where this physical volume resides has over 100 GB free space

# pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name vg-data
PV Size <692.54 GiB / not usable 2.33 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 177289
Free PE 0
Allocated PE 177289
PV UUID DcDvnA-ygD5-rxbV-wTwz-2Fik-cw8a-UzVBM3

--- Physical volume ---
PV Name /dev/sda7
VG Name vg-data
PV Size <60.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 15359
Free PE 0
Allocated PE 15359
PV UUID 1Qo83S-2lIf-qEca-BAXV-luQq-XUjS-ksiAcw

--- Physical volume ---
PV Name /dev/sda3
VG Name vg-data
PV Size <118.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30207
Free PE 0
Allocated PE 30207
PV UUID b1Abef-rV7W-ZA5S-bmt0-m9Kp-Z2Qq-960Xqf



I am not a storage or LVM expert so I dont know if my explanation above makes sense.Forgive me if I dont state my situation correctly

My storage allocation is as per gparted screenshot shown

Image

I hope you understand what I am trying to do and kindly assist.
Last edited by 4joeyirosh1 on 2020-07-26 03:40, edited 3 times in total.
4joeyirosh1
 
Posts: 94
Joined: 2016-09-11 18:04

Re: Resize /home filesystem Debian Buster 10.4

Postby ruwolf » 2020-07-23 21:25

I am not storage and LVM expert either, but LVM has its own commands for moving and resizing:
pvmove & pvresize.

(BTW: I do not know, why do you have 3 partitions on the same device in the same logical group. Would it not better to be single continuous partition?)
User avatar
ruwolf
 
Posts: 427
Joined: 2008-02-18 05:04
Location: Slovakia, Banovce nad Bebravou, Matice slovenskej 1260/4-7

Re: Resize /home filesystem Debian Buster 10.4

Postby p.H » 2020-07-24 08:22

Information missing. Please post the output of the following commands run as root.
Code: Select all
vgs
lvs
lsblk
df -hT -x tmpfs -x devtmpfs
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Resize /home filesystem Debian Buster 10.4

Postby 4joeyirosh1 » 2020-07-24 13:45

p.H wrote:Information missing. Please post the output of the following commands run as root.
Code: Select all
vgs
lvs
lsblk
df -hT -x tmpfs -x devtmpfs


Thanks for responding pH.Please find output below

Code: Select all
# vgs
  VG      #PV #LV #SN Attr   VSize    VFree
  vg-data   3   1   0 wz--n- <870.53g    0
# lvs
  LV      VG      Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-data vg-data -wi-ao---- <870.53g                                                   
# lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                   7:0    0   100M  0 loop /var/spool/havp
sda                     8:0    0 931.5G  0 disk
├─sda1                  8:1    0    30G  0 part /
├─sda2                  8:2    0    20G  0 part [SWAP]
├─sda3                  8:3    0   118G  0 part
│ └─vg--data-lv--data 254:0    0 870.5G  0 lvm  /data
├─sda4                  8:4    0     1K  0 part
├─sda5                  8:5    0 692.6G  0 part
│ └─vg--data-lv--data 254:0    0 870.5G  0 lvm  /data
├─sda6                  8:6    0    10G  0 part /home
└─sda7                  8:7    0    60G  0 part
  └─vg--data-lv--data 254:0    0 870.5G  0 lvm  /data
sr0                    11:0    1  1024M  0 rom 
# df -hT -x tmpfs -x devtmpfs
Filesystem                    Type  Size  Used Avail Use% Mounted on
/dev/sda1                     ext4   30G   15G   14G  52% /
/dev/sda6                     ext4  9.4G  6.8G  2.2G  76% /home
/dev/mapper/vg--data-lv--data ext4  856G  712G  103G  88% /data
/dev/loop0                    ext2   97M  1.7M   91M   2% /var/spool/havp
4joeyirosh1
 
Posts: 94
Joined: 2016-09-11 18:04

Re: Resize /home filesystem Debian Buster 10.4

Postby p.H » 2020-07-25 08:52

It appears there is one VG (LVM volume group) "vg-data" using three PV (physical volumes) /dev/sda{3,5,7} and containing only one LV (logical volume) "lv-data" using all the VG space. /home is in a plain partition /dev/sda6 outside LVM. All in one disk. This is really a weird design.

The partition next to /dev/sda6 is /dev/sda7, a 60 GiB PV. By luck, the ext4 filesystem inside lv-data has more that 60 GiB free space, so you could :
- unmount lv-data
- reduce lv-data and its filesystem by 61 GiB (let's take some safety margin) with lvreduce --resizefs
- move data away from /dev/sda7 with pvmove
- remove the now empty /dev/sda7 from the VG with vgreduce
- delete /dev/sda7 with gparted
- extend /dev/sda6 to the desired size and its filesystem with gparted
- optionally, create a new PV partition in the remaining free disk space, add it to the VG and extend the LV and its filesystem - or just leave this available space for future needs

Or, if you don't need a 20 GB swap and 10 GB would be enough, you could swap the partitions :
- disable the swap with swapoff
- reformat /dev/sda2 as ext4 with the same UUID as /dev/sda6
- move all data from /home to /dev/sda2
- reformat /dev/sda6 as swap with the same UUID as the old swap with mkswap -U

Or you might consider moving /home into the VG.

If you have any important data on this disk, make sure you have a working backup before doing any of the above.
p.H
 
Posts: 1422
Joined: 2017-09-17 07:12

Re: Resize /home filesystem Debian Buster 10.4

Postby 4joeyirosh1 » 2020-07-25 19:38

Thanks pH for your suggestions.I inplemented the second option that you suggested as below ie

Or, if you don't need a 20 GB swap and 10 GB would be enough, you could swap the partitions :
- disable the swap with swapoff
- reformat /dev/sda2 as ext4 with the same UUID as /dev/sda6
- move all data from /home to /dev/sda2
- reformat /dev/sda6 as swap with the same UUID as the old swap with mkswap -U


And swapped the swap partition /sda2 with /home ie sda6 thus now my swap is in partition /sda6 with 10 GB space and /home is in /sda2 with 20 GB space now giving me more space for home.

Thanks alot for your help. :D :)
4joeyirosh1
 
Posts: 94
Joined: 2016-09-11 18:04


Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable