HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

SQL Server 2017 Linux CU1 - MODIFY FILE encountered operating system error 31

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
fileerrorsqlsystemencounteredoperatinglinuxserver2017cu1

Problem

I have a "VMWare RHEL 7.4" machine that I have installed "SQL Server 2017 Linux CU1" and I created a "Linux Linear Volume", see steps at the bottom, when I try to restore a database backup in the "Linear Volume" I got the error below.

/*
Msg 5149, Level 16, State 3, Line 6
MODIFY FILE encountered operating system error 31(A device attached to the system is not functioning.) while attempting to expand the physical file '/sqldata/mssql_data/defense/defense_Data_01.MDF'.
Msg 3013, Level 16, State 1, Line 6
RESTORE DATABASE is terminating abnormally.
*/

I was able to restore the database backup on "/var/opt/mssql/data" without any problem, then I detached and moved the database to the "Linear Volume" and I was able to attach the database just fine, however any operation that needs to extend a datafile fails with the same error message.

I have setup "Linux Linear Volumes" the same way for Oracle and PostgreSQL databases and it has always worked fine with those.

Have you seen this problem? Is this a bug with "SQL Server 2017 Linux CU1" ?

Create Linux Linear Volume

  • vmware add /dev/sdc disk 100gb



  • Partition /dev/sdc and create /dev/sdc1 partition of 100gb


fdisk /dev/sdc

  • Create Volume Group


vgcreate vgsqldata /dev/sdc1
vgscan
vgdisplay vgsqldata

  • Logical Volume


lvcreate -l 25599 vgsqldata -n lvsqldata
lvdisplay -v /dev/vgsqldata/lvsqldata

  • Format the volume


mkfs.ext3 /dev/vgsqldata/lvsqldata

  • Mount


mkdir /sqldata
mount -t ext3 /dev/vgsqldata/lvsqldata /sqldata
df -kh
touch /sqldata/test.txt
ls -la /sqldata
rm -rf /sqldata/test.txt

  • Persist the mount


vi /etc/fstab
--mount logical volume
/dev/vgsqldata/lvsqldata /sqldata ext3 defaults 1 1

  • Change Owner


chown -R mssql:mssql /sqldata
ls -la /
"drwxr-xr-x. 5 mssql mssql 4096 Nov 7 10:43 sqldata"

The reason we use "Linux Linear Volumes" is because it is easier to add more space later, just need to add another vmware disk, partition the disk and add the new disk to the Linear Volum

Solution

I figure out the issue.

Problem: EXT3 files system is not supported.

https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup
File System XFS or EXT4 (other file systems, such as BTRFS, are unsupported

Solution: Create an EXT4 file system.

  • Comment the line in /etc/fstab that mounts the ext3 filesystem



vi /etc/fstab

-mount logical volume

"#/dev/vgsqldata/lvsqldata /sqldata ext3 defaults 1 1"

:wq!

  • Reboot the server



reboot

  • Check the file system is not mounted



df -kh

  • Check the linear volume



vgscan

vgdisplay vgsqldata

lvdisplay -v /dev/vgsqldata/lvsqldata

  • Format the volume as ext4



mkfs.ext4 /dev/vgsqldata/lvsqldata

  • Mount



mkdir /sqldata

mount -t ext4 /dev/vgsqldata/lvsqldata /sqldata

df -kh

touch /sqldata/test.txt

ls -la /sqldata

rm -rf /sqldata/test.txt

  • Persist the mount



vi /etc/fstab

-mount logical volume

/dev/vgsqldata/lvsqldata /sqldata ext4 defaults 1 1

  • Change Owner



chown -R mssql:mssql /sqldata

ls -la /

"drwxr-xr-x. 5 mssql mssql 4096 Nov 7 10:43 sqldata"

Context

StackExchange Database Administrators Q#190654, answer score: 3

Revisions (0)

No revisions yet.