1

I have a SQL Server 2022 instance running in a Docker container on Linux. My understanding is that Docker containers can simply expand their disk usage to fill the entire volume space available. The space on the volume is about 10GB:

$ sudo df -h /var/lib/docker/
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       47G   34G   10G  78% /

Yet when I go into SSMS and look at the DB properties, it says "Database size 80.00 MB, Space Available 1.78MB". Why does it say only 1.78MB is available? Will my DB still be able to use all of that 10GB on the partition?

1 Answer 1

1

The database properties show the size of the files for the database. It is independent of the size of the disk or what the Docker container is currently consuming.

The Space Available property on the database is how much space is left free within the database file, before a growth operation will be attempted to grow the file on disk.

SQL Server manages space internally to the data file of a database. Typically people pre-grow their data files to a reasonable size (sometimes the entirety of the disk available if it's the only database) to minimize growth operations, which can be a little costly of an operation. Then they'll monitor the actual space consumption of the database by looking at the internal file size and usage, such as by the Space Available property.

2
  • OK, is there any way to get SQL Server to say how much disk space it thinks is available?
    – Jez
    Apr 5 at 17:50
  • @Jez It's probably possible in some obscure way or in one of the DMVs but I don't know off-hand. But you're probably better off pre-growing the data file of your database to an appropriate size (as recommended in my updated answer).
    – J.D.
    Apr 5 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.