How to delete all files from user share


wsume99

Recommended Posts

I'm running 6.5.3.

 

I have an AFP share that I created specifically to store time machine backups from a MBP. I no longer want to use time machine backups and want to delete the share. I cannot remove the share until it's empty. I deleted the contents of the share from a windows PC. I get nothing from a ls query via CLI. However when I try to delete the share using rm -rf /mnt/user/TimeMachine I get an error message stating the share is not empty. Something about an .appleDS file in the share. This was done again after I executed a rm -rf *.* in the /mmt/user/TimeMachine share from the CLI but the same error occurred. What am I missing? How do I empty the share so I can delete it? Any help would be appreciated.

Link to comment

Major faceplam moment just happened:

I confirmed that the AFP share was not mounted on the mac.

Changed Export to No in the Share settings

Opened a telnet to the machine as a root user

Navigated to /mnt/user/TimeMachine and ran ls -lah

The .appleDS was still present as well as a ./ and ../ directory

I then executed a rm -rf /* command thinking it was limited to the path I had already navigated to but nope.

Flash drive is empty now. Hard lesson to learn.

Well that's certainly one way to delete a user share.

 

Now researching how to restore an active array from nothing 😬

 

Link to comment
1 minute ago, trurl said:

Of course starting from / will attempt to delete everything, including your flash and all the data on your disks. The question is how far did it actually get. I hope you stopped it somehow.

Did that once...  You'd be amazed how fast you can pull out a power cord if you have to.

Link to comment
15 minutes ago, trurl said:

Of course starting from / will attempt to delete everything, including your flash and all the data on your disks. The question is how far did it actually get. I hope you stopped it somehow.

I was on a laptop upstairs. I'd say it went about 2 minutes before I ran downstairs and held down the power button and killed the server. Hopefully most of the stuff on the drives was untouched. I was in a hurry to catch a flight so I won't be able to assess the situation until I get back home in a few days. Unraid is my only linux machine and it's just a basic media server running a few apps for me so I hardly ever have to touch it let alone mess around in the cli. Looks like I'll be getting a little refresher when I get home. I did find an old backup flash drive but I think it was from when I was running v5. I think I have a newer copy on a non-array drive that I used for apps.

Edited by wsume99
Link to comment

An old backup of flash can be hazardous since its disk assignments may be wrong. More than one person has restored an old backup and when Unraid started up it thought their old parity (now re-used as data) was still the parity disk and so overwrote that data with parity.

 

For future reference, you can always download a current backup of flash at Main - Boot Device - Flash - Flash Backup. You should get a backup anytime you make changes in the webUI, since that is where those changes are stored. But it is especially important when you make any changes to disk assignments.

Link to comment
4 minutes ago, trurl said:

An old backup of flash can be hazardous since its disk assignments may be wrong. More than one person has restored an old backup and when Unraid started up it thought their old parity (now re-used as data) was still the parity disk and so overwrote that data with parity.

 

For future reference, you can always download a current backup of flash at Main - Boot Device - Flash - Flash Backup. You should get a backup anytime you make changes in the webUI, since that is where those changes are stored. But it is especially important when you make any changes to disk assignments.

Yep, I was just reading a thread about recovering from a failed flash drive. I think you also posted in that thread as well. (Thanks for your help here btw) I have my drives arranged in my case in a certain order so I can get the assignments set correctly. I made some adjustments to my go file to run some custom scripts. I can get those from my old flash drive. Is there a specific file(s) that includes the share settings? Even if I cannot reuse it just being able to reference it would be helpful. Then it's just work to setup all my apps again because I don't have a recent copy of those. I need to read up on recovering docker containers. Assuming I stopped the erasing before it cleared my app drive, which I think is a safe assumption, then all of them should still be there. Not sure what needs to be on the flash drive to interface with the apps that are on the drive.

Link to comment

If you boot up with the wrong assignments you may not get a chance to SET them before taking some damage. Just depends on the specifics. Have you ever reused a parity disk as data?

 

The disk assignments are in config/super.dat. If Unraid doesn't see this file it will start with no disks assigned.

 

Most of the other files on flash are text (like many configuration files in Linux) and you can examine them yourself. Also, see this topic in the Upgrading wiki:

 

https://wiki.unraid.net/Upgrading_to_UnRAID_v6#Files_on_flash_drive

 

Some more info about user shares. The user shares are just the aggregate of all top level folders on cache or array, so any top level folder on cache or any array disk is automatically a user share named for the folder. If there isn't a specific .cfg file for a particular user share in config/shares, that user share will have default settings, but it will still be a user share if it is a top level folder.

Link to comment

Oh, I won't reuse the super.dat file. I think it's best if I just start with a clean install and manually set the drive assignments. I have repurposed a 3TB parity drive as a data drive and since I'm not certain about the backup copy of my flash drive I really have no other choice. I am pretty certain I can get the assignments correct because of how I physically installed the drives in my case. Once I have the array running I'll copy over my scripts and modify the go file. The rest is just a lot of work with the old flash files for reference as well as the contents of each drive as you suggested for shares.

 

Here's a scary question...

Since I killed the power in the middle of the delete operation and the flash drive was totally wiped I'm assuming that at least something somewhere on one of my array drives or app drive was also hit. Is there a way to check for partially deleted flies after I am back up and running.

Link to comment
9 minutes ago, wsume99 said:

I am pretty certain I can get the assignments correct because of how I physically installed the drives in my case.

If any doubt, you can always assign all disks as data. The one that shows as not having a mountable filesystem will be parity. If more than one is unmountable, seek further advice.

 

11 minutes ago, wsume99 said:

Is there a way to check for partially deleted flies after I am back up and running.

Not within Unraid. I have heard (but can't remember specifics) of other utilities that might work with individual Unraid disks for file recovery but of course you would invalidate parity if you took them out of the array. Since you may be starting over anyway I guess parity isn't the most important thing to start with. You would need something that could work with whatever filesystem was on the disks (ReiserFS, XFS, btrfs).

Link to comment
1 hour ago, trurl said:

You would need something that could work with whatever filesystem was on the disks (ReiserFS, XFS, btrfs).

I have a mixture of ReiserFS and XFS. Any drive I added after XFS was introduced was formatted as XFS. I recall reading something in a post on the forum indicating this was a good way to proceed.

Link to comment

Yes XFS is the common recommendation, and better than ReiserFS. I don't have any specifics to offer as far as recovery. Maybe googling something like XFS file recovery or such. I know it has been mentioned in the forum so maybe someone else will remember.

 

Might be just as well to wait and see what you have to work with.

2 hours ago, wsume99 said:

Is there a way to check for partially deleted flies

Not sure what a "partially deleted file" would be though. When you delete a file it isn't "erased". Every bit on a disk has a value. All deleting does is mark the file as deleted in the filesystem so its space can be reused. All its bits are still there until overwritten. That is how files can be "undeleted" and recovered. You probably already know all that. If the "marking as deleted" was somehow incomplete then I'm not sure what you would get, maybe a partially corrupted filesystem. Most files will either be not deleted, or deleted. Nothing partial about that, but their data isn't gone until it gets overwritten. On the other hand, when filesystem repair recovers files I know that something that is often lost is the actual name of the file and the folder it was in. So sometimes it's really more trouble than it's worth to try to sort it out, depending on how important the data is.

Link to comment
4 hours ago, trurl said:

Not sure what a "partially deleted file" would be though.

I should have been more clear. I meant it was marked deleted in the filesystem but not yet overwritten. Since I wasn't writing anything to the array I'm assuming that nothing on any of the data disks would have been overwritten and all I am dealing with is files marked deleted in the filesystem that remain on the drive Or perhaps something corrupted because I killed the power as it was trying to mark a file deleted but didn't complete the operation as you pointed out.

Everything I care about data wise is backed up onto another device so I'm just trying to minimize my time repairing the damage. 

 

Thanks again for all the advice in this thread. It had been very helpful so far. Time to research UFS explorer. 😁

Link to comment

Did a little reading on UFS Explorer. There are several versions. It looks like the standard version would meet my needs. It can restore accidentally deleted files and it works with XFS and ReiserFS as well as FAT32 🤔🤔.  So an interesting thought popped into my head. Why couldn't I also use the software to recover the files that were deleted from my flash drive? Seems reasonable to me. It would probably save me several hours of setup time getting the system back up and running, shares setup and all my apps installed and reconfigured. Any reason not to try that?

Edited by wsume99
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.