SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

SQL Server on Linux Series: Expanding LVM Drives

Next in our SQL Server on Linux series is one important question. On Windows, if you’re about to run out of space, you get your VM admin / storage admin to expand one or more of your drives, and you go to Disk Management and expand the drive with no downtime. How do we accomplish this same task on Linux?

First, SSH into your VM. Get your appropriate system engineer to expand the drive that needs to be expanded. You won’t be able to see it at first in Linux because, just like in Windows, it’ll need to rescan the storage to ‘see’ the extra space. Sometimes Windows does it automatically, and sometimes you have to initiate it manually. In Linux it only does this on system startup.

Let’s grow our data drive from 250GB to 300GB first.

Note, I’m running all commands as the Linux ‘root’ user to keep me from typing ‘sudo’ numerous times.

This drive in question is listed as /dev/sdc in Linux, which we used the LVM to mount as /var/opt/mssql/data/data01 in a previous post. This drive was formatted as the XFS file system.

To rescan the storage without a restart, issue the command ‘echo 1 > /sys/class/block/sdc/device/rescan’ where sdc is replace with the device from your system.

You’ll now see the new space listed in the list block devices command.

‘pvdisplay’ can display the physical volumes and the volume groups, and we’ll need the volume group name to extend the volume.

Resize the physical volume boundaries.

You can now see that the physical volume boundaries have changed by reissuing the ‘pvdisplay’ command.

Use ‘lvextend’ to extend the logical volume to add the extra space, and the ‘-r’ parameter to tell it to resize.


We’ve now expanded our data drive by 50GB to make room for new data coming in. All in all, it’s not too bad, and quite procedural to do as needed.

Technobabble by Klee from @kleegeek

David Klee is all around geek who loves data - including the platform it resides on, virtualizing it, improving performance, availability, and disaster recoverability, and data presentation and visualization. He frequently advises organizations on the techniques of migrating their business-critical physical SQL Servers to the VMware infrastructure in his day job as Solutions Architect. David speaks at many national SQL Saturday events and SQL Server User Group meetings, as well as writes technical columns on SQL Server and virtualization topics on various blogs. He is on Twitter (https://twitter.com/kleegeek), LinkedIn (http://www.linkedin.com/in/davidaklee), and blogs frequently (http://www.davidklee.net).


Leave a comment on the original post [www.davidklee.net, opens in a new window]

Loading comments...