forked from SaveMyNode/savemynode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecovery_operations.py
More file actions
23 lines (20 loc) · 832 Bytes
/
recovery_operations.py
File metadata and controls
23 lines (20 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# recovery_operations.py
import subprocess
# @OPERATIONS
#
# Currently WIP this is just some boilerplate code
#
def recover_btrfs(drive):
try:
command = f"btrfs restore {drive} /recovered_data"
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
return f"Btrfs recovery successful: {output.decode()}"
except subprocess.CalledProcessError as e:
return f"Error during Btrfs recovery: {e.output.decode()}"
def recover_xfs(drive):
try:
command = f"xfs_undelete -v {drive} /recovered_data"
output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
return f"XFS recovery successful: {output.decode()}"
except subprocess.CalledProcessError as e:
return f"Error during XFS recovery: {e.output.decode()}"