Hacker Public Radio

HPR3727: Expanding your filesystem with LVM


Listen Later

Synopis
I installed a new 1TB Crucial MX500 SSD into my work computer. While
we are mostly a Windows based business, as the IT guy I do get a bit of
discretion when updating my own machine (i.e. I get to solve all the
problems I create). Last year, I decided to run the Pop!_OS distribution
of Linux on my work computer and run Windows in a VM on it. Recently the
Windows image had grown and was causing disk space notifications. This
prompted the additional hard drive.
During the initial installation of Pop!_OS, I remember deciding not
to bother with installing Linux Volume Management (LVM). I have used it
in the past, but I am still much more comfortable with the old style
device mapping and mounting disk partitions to directories. I even
rationalized that if I needed to add more space, I will just add a new
disk with one big partition and map it to the home directory.
Now a year later I am adding a new HD and thinking, I really hate all
the space that is most likely going to be wasted once I move the Windows
image to the new drive. Ok, I guess I should figure out how to install
LVM, and use it to manage the space on both drives. Luckily there a
number of good blogs to be found on adding LVM to an existing system.
The following are the steps and commands I used to accomplish my
goal.
Commands
Most of the following commands need to be run as root. I decided to
change to root user instead of typing sudo before every command. The
basic steps to creating a single filesystem sharing the storage space
between two physical disk partitions are:
Let LVM know about the new disk.
In my case, create a volume group and add the new disk and its full
storage space to it.
Copy the disk partition with the root filesystem from the origin
disk to the new volume group
Expand the root filesystem on the volume group to the full size of
the volume group.
Update system configuration to boot with the root filesystem on the
new volume group.
Let LVM know about the old root disk partition.
Add the old root partition to the volume group.
Expand the root filesystem on the volume group to include the new
space in the volume group.
root@work# pvcreate /dev/sdb
root@work# pvdisplay
"/dev/sdb" is a new physical volume of "931.51 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 931.51 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID wRBz38-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
root@work# vgcreate workvg /dev/dsb
No device found for /dev/dsb.
root@work# vgcreate workvg /dev/sdb
Volume group "workvg" successfully created
root@work# vgdisplay
--- Volume group ---
VG Name workvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 931.51 GiB
PE Size 4.00 MiB
Total PE 238467
Alloc PE / Size 0 / 0
Free PE / Size 238467 / 931.51 GiB
VG UUID 67DSwP-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
root@work# pvdisplay
--- Physical volume ---
PV Name /dev/sdb
VG Name workvg
PV Size 931.51 GiB / not usable 1.71 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 238467
Free PE 238467
Allocated PE 0
PV UUID wRBz38-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx
root@work# lvcreate -n root -L 931.51 workvg
Rounding up size to full physical extent 9
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

289 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

373 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

268 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

653 Listeners

Curious Cases by BBC Radio 4

Curious Cases

826 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

422 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,046 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

181 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

42 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,809 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

98 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

140 Listeners

What the Hack? by DeleteMe

What the Hack?

221 Listeners