How to extend your data disk

After having extended my own installation, I have tried to create the following Guide on how to do it.

How to extend your data disk permanently.

Applies to UmbrelOS 1.2.2 (Debian 12.6 [Bookworm] based)

Disclaimer

In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this guide.

Skill level: Medium

Requirements

I am going to utilize LVM2 and XFS for performance reasons.
ext4 has been out performed by LVM and XFS for the past 12 years.

Also I opened a root session instead of using sudo all the time.
To do so type “sudo -s”

The following packages needs to be installed:

lvm2, btrfsprogs, xfs-progs, fdisk

Install requirements

  1. sudo apt update; sudo apt upgrade -y;
  2. sudo apt install -y lvm2 btrfs-progs xfsprogs fdisk rsync;
  3. sudo mkdir -p /mnt/newdata

Your main disk is probably /dev/sda
Use “sudo lsblk” command to find your new disk(s).

I my case I added 2 SSD’s and they are named /dev/sdb and /dev/sdc

Use cfdisk to clear to disks and then create a new partition of 100% on each disk.

  1. sudo cfdisk /dev/sdb
  2. Delete all partitions
  3. Select “Write” and “Yes” (Uppercase Y)
  4. Select “New” and press Enter
  5. Select “Write” and “Yes” (Uppercase Y)

Repeat for the next disks.

LVM (Striping disks)

  1. sudo pvcreate /dev/sdb /dev/sdc

  2. sudo pvs

    root@umbrel:/# pvs
    PV         VG Fmt  Attr PSize   PFree
    /dev/sdb1     lvm2 ---  465.76g 465.76g
    /dev/sdc1     lvm2 ---  232.88g 232.88g
  3. sudo vgcreate /dev/sdb /dev/sdc

     root@umbrel:/# vgcreate vg_data /dev/sdb1 /dev/sdc1
     Volume group "vg_data" successfully created
    
     root@umbrel:/# vgs
     VG      #PV #LV #SN Attr   VSize   VFree
     vg_data   2   0   0 wz--n- 698.64g 698.64g
    
  4. sudo lvcreate --extents 100%FREE --name datastore vg_data

     root@umbrel:/# lvcreate --extents 100%FREE --name datastore vg_data
     Logical volume "datastore" created.
    
     root@umbrel:/# lvs
     LV        VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log 
     datastore vg_data -wi-a----- 698.64g
    
  5. mkfs.xfs /dev/mapper/vg_data-datastore (for XFS) OR mkfs.btrfs /dev/mapper/vg_data-datastore (for BTRFS)

     root@umbrel:/# mkfs.xfs /dev/mapper/vg_data-datastore
     ...
     Discarding blocks...Done.
    
  6. mount /dev/mapper/vg_data-datastore /mnt/newdata/

  7. rsync -a /data/ /mnt/newdata
    (Wait for it to finish)

  8. vim /etc/fstab

  9. Edit for your needs and add the following line after the /root line

    /dev/mapper/vg_data-datastore   /data   auto    defaults,x-systemd.growfs       0       0
  10. Run:

    systemctl daemon-reload

  11. Run:

    mount -a

  12. Run:

    ls -lah /data

  13. Run:

    lsblk

sdb                     8:16   0 465.8G  0 disk
└─sdb1                  8:17   0 465.8G  0 part
  └─vg_data-datastore 254:0    0 698.6G  0 lvm
  1. Web-UI
    Open the Umbrel Web UI and checkout your new and bigger data disk.

It will help if you stated your system status before you get started.

Are you doing the new install and boot from SD card before you started?

Are you doing the disk addon from a working system, doing a backup of the current system and restore the data after you extended your data disk?

1 Like

My results:
When using cfdisk I get question to select primary or extended when doing write. I asume the first option is correct, but why is this step omitted in your guide? My disk is ext4, no idea how to change it.

When calling sudo pvcreate /dev/sdb
I got Cannot use /dev/sdb: device is partitioned.

So I cannot continue.