SQL Server on Linux Series: Expanding LVM Drives

kleegeek, 2018-01-29 (first published: 2018-01-15)

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.





Related content

Database Mirroring FAQ: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup?

Question: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? This question was sent to me via email. My reply follows. Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? Databases to be mirrored are currently running on 2005 SQL instances but will be upgraded to 2008 SQL in the near future.

Robert Davis


1,567 reads

Networking – Part 4

You may want to read Part 1 , Part 2 , and Part 3 before continuing. This time around I’d like to talk about social networking. We’ll start with social networking. Facebook, MySpace, and Twitter are all good examples of using technology to let…

Andy Warren


1,530 reads

Speaking at Community Events – More Thoughts

Last week I posted Speaking at Community Events – Time to Raise the Bar?, a first cut at talking about to what degree we should require experience for speakers at events like SQLSaturday as well as when it might be appropriate to add additional focus/limitations on the presentations that are accepted. I’ve got a few more thoughts on the topic this week, and I look forward to your comments.

Andy Warren


360 reads