We are trying to move a SQL server DB from Windows to Linux. But we are facing few problems while migration.

  1. We took a Backup of the DB server, from SSMS in Windows
  2. We restored it in the linux running the following commands:
RESTORE FILELISTONLY FROM  DISK =N'/var/opt/mssql/data/backup_file_name.bak' 
    FROM  DISK = N'/var/opt/mssql/backup_file_name.bak' WITH  FILE = 1,   
    MOVE N'DB_NAME' TO N'/var/opt/mssql/data/DB_NAME.mdf',   
    MOVE N'DB_NAME_Log' TO N'/var/opt/mssql/data/DB_NAME.ldf', 

Running this I get an error more or less lie this:

file XX_FlatFline cannot be restored to PATH_IN_WINDOWS {.....mdf}. Use WITH MOVE to identify a valid location for the file.

I get error for both MDF and LDF files. The windows path shown above in the error is the location of the mdf and ldf files in the Windows machine.

Can someone help me understand what's going wrong here? Why does the Windows path still matter when I am restoring the dump into a new DB?

Warning: I am a novice in SQL Server.

  • 9
    What are the results of RESTORE FILELISTONLY (specifically, logical_file_name of each file)? The XX_FlatFline value in the error message was not specified in a MOVE clause so restore is trying to attempt to restore the file to the original file location (a Windows path).
    – Dan Guzman
    Sep 8, 2017 at 20:39
  • 1
    Did you had a chance to check what Dan Guzman suggested Sep 9, 2017 at 18:11
  • Big +1 to giving us the results of the RESTORE FILELISTONLY. I think I know the problem and this will confirm it. Think your MOVE statemens are incorrect or you have some missing. Nov 12, 2017 at 23:59

1 Answer 1


In the first release of SQL Server on Linux, I saw that SQL Server translates paths to related terms in windows, for example, root '/' will be C:. so if this logic exists, you may try to make it something like:

FROM DISK = N'C:\var\opt\mssql\backup_file_name.bak' WITH FILE = 1

but I think it's different now as mentioned here maybe you should first check the version of your SQL Server on Linux and then check the steps on that article.

Your Answer

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

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