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.
Change the default backup folder location
- Connect your Linux machine as a root user
Syntax: sudo -i
- 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
- Verify the created backup folder
Syntax: ls -l
- 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
Change the group permission from root to mssql
Syntax: chgrp mssql /var/sqlbackup
- 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
- After applying the new default backup folder location, you need to restart the SQL Server service.
- Let’s verify the newly updated default backup folder location
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”
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!
Thanks John for reading the post! It will be an esteem to have your valuable input…..
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.
Thanks for reading and adding to your blogroll..
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
Thank you! I am really glad, it was helpful to you….
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.
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….
It’s very easy to find out any matter on web as compared to
textbooks, as I found this paragraph at this web page.
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.
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.
I quite like looking through an article that will make men and women think.
Also, many thanks for permitting me to comment!
Good information. Lucky me I found your site by chance (stumbleupon).
I have saved it for later!