Change the default backup folder location on SQL Server on Linux

Use the mssql-conf utility to change the default location where the backup files are generated. In SQL Server on Linux, the default location where backup files are created is ‘/var/opt/mssql/data’.

Let’s connect to SQL Server Linux Instance using SSMS and go to the instance property, select ‘Database Settings’ tab, and get the database backup default location.

 01defaultbackuplocation

Change the default backup folder location

  • Connect your Linux machine as a root user

Syntax: sudo -i

01connectasrootuser

  • Create a backup folder where you want to keep the database backup files. For example, I will create a backup folder at location /var/sqlbackup

Syntax: mkdir /var/sqlbackup

02createbackupfolder

  • Verify the created backup folder

Syntaxls -l

03verfifybackupfolder

  • The folder created, but root has access to that folder. You need to replace the root with ‘mssql’ so that SQL Server service can access that folder.

   Change the user permission from root to mssql

Syntax: chown mssql /var/sqlbackup

04changetheuserrights

   Change the group permission from root to mssql

Syntax: chgrp mssql /var/sqlbackup

05changethegrouprights

  • Use the mssql-conf utility to change the default backup directory with the “set” command. Once you run the below command, it will replace the default backup folder location with the new location.

Syntax: /opt/mssql/bin/mssql-conf set defaultbackupdir /var/sqlbackup

06changethedefaultbackuplocation

  • After applying the new default backup folder location, you need to restart the SQL Server service.

04restartthesqlserverservice

  • Let’s verify the newly updated default backup folder location

07verifythenewbackuplocation

Hope, you are enhancing your SQL Server on Linux knowledge by learning day by day.

13 thoughts on “Change the default backup folder location on SQL Server on Linux

  • John

    It is perfect time to make some plans for the future and it
    is time to be happy. I’ve read this post and if I could I wish to suggest you few interesting things or suggestions.
    Maybe you could write next articles referring to
    this article. I wish to read more things about it!

    Reply
    • Dharmendra

      Thanks John for reading the post! It will be an esteem to have your valuable input…..

      Reply
  • uk cheap hosting

    I enjoy what you guys are up too. This sort of clever work and reporting!
    Keep up the good works guys I’ve added you guys to our blogroll.

    Reply
  • Dharmendra

    Thanks for reading and adding to your blogroll..

    Reply
  • http://Www.yophome.com/home.php?Mod=space&uid=83586&do=profile&from=space

    I appreciate, cause I discovered just what I used to
    be looking for. You have ended my four day lengthy hunt! God Bless you man. Have a nice day.
    Bye

    Reply
  • Dharmendra

    Thank you! I am really glad, it was helpful to you….

    Reply
  • http://www.yimuzy.cn

    Thank you for any other great post. Where else may anybody get that
    type of info in such an ideal way of writing? I have a presentation next week, and I am at the search for such information.

    Reply
    • Dharmendra

      You are welcome! I am not sure about the other places where you can get this much detailed information…. Even I am presenting on 21st Dec.. Let’s me know, if you are looking for some specific information where I can help you on that….

      Reply
  • Fat Diminisher User Reviews

    It’s very easy to find out any matter on web as compared to
    textbooks, as I found this paragraph at this web page.

    Reply
  • cgi.www5b.biglobe.ne.jp

    Hey there I am so thrilled I found your web site, I really found you
    by accident, while I was searching on Yahoo for something else, Anyhow I am here now and would just like to say
    thanks a lot for a marvelous post and a all round
    entertaining blog (I also love the theme/design), I don’t have time to look over it all at the moment but I
    have book-marked it and also added your RSS feeds, so when I have time I will
    be back to read a great deal more, Please do keep up the great work.

    Reply
  • http://bbs.sanzhixiaozhu.com/home.php?mod=space&uid=242400&do=profile&from=space

    I’m very happy to uncover this great site.

    I want to to thank you for your time just for this wonderful
    read!! I definitely enjoyed every bit of it and i also
    have you book marked to look at new information in your site.

    Reply
  • old school new body review

    I quite like looking through an article that will make men and women think.
    Also, many thanks for permitting me to comment!

    Reply
  • The Fat Burning Kitchen Review

    Good information. Lucky me I found your site by chance (stumbleupon).

    I have saved it for later!

    Reply

Leave a comment

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