SQL Server 2017 – The operating system returned the error 21

Recently, I was exploring SQL Server 2017 CTP 2.0 using SQL Server Management Studio V17. Till the time, I was restoring the databases using tsql script on the SQL Server 2017 instance, and I didn’t encounter any issue. But, When I tried to restore a database backup using GUI using SSMS V17, I encountered the below error.

The operating system returned the error ’21(The device is not ready.)’ while attempting ‘GetDiskFreeSpace’ on ‘A:\’.
The statement has been terminated. (Microsoft SQL Server, Error: 3634)

Cause

This issue happens because of SMO switched to using sys.dm_os_enumerate_fixed_drives instead of the old xp_fixeddrives to get free space information in this dialog box sequence.

Workaround

You can disable the virtual Floppy drive and CDROM drive from the Device Manager as shown below.

Once you disabled them successfully, let’s try to restore a SQL Server database backup using SSMS V17.

This time it didn’t throw any error 🙂 ! I am sure the issue will be addressed in the coming release.

Never late to explore and learn something new!

2 thoughts on “SQL Server 2017 – The operating system returned the error 21

  • Jamie Fisher

    Is this already reported to Microsoft? I’m seeing this using SSMS 17.1 and SQL 2017 CTP 2.1.

    Reply
    • Dharmendra Keshari
      Dharmendra Keshari

      Yes, it has been already reported to Microsoft. You are right. it also persists in SSMS 17.1 and SQL 2017 CTP 2.1. As per Microsoft, I will be fixed in next release.

      Reply

Leave a comment

Your email address will not be published. Required fields are marked *