1

I am trying to double the size of my root filesystem shown below:

# df
Filesystem                              1K-blocks     Used Available Use% Mounted on
devtmpfs                                 98162476        0  98162476   0% /dev
tmpfs                                    98193220       84  98193136   1% /dev/shm
tmpfs                                    98193220    18992  98174228   1% /run
tmpfs                                    98193220        0  98193220   0% /sys/fs/cgroup
/dev/mapper/rhel-root  73364480 24938064  48426416  34% /
/dev/mapper/rhel-home 389482692  2748736 386733956   1% /home
/dev/sda1                                 1038336   265924    772412  26% /boot
tmpfs                                    19638644        0  19638644   0% /run/user/0
shm                                         64000       16     63984   1% /var/lib/containers/storage/overlay-containers/...                                  73364480 24938064  48426416  34% /var/lib/containers/storage/overlay.../merged
overlay                                  73364480 24938064  48426416  34% /var/lib/containers/storage/overlay/.../merged
overlay                                  73364480 24938064  48426416  34% /var/lib/containers/storage/overlay/.../merged
overlay                                  73364480 24938064  48426416  34% /var/lib/containers/storage/overlay/.../merged
overlay                                  73364480 24938064  48426416  34% /var/lib/containers/storage/overlay/.../merged
# lsblk
NAME                            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                               8:0    0 446.6G  0 disk 
├─sda1                            8:1    0     1G  0 part /boot
└─sda2                            8:2    0 445.6G  0 part 
  ├─rhel-root 253:0    0    70G  0 lvm  /
  ├─rhel-swap 253:1    0     4G  0 lvm  [SWAP]
  └─rhel-home 253:2    0 371.6G  0 lvm  /home

I see I have plenty of free space in rhel-home, so I am guessing it must be possible to re-purpose some of that space in rhel-root (ideally about 70gs). However I don't really understand filesystems enough to know if this is more complicated that it seems.

The answers I have found on this quickly get to a point that something goes over my head. What is the best way to achieve what I am trying to do, ideally without losing any data in either filesystem (but not the end of the world if it is not possible without potentially losing some data)

# resize2fs /dev/mapper/rhel-home 300GB
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/rhel-home
Couldn't find valid filesystem superblock.

2
  • 1
    perhaps your /home is not a ext2/3/4 filesystem? Commented Jan 31, 2023 at 2:09
  • 1
    what I don't understand though ... df and lsblk show /dev/mapper/rhel-home - but you try to resize /dev/mapper/rhel_wsfd--advnetlab04-home Commented Jan 31, 2023 at 2:45

1 Answer 1

0
  1. create /home.new as root 'mkdir /home.new'
  2. Copy /home to /home.new (in your root filesystem) 'cp -prv /home /home.new'
  3. login through your console, cd /, become root 'sudo su -'
  4. clean out /home 'rm -rfv /home'
  5. dismount /home 'umount /home'
  6. rename /home /home.old 'mv -v /home /home.old'
  7. rename /home.new => /home 'mv -v /home.new /home'
  8. remove (or comment out) /home from your /etc/fstab 'nano /etc/fstab'
  9. cross fingers, reboot and login as root in rescue mode
  10. delete your /home lvm (lvremove)
  11. lvm lvextend -l +100%FREE /dev/mapper/rhel-root
  12. resize2fs -f /dev/mapper/rhel-root

Good luck.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .