SQL Server 2017 CU9 (14.0.3035.2) MODIFY FILE encountered operating system error 31(A device attached to the system is not functioning.) while attempting to expand the physical file
Question
Thursday, August 16, 2018 10:26 AM
Hello,
I'm trying to restore a database to Linux SQL Server, The drive is formated as XFS so is under the list of supported items, however, I'm getting the following error:
Msg 5149, Level 16, State 3, Line 1
MODIFY FILE encountered operating system error 31(A device attached to the system is not functioning.) while attempting to expand the physical file '/var/opt/mssql/data/TestDB.mdf'.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
My Command for restore:
RESTORE DATABASE TestDB
FROM DISK = '/var/opt/mssql/backup/TestDB.bak'
WITH MOVE 'TestDB' TO '/var/opt/mssql/data/TestDB.mdf',
MOVE 'TestDB_Log' TO '/var/opt/mssql/data/TestDB_Log.ldf'
Anyone able to help with this?
Thank you.
All replies (3)
Thursday, August 16, 2018 10:33 AM
Locks like a file system access permission issue: https://social.technet.microsoft.com/Forums/windows/en-US/e4702979-6044-4309-9343-b59147302579/operating-system-error-31a-device-attached-to-the-system-is-not-functioning?forum=sqltools
Olaf Helper
Thursday, August 16, 2018 1:01 PM
Thanks, I've tired setting back the /backup and the /data folders to 777 to remove any such issue, thats still not working.
mssql is the owner and group of the folders.
I'm logged into SQL Server using the SA account also.
Friday, August 17, 2018 9:03 AM | 1 vote
Hi WChandleUK,
What's the size of database? Perhaps the file system usage is full so you encounter the system error 31.
Please try to use df -Th to have a check disk space.
If so, increase your problematic driver/file system size and try it again.
If not, please try using SSMS to connect to your SQL Server then use Restore feature instead of SQL command.
Check what happens.
Regards,
Pirlo Zhang
MSDN Community Support<br/> Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact <a href="mailto:MSDNFSF@microsoft.com">MSDNFSF@microsoft.com</a>.