3

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

  1. vmware add /dev/sdc disk 100gb
  2. Partition /dev/sdc and create /dev/sdc1 partition of 100gb fdisk /dev/sdc
  3. Create Volume Group vgcreate vgsqldata /dev/sdc1 vgscan vgdisplay vgsqldata
  4. Logical Volume lvcreate -l 25599 vgsqldata -n lvsqldata lvdisplay -v /dev/vgsqldata/lvsqldata
  5. Format the volume mkfs.ext3 /dev/vgsqldata/lvsqldata
  6. Mount mkdir /sqldata mount -t ext3 /dev/vgsqldata/lvsqldata /sqldata df -kh touch /sqldata/test.txt ls -la /sqldata rm -rf /sqldata/test.txt
  7. Persist the mount vi /etc/fstab --mount logical volume /dev/vgsqldata/lvsqldata /sqldata ext3 defaults 1 1
  8. 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 Volume.

Increase Linux Linear Volume

  1. vmware add /dev/sdd disk 100gb
  2. Partition /dev/sdd and create /dev/sdd1 partition of 100gb fdisk /dev/sdd
  3. Extend Volume Group vgextend vgsqldata /dev/sdd1
  4. Extend Logical Volume lvextend -l +100%FREE /vgsqldata/lvsqldata

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/logical_volume_manager_administration/

I appreciate any feedback on this problem.

Thanks,

Marcelo Marques Senior Technical Manager, OCP www.esri.com

2

I figure out the issue.

Problem: EXT3 files system is not supported.

https://docs.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.

  1. 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!

  1. Reboot the server

reboot

  1. Check the file system is not mounted

df -kh

  1. Check the linear volume

vgscan

vgdisplay vgsqldata

lvdisplay -v /dev/vgsqldata/lvsqldata

  1. Format the volume as ext4

mkfs.ext4 /dev/vgsqldata/lvsqldata

  1. Mount

mkdir /sqldata

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

df -kh

touch /sqldata/test.txt

ls -la /sqldata

rm -rf /sqldata/test.txt

  1. Persist the mount

vi /etc/fstab

-mount logical volume

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

  1. Change Owner

chown -R mssql:mssql /sqldata

ls -la /

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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