(feature): Backup from SMB tested

This commit is contained in:
Maksym Sadovnychyy 2024-11-01 10:14:27 -07:00
parent 95bf055a1c
commit ba0d08a89e
3 changed files with 90 additions and 26 deletions

102
README.md
View File

@ -21,23 +21,52 @@ A C# application designed to facilitate backup and restore operations to an LTO
1. Clone the repository: 1. Clone the repository:
```bash ```bash
git clone https://github.com/your-username/MaksIT.LTO.Backup.git git clone https://github.com/MAKS-IT-COM/maksit-lto-backup
``` ```
2. Ensure `.NET Core` is installed on your system. 2. Ensure `.NET8 SDK` is installed on your system.
3. Prepare a `configuration.json` file in the application directory with the following structure: 3. Prepare a `configuration.json` file in the application directory with the following structure:
```json ```json
{ {
"TapePath": "YourTapePath", "TapePath": "\\\\.\\Tape0",
"Backups": [ "WriteDelay": 100,
{ "Backups": [
"Name": "BackupName", {
"Barcode": "123456", "Name": "Normal test",
"Source": "path/to/source", "Barcode": "",
"Destination": "path/to/destination", "LTOGen": "LTO5",
"LTOGen": "LTO6" "Source": {
} "LocalPath": {
] "Path": "F:\\LTO\\Backup"
} }
},
"Destination": {
"LocalPath": {
"Path": "F:\\LTO\\Restore"
}
}
},
{
"Name": "Network test",
"Barcode": "",
"LTOGen": "LTO5",
"Source": {
"RemotePath": {
"Path": "\\\\nassrv0001.corp.maks-it.com\\data-1\\Users",
"PasswordCredentials": {
"Username": "",
"Password": ""
},
"Protocol": "SMB"
}
},
"Destination": {
"LocalPath": {
"Path": "F:\\LTO\\Restore"
}
}
}
]
}
``` ```
## Usage ## Usage
@ -57,7 +86,11 @@ Upon running, the following options will be presented:
2. **Backup**: Prompts the user to select a backup task from the configured list and initiates the backup process. 2. **Backup**: Prompts the user to select a backup task from the configured list and initiates the backup process.
3. **Restore**: Restores a previously backed-up directory from the tape. 3. **Restore**: Restores a previously backed-up directory from the tape.
4. **Eject Tape**: Ejects the tape from the drive safely. 4. **Eject Tape**: Ejects the tape from the drive safely.
5. **Exit**: Exits the application. 5. **Get device status**: Mostly used for debugging to understand if device is able to write
6. **Tape Erase (Short)**:
7. **Reload configurations**
6. **Exit**: Exits the application.
### Code Overview ### Code Overview
@ -72,13 +105,42 @@ Below is an example configuration setup for an LTO-6 tape generation backup oper
```json ```json
{ {
"TapePath": "\\\\.\\Tape0", "TapePath": "\\\\.\\Tape0",
"WriteDelay": 100,
"Backups": [ "Backups": [
{ {
"Name": "Monthly Backup", "Name": "Normal test",
"Barcode": "MB12345", "Barcode": "",
"Source": "/path/to/source", "LTOGen": "LTO5",
"Destination": "/path/to/restore", "Source": {
"LTOGen": "LTO6" "LocalPath": {
"Path": "F:\\LTO\\Backup"
}
},
"Destination": {
"LocalPath": {
"Path": "F:\\LTO\\Restore"
}
}
},
{
"Name": "Network test",
"Barcode": "",
"LTOGen": "LTO5",
"Source": {
"RemotePath": {
"Path": "\\\\nassrv0001.corp.maks-it.com\\data-1\\Users",
"PasswordCredentials": {
"Username": "",
"Password": ""
},
"Protocol": "SMB"
}
},
"Destination": {
"LocalPath": {
"Path": "F:\\LTO\\Restore\\Users"
}
}
} }
] ]
} }

View File

@ -12,7 +12,7 @@ public class LocalPath : PathBase {
public class PasswordCredentials { public class PasswordCredentials {
public required string Username { get; set; } public required string Username { get; set; }
public required SecureString Password { get; set; } public required string Password { get; set; }
} }
public class RemotePath : PathBase { public class RemotePath : PathBase {

View File

@ -1,6 +1,6 @@
{ {
"TapePath": "\\\\.\\Tape0", "TapePath": "\\\\.\\Tape0",
"WriteDelay": 1000, "WriteDelay": 100,
"Backups": [ "Backups": [
{ {
"Name": "Normal test", "Name": "Normal test",
@ -8,7 +8,7 @@
"LTOGen": "LTO5", "LTOGen": "LTO5",
"Source": { "Source": {
"LocalPath": { "LocalPath": {
"Path": "D:\\Program Files" "Path": "F:\\LTO\\Backup"
} }
}, },
"Destination": { "Destination": {
@ -23,8 +23,8 @@
"LTOGen": "LTO5", "LTOGen": "LTO5",
"Source": { "Source": {
"RemotePath": { "RemotePath": {
"Path": "\\\\nasrv0002.corp.maks-it.com\\Users", "Path": "\\\\nassrv0002.corp.maks-it.com\\data-1\\Users",
"Credentials": { "PasswordCredentials": {
"Username": "", "Username": "",
"Password": "" "Password": ""
}, },
@ -32,7 +32,9 @@
} }
}, },
"Destination": { "Destination": {
"Path": "F:\\LTO\\Restore\\Users" "LocalPath": {
"Path": "F:\\LTO\\Restore"
}
} }
} }
] ]