Hard drive upgrade advice?

Thanks, your clarity of expression has me thinking that I have the picture.

I like the idea of reserving room for swap to add later. I haven’t had any situation where the 12G of ram has been insufficient but just in case, that seems like the way to go.

So I gather the first step is “to extend the “root” lv to include the remaining free space of the /dev/sda3 PV”

Is that something that can be done from the terminal I use inside cockpit?

Looking for how to extend “root” I came across this “To extend the size of a local volume root LVM, you need to first attach the new storage, create a Physical Volume (PV) from that storage, add the PV to the Volume Group (VG), and then extend the Logical Volume (LV).”

My hunch is we already have the storage attached and have the physical volume created leaving extending the Logical Volume?

The command I found suggested is
lvextend -l +100%FREE /dev/your_vg_name/root

I have
-added sudo
-changed it to 93% free to leave the swap space available
-changed “your-vg-name” to sda3

sudo lvextend -l +93%FREE /dev/sda3/root

Does that look like I am on the right track?

Then to resize the the partition I see suggested using:

xfs_growfs /dev/your_vg_name/root

but is xfs right for an ext4 filesytem? If so, is this right?

xfs_growfs /dev/sda3/root

As you can tell I rely on the “no such thing as a stupid question” theory :slight_smile:

Thanks for your help with this.

KenW

1 Like

You are getting close. I’d have to curl up with the manpages. You can check up on the /dev piece. If you look in your dev directory I think you’ll find /dev/fbox-vg which will contain your logical volume. You’ll have to confirm this, but I think it’s going to be something like /dev/fbox-vg/root.

You’ll want a different command for the filesystem resize. I used apropos to see what was on my laptop…
$ apropos resize
ntfsresize (8) - resize an NTFS filesystem without data loss
resize2fs (8) - ext2/ext3/ext4 file system resizer
resizecons (8) - change kernel idea of the console size
resizepart (8) - tell the kernel about the new size of a partition

Read up on resize2fs and see if that one looks right for you in place of xfs_growfs.

Here is the Debian manpage for lvresize. You are interested in the -l or --extents verbiage.

… and for resize2fs. It says you can do this online with a mounted filesystem. :smiling_face_with_sunglasses:

1 Like

Yes interesting, studying both now, thanks.

ken@fbox:~$ ls -l /dev/fbox-vg
total 0
lrwxrwxrwx 1 root root 7 Mar 30 19:35 root → ../dm-0
lrwxrwxrwx 1 root root 7 Mar 30 19:35 swap_1 → ../dm-1

So this is what I am thinking I need to do first:

sudo lvresize -L --size 7.5 g /dev/fbox-vg/root

and then follow that with

sudo resize2fs /dev/fbox-vg/root

I think I will study those man files some more before I give it a try though.

Thanks
KenW

Drop the -L from lvresize. -L and --size are the same command line option. You only need one of those. Then let it rip when you are ready.

sudo lvresize --size 7.5g /dev/fbox-vg/root

Looks like no space between size value and unit also…
–size [+|-]Size[m|UNIT]

ken@fbox:~$ sudo lvresize --size 7.5 g /dev/fbox-vg/root
[sudo] password for ken:
Volume group “g” not found
Cannot process volume group g
ken@fbox:~$ sudo lvresize --size 7.5g /dev/fbox-vg/root
File system ext4 found on fbox-vg/root mounted at /var/lib/containers/storage/volumes/nextcloud-freedombox/_data.
File system size (475.00 GiB) is larger than the requested size (7.50 GiB).
File system reduce is required (see resize2fs or --resizefs.)

T. T not G. :slight_smile: we will get through this.

–size 7.5T

ken@fbox:~$ sudo lvresize --size 7.5T /dev/fbox-vg/root
Insufficient free space: 1844479 extents needed, but only 0 available

Ugh. Do not reboot. The lv resize was successful, sadly.

Well, if I didn’t break it off completely for you, there is a command for exactly this…

To recover, recreate the logical volume to at least its previous size (or use vgcfgrestore with backup files in /etc/lvm/archive to revert the configuration) and then run e2fsck -f to check the filesystem integrity.

I do apologize deeply about this. I’m taking some comfort from the disk in the bag right about now.

What do you have in /etc/lvm/archive?

ken@fbox:~$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 fbox-vg lvm2 a-- 475.96g 0
ken@fbox:~$ ls /etc/lvm/archive
ls: cannot access ‘/etc/lvm/archive’: No such file or directory
ken@fbox:~$ mc

ken@fbox:~$ ls /etc/lvm/backup
ls: cannot open directory ‘/etc/lvm/backup’: Permission denied
ken@fbox:~$ sudo ls /etc/lvm/backup
fbox-vg
ken@fbox:~$

I still have the sd disk of course plus I did a backup (untested) before I took the system down.

As root look in that lvm backup folder. I’m guessing there will be one or more files in that each revision of root LV config change.

This is getting late for me and I’ve lead you to one mistake already. I’m going to need to sleep.

My memory is that the lvm config file will have all of the VG, pv, LV details in one file and that it is somewhat understandable. You want the newest one older than the change just made.

ken@fbox:~$ sudo ls /etc/lvm/backup
fbox-vg
ken@fbox:~$ sudo mc

ken@fbox:~$ sudo ls -a /etc/lvm/backup
. .. fbox-vg

ls -l that file. Maybe it is older than a few moments.

No worries, not sure of your time zone but it is late here as well. Can leave it for another time.

Yes, older.
ken@fbox:~$ sudo ls -l /etc/lvm/backup
total 4
-rw------- 1 root root 1693 Aug 18 2025 fbox-vg

The backup I did doesn’t look like it is big enough to be a full backup