× NETGEAR will be terminating ReadyCLOUD service by April 1st, 2023. For more details click here.
Reply

Re: Rebuilding shares using SSH possible?

whc
Aspirant
Aspirant

Rebuilding shares using SSH possible?

Just mistakenly deleted shares when I deleted stuck snapshots using SSH, is it possible to rebould those shares with SSH, have taken screenshot, so have the ID and gen numbers, maybe a SSH command can do the job?

Model: RN31600|ReadyNAS 300 Series 6- Bay (Diskless)
Message 1 of 13
Sandshark
Sensei

Re: Rebuilding shares using SSH possible?

Do you mean rebuild them with their contents intact?  BTRFS RESTORE sounds like it should be able to, but I've not used it.

 

Step one is to get your NAS into read-only mode pronto so that nothing gets overwritten.

 

Then, you can start investigating here: https://superuser.com/questions/415132/how-to-undelete-files-on-btrfs-partition 

Message 2 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

How to enable read only mode?

 

Message 3 of 13
Sandshark
Sensei

Re: Rebuilding shares using SSH possible?

From the boot menu: How-do-I-access-the-boot-menu-on-my-ReadyNAS-316-516-716 

 

Of course, once you are ready to start, it'll have to be out of read-only mode to do the actual recovery.

Message 4 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

Cant really find anything that works just yet, have about 4 TB files in those deleted shares, is it not possible to just backup every deleted files to another readynas and then sort them form there?

 

SSH is not my strong souit, only messed with it to get the "stuck" 2tb snapshots removed from my 316.

 

Spend the whole day reading how to backup without getting any smarter, btrfs restore, sounds good, but what command to restore entire shares/folders and not just single files? 

Message 5 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

btrfs restore, don't understand how to put togheter a command line for restore a share, cannot fint any examples online, below is the options:

 

btrfs restore [options] <device> <path> | -l <device>

 

    Try to restore files from a damaged filesystem (unmounted)

 

    -s|--snapshots       get snapshots

    -x|--xattr           restore extended attributes

    -m|--metadata        restore owner, mode and times

    -S|--symlink         restore symbolic links

    -v|--verbose         verbose

    -i|--ignore-errors   ignore errors

    -o|--overwrite       overwrite

    -t <bytenr>          tree location

    -f <bytenr>          filesystem location

    -u|--super <mirror>  super mirror

    -r|--root <rootid>   root objectid

    -d                   find dir

    -l|--list-roots      list tree roots

    -D|--dry-run         dry run (only list files that would be recovered)

    -F                   force (do not prompt on large files looping frequently)

    -X                   eXtreme search (use both BTRFS_DIR_ITEM_KEY and BTRFS_DIR_INDEX_KEY)

    --path-regex <regex>

                         restore only filenames matching regex,

                         you have to use following syntax (possibly quoted):

                         ^/(|home(|/username(|/Desktop(|/.*))))$

    -c                   ignore case (--path-regex only)

Message 6 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

Or maybe there is a command for using rsync, and backing up all data on the nas drives, no matter if deleted or not?

Message 7 of 13
Sandshark
Sensei

Re: Rebuilding shares using SSH possible?

Rsync cannot see the deleted subdirectory or the files in it, so it cannot do anything.  Most of the tools that are around for restoring "lost" files in linux don't work when you lose an entire btrfs subvolume (which a share is), not just a directory.

 

Did you go to the script that was referenced in the other article? http://www.infotinks.com/btrfs-undelete-undeleting-recovering-accidentally-deleted-a-subvolume-or-fi... 

 

I believe btrfs rescue can copy everything, including deleted subvolumes, from one volume to another, but it will truely copy everything.  So you need enough space to also hold a copy of whatever you have not accidently deleted as well as what you have.  https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-rescue .

 

This is where the best answer is "restore from your backup".  I assumed you would not have asked if you had a backup.

Message 8 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

Thank you, will look into that. Right now am thinking of making images of the drives and experiment with the images, makes me a little nervous trying different commands in terminal not fully understanding them, even though I have the server in read mode.

 

Thinking of running Linux on my PC, seems to be no good free software to make images of Linux formatted drives. Maybe Mac is able to do that as well?

 

I plan to use my other readynas as backup, so I only read from my 316, have around 23tb free on the other server (416), and this 316 I have 6x3TB so 18TB total hoping it is fine. Maybe use a USB drive between the two NAS servers. Else I have 4 free SATA ports in my PC, could just connect som drives directly to that.

 

No backup I'm afraid, allot of images and home video files, backups from my computers, and such, so really would be unhappy not getting this'd files back. Just so darn expensive to backup to cloud and/or a nas server in another location, thinking of it often, but have not found a solution that does not cost to much, just a private home user.

Message 9 of 13
Sandshark
Sensei

Re: Rebuilding shares using SSH possible?

Any software that will make a block-by-block clone of the drives won't care about the formatting.  Clonezilla and EaseUs Todo Backup are ones I am aware of that will do that under Windows

 

Most of my backup is also here at my home.  I have a remotely located NAS with my brother in North Carolina (while I'm in Florida), but just for the really irreplaceable/critical stuff.  If I did not have him as an option, I'd likely go with a cloud solution for that stuff.

 

My movies, music, etc. are mostly replaceable (assuming insurance covers loss of the original media if it's due to fire, theft, or huricane), but tax stuff and family photos aren't.  Recovering the movies alone would take weeks at the recovery speed of most cloud syatems, and I just can't justify having that big a NAS with my brother.

Message 10 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

Right now im in the process of making imgage files of my drives, running ubuntu on my PC, seems to be the best solution, and once done making images of all my drives (on 4 out of 6 now), thinking of building the RAID 5 setup in ubuntu, and try first the free software called TestDisk, and see if that works, else there is so much data recovery software out there, just don't want to spend money on software that does not work proper. And ofcurse different command lines to run in terminal, not my strong souit so hoping for some GUI to get the data back.

 

But how to build a RAID 5 setup out of img files, is the next challange. Don't have anough SATA ports on my PC to connect all 6 drives physically, so if I want to use some kund of GUI have to go with images of the drives, in Windows I don't know if that is possible. Also have MacBook, so maybe that is better than windows. But for now Ubuntu seems to work fine, and sees each drive as part of a Linux Raid v1.2. Takes about 9 hours to make images of 3TB drive to my Readynas 426, so in a few days I can experiment.

 

In the future will use OneDrive to backup just the most important things, since I have a few accounts left from my office subscription, so I can backup 1TB of most important folders. Used Amazon back in the day when they offered unlimited storage space, but else the Netgear Vault I think is too expensive IMO.

 

Well any helt building RAID setup with image filen, eiter in Ubuntu, MacOS or Windows 10 is very welcome.

Message 11 of 13
Sandshark
Sensei

Re: Rebuilding shares using SSH possible?

Best of luck to you.  I took a quick look at TestDisk, and it appears to be about recovering lost partitions.  Unless I have completely misunderstood you, you have lost a share, which is a BTRFS subvolume, not a partition.  

Message 12 of 13
whc
Aspirant
Aspirant

Re: Rebuilding shares using SSH possible?

Well than you :). Don't know much about NAS storage and their setup, thats why I always have bought finished systems, not messing around with linux and subvolume, shares, or what ever, so still have allot to learn, never recovered tada from a Raid 5 system before, have from single and Raid 1 systems, much easier, none of this makes sense to me, thats probably why I deleted it in the first place, thinking it was a snapshot (had 2TB snapshot that would just not delete).

 

Have been around the house this evening, and found several old harddrives and DVD backups, but then I though to see if Amazon Drive still by any chance would save my data after this time, and YES! 3.23 TB data still on the drive, backup from this Readynas, have used 3.23TB of my free 5GB storage :D. Well in the process of downloading all that data now, have igBit connection so it wil not take that long. Not THAT worried about messing up the backup of my deleted shares now, most of the old unreplacable data is in that Amazon backup, puh! Still going to try and get all the data up to date from the NAS server thugh, TestDisk is then probably not the way to go, thanks for the heads up :).

Message 13 of 13
Top Contributors
Discussion stats
  • 12 replies
  • 1278 views
  • 0 kudos
  • 2 in conversation
Announcements