Integrate Restic with IDrive® e2
Restic is a modern, free, and open-source backup tool that can easily back up Linux, BSD, Mac, and Windows to different storage options, including self-hosted and online services. It ensures that your files can be restored when needed. You can configure Restic with IDrive® e2 hot Cloud Storage using the cloud object storage compatible API. Learn more about Restic.
Prerequisites:
Before uploading files using Restic, you require:
- An active IDrive® e2 account. Sign up here if you do not have one.
 - A bucket in IDrive® e2. See how to create a bucket.
 - A valid Access Key ID and Secret Access Key. Learn how to create an access key.
 - Restic should be installed on your system.
 
Install Restic
- Use the following commands to install Restic based on your operating system:
 - 
                                       Ubuntu/Debian
                                       
#sudo apt install restic - 
                                       Redhat/CentOS
                                       
#sudo yum install restic - 
                                       macOS
                                       
#brew install restic - Run the command to ensure that Restic is on the latest version:
 -      
                                       
#restic self-update 
Configure Restic with IDrive® e2
To simplify the use of Restic, IDrive® e2 recommends you keep Restic environment variables that you need in a file, for e.g. /etc/restic-env
- Save the following environment variables into the file "/etc/restic-env" 
export AWS_ACCESS_KEY_ID=<e2_access_key_id>export AWS_SECRET_ACCESS_KEY=<e2_secret_access_key>export RESTIC_REPOSITORY="e2_s3_endpoint/e2_bucket" (Ex: s3:https://u6a5.bn.idrivee2-61.com/restic)export RESTIC_PASSWORD_FILE=/etc/restic-password - 
                                 Secure the Restic files by changing ownership so that only "root/user" can see the files:
                                 #chown root:root /etc/restic-env#chown root:root /etc/restic-password#chmod 700 /etc/restic-env#chmod 700 /etc/restic-password
 - 
                                 Before you run any Restic commands, load the Restic environment variables with the following command so that Restic variables are always defined:
                                 
#source /etc/restic-env - Initialize the repository
                                 
#restic -r s3:https://u6a5.bn.idrivee2-61.com/e2restic initIn response, it will ask to set a Password for repository
Enter password for new repository and confirm the password - You will receive the following response after submitting the password created restic repository 7c81e95555 at s3:https://u6a5.bn.idrivee2-61.com/e2restic
 
Note: Create file "/etc/restic-password" and that file should contain one line with password (Ex: e2IDriveSecure)
Note: You must know your password to access the repository. Losing your password means that your data is irrecoverably lost.
Create Backup
To backup the local directory to the IDrive® e2 bucket using Restic, use the following example:
#restic -r s3:https://u6a5.bn.idrivee2-61.com/e2restic backup /home/test/Downloads/data/ 
                     
                     OR
If you have defined the "RESTIC_REPOSITORY" variable, then you do not need to add s3:https://u6a5.bn.idrivee2-61.com in the Restic command. Refer to the following example:
#restic backup /home/test/Downloads/data/ 
             
                  Response:
                       
                        enter password for repository:
                        repository 7c81e955 opened (version 2, compression level auto)
                        no parent snapshot found, will read all files
                     
                        Files: 480 new, 0 changed, 0 unmodified
                        Dirs: 4 new, 0 changed, 0 unmodified
                        Added to the repository: 6.690 MiB (6.137 MiB stored)
                     
                        processed 480 files, 918.807 MiB in 0:06
                        snapshot 6acaceab saved
                     
List all Snapshots
To list all the snapshots (Backup), run the below command:
 #restic snapshots  
                              Response:
                                
                                 repository 53cf382c opened (version 2, compression level auto)
                            
                              
                                 
                                 
                                   ID 
                                   Time 
                                   Host 
                                   Tags 
                                   Path 
                                  
                                 
                                    - 
                                
                                   
                                 
                                   c127649 
                                   2024-06-17 
                                   06:01:15 
                                   e2-centos8 
                                   /home/test/Downloads/test 
                                  
                                 
                                 
                                   0f9b20fa 
                                   2024-06-17 
                                   06:04:32 
                                   e2-centos8 
                                   /home/test/Downloads/data 
                                  
                               
- 
2 snapshots To restore a Snapshot to Directory (Drive)
To restore a snapshot (Backup), run the following command,
 #restic restore <snapshot_id> --target /home/test/data                                   
                                          
                                         
                                       Response:
repository 53cf382c opened (version 2, compression level auto)[0:00] 100.00%  2 / 2 index files loadedrestoring <Snapshot c1276496 of [/home/test/Downloads/test] at 2024-06-17 06:01:15.377037906 -0400  EDT  by  root@e2-centos8>  to /home/test/Downloads/restic                                    
                                       
                                   
                                       Summary: Restored 36 files/dirs (59.456 MiB) in 0:00
Note: Data restoration is handled by your specific backup solution provider and is affected by multiple variables that are unique to your environment. For application-related enquiries/support, it is strongly recommended you seek guidance from the technical team of your backup solution provider.