# [Server]How to backup a server elegantly

## At the begining

It’s obvious that a backup work has great significance for something lost or damaged.

I did got my data back via a backup when I accidently deleted the database.

## The way to backup

We need to prepare a second copy of a file, program, database, etc, that can be used if the main one fails.

There are two ways to make a copy of your files: the one is exporting automatically; the other is typing every command by hands.

I chose the former. Though it has a little bit difficulty at first.

• Use a backend storage server
If you download your files directly from a VPS, the speed will be limited by the bandwidth between the VPS and your computer.(Servers in mainland China usually has only 1M for free, while in US, that can up to 1G.)
So, If your server was located in mainland China, I’ll advise you to choose the latter way.
No bandwidth limited and it just cost a little.

## Let’s do it

Using Alibaba cloud’s Object Storage Server(oss) as an example.

### Step 1: Mount

The first thing you need to do is that mount the oss on your server via ossfs.
Having completed the first stage, you can move onto Step 2.

### Step 2: Script

Write a script like this:

/home/backup/ossfs is a directory where the oss mounted.