DEV Community

Max
Max

Posted on

Debian/LVM increase disk size cheatsheet

Just a quick cheatsheet for increasing disk sizes for my TrueNAS scale VMs with debian os and lvm.

  1. Make sure you created a snapshot!
  2. Stop VM
  3. Increase ZVOL
  4. Start VM
  5. lsblk => Check new size of /dev/sda
  6. fdisk /dev/sda
    1. p (print)
    2. Copy partition row
    3. d (delete)
    4. n (new) -
    5. KEEP lvm signature!
    6. t (change type) => 30 for Linux LVM
    7. p (print again)
    8. Compare row (startbytes, size, type) with row from above
    9. w (write changes)
  7. Reboot VM
  8. pvresize /dev/sdaX (Replace X with actual number)
  9. pvs => Check
  10. lvs => Get VG and LV
  11. lvresize -l +100%FREE /dev/<VG>/<LV>
  12. resize2fs /dev/<VG>/<LV>
  13. Reboot VM

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay