How to recover a failed drive using Snapraid

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to show you how to recover a dead Drive using snap rate the worst happened you lost one or more drives don't worry the first thing that you need to do is Don't Panic we can recover all of your data let's jump right into it the first thing that we need to do is we need to disable the automation script that creates a sync creating a sync will make changes on your drive and we don't want that if you configure your deletion threshold properly then the script should fail and send you an email notification this is a good warning to go and check if you if you have a failed Drive let's disable the automation first to do that we're going to use vim and we're going to edit our Chrome tab now the only thing we need to do here is we need to go at the beginning of the line and comment out our scheduled job here and then we just do write and quit to save so now we've disabled the automation to check if we have a fail drive or we have errors on the driver rate there's a good utility from snap rate called check so we can run a snap raid check this will go and it will try to read all of your driver array and all your drives and it's going to tell you if you have missing files or if something got deleted or if you have an entire drive that failed so in this case we have 13 435 errors meaning that one of our drives is failed or that we deleted a lot of files if we check our drives now with LSB okay we can see that we have our disk 2 our data disk 2 our data disk 1 and our parity Drive mounted these drives were full I put some files there and then I delete them just to simulate the drive failure so if we CD into the slash MNT disk one we can see that we have some files there and if we do the same thing but on disk 2 we can see that the drive is empty meaning that we lost all the files from drive 2. so if we do LSB OK again in this case what you what would want to do is you would turn off your server or turn off your machine remove the dead drive and then replace it with a new Drive once we have a new drive it should be detected here so to simulate that I already added an extra drive to this machine so we're going to use our drive sdd as our new fresh drive to recover the data first thing we're going to do is we're going to format and create a file system on this drive to do that we're going to use fdisk slash Dev slash sdd we're going to create a new GPT partition and then we're going to create a new Partition and just leave everything default it's fine and then we're going to press W to write our changes so if we do lsblk again now we have an sdd one partition now we're going to create a file system on it for my preference is xfs just remember that the drive that you're going to replace it with it needs to be the same size or larger to be able to recover all your data let's do our xfs file systems to do that we're going to use mkfs.xfs and then we give the path to our partition sdd1 so we check our drives again they all look fine now we need to unmount all our Mount points and then replace the drive first we're going to unmount the merger First Mount point to do that we're going to use U mount l slash MNT storage now we're going to unmount disk one we're going to unmount our fail drive if it's still there or not just remove it we don't need this Mount Point anymore and we're going to unmount our parity drive to okay so if we check our Mount points now nothing is mounted meaning that we can start manipulating the data we need to mount the new Drive in the same Mount Point as the fail drive in this case is disk 2. so let's edit our FS Tab and then Mount the new Drive remember we need to have the the drive ID so let's get the ID first we're going to use ls-l slash Dev disk by ID and remember our partition is sdd1 here we're going to look for sdd1 and as you can see is this is our disk ID now we're going to go to edit our fsw now our failed Drive was Drive number two so we're going to replace the ID of the failed drive with the ID of the new Drive I'm going to paste the new Drive well it needs to be slash Dev slash disk by ID and then the new ID of the drive right so we now write and quit our changes now we're going to mount all our drives again so we're going to do Mount Dash a this is going to mount everything that is on the fs tab is asking us to do a demon reload we're going to do it too we copy that systemctl demand reload and now let's check our Mount points DF H as we can see we now have our partition sdd which is our new Drive mounted in the old Mount point of the failed drive now it's time to fix first we need to go and grab the name of the drive from the configuration file of snap rate and if you remember the our configuration file is in slash Etsy snapper.com so let's open this file I'm going to open it using Vim so Etsy snapgrade.com and as we can see the name of the drive that is mounted into slash MNT disk 2 it's called Data 2. so just remember this name because we need it for our fixed command now let's exit from here so this is the command that you need to execute to recover all your data it's snap rate Dash D and then we give the name of the data drive that we took from the snapper.configuration file so in this case it's data 2 and then we can give it a dash l and a log file so fix.log this is going to Output all the output from this command into a log file if we need to analyze any issues and then is just fix so snap rate Dash D the name of your drive if you want to have a log file for this and then fix let's recover our data and as you can see Snapper is going to go ahead and try to recover all the missing files from this drive so it's done it says that there was 13 437 errors and 13 437 recovered errors So Perfect all our files are there now let's validate to validate this we can use a snap Rate Check what this command will do is check your recovered data and compare it to the parity data to make sure that everything is good and there's no corruption so let's run this depending on how big your driver Ray is this could take very long in this case there's not a lot of data in this drive so it takes a couple seconds just make sure that you have enough time to check all your data now that the check command is telling us that all the data is good is not corrupted and everything is fine let's go and do a list of our recover Drive so we just go to CD MNT disk MNT disk 2. and as you can see all our files are back into place uh congratulations we've recovered all your data thank you for watching and if you like this video give it a thumbs up and subscribe to the channel if you want to see more content like this leave any questions or suggestions in the comment section below and I'll see you on the next one foreign
Info
Channel: Distro Domain
Views: 1,166
Rating: undefined out of 5
Keywords:
Id: fmuiRLPcuJE
Channel Id: undefined
Length: 8min 4sec (484 seconds)
Published: Mon Jul 31 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.