Jump to content

Best Way to Delete Files in Array?


Recommended Posts

It is a 2TB drive that is 95% full.  I have all files in a directory and so I am running the command on the directory.  It is taking some time to update parity.  Also I do have 20 drives in the array (not including parity and cache drives).

 

Edit:

Is there a quicker way where I can wipe the disk out and rebuild parity?  I have 5 more full disks in the array that I would like to wipe clean too.  I rarely have to touch my unRaid server and so when I do, I cannot remember anything  ;D

Link to comment
  • 4 weeks later...

Not to hijack this thread - but had the same question, what if I delete it from the shares on a Windows machine, would it be removed from the array as well and space marked as available?

 

Is it advisable to run a parity check afterwards if I do that?

Link to comment

Not to hijack this thread - but had the same question, what if I delete it from the shares on a Windows machine, would it be removed from the array as well and space marked as available?

 

Is it advisable to run a parity check afterwards if I do that?

You can delete files from windows.  You'll need to delete the directory from the unRAID shares page by blanking out its name (once the share is empty)

 

Parity is automatically kept in sync.

Link to comment

You can delete files from windows.  You'll need to delete the directory from the unRAID shares page by blanking out its name (once the share is empty)

 

Parity is automatically kept in sync.

 

Thank you Joe. What if I am deleting only a few files and not the entire contents of the share, would I need to anything else on the unRaid box after I do the deletion on Windows? Also there is no "recycle bin" functionality right, any ways to recover something that you accidentally deleted?

 

 

Link to comment

You can delete files from windows.  You'll need to delete the directory from the unRAID shares page by blanking out its name (once the share is empty)

 

Parity is automatically kept in sync.

 

Thank you Joe. What if I am deleting only a few files and not the entire contents of the share, would I need to anything else on the unRaid box after I do the deletion on Windows? Also there is no "recycle bin" functionality right, any ways to recover something that you accidentally deleted?

you do not need to do anything special.  You are correct, by default there is no

recycle-bin" unless you configured one by editing your smb-extra.conf file.

Link to comment

you do not need to do anything special.  You are correct, by default there is no

recycle-bin" unless you configured one by editing your smb-extra.conf file.

 

Thank You. Appreciate the prompt response.

 

I have no knowledge or idea how to edit that. I'm completely new to Linux. So till I can learn or even understand it well, I would just be extra careful not to delete anything from the array by mistake. Just built my brand new unRaid box and I'm loving it.

 

Thank you for all the tools and informative posts you have developed and written, appreciate it greatly. Makes life for newbie's like me much easier.

Link to comment

you do not need to do anything special.  You are correct, by default there is no

recycle-bin" unless you configured one by editing your smb-extra.conf file.

 

Thank You. Appreciate the prompt response.

 

I have no knowledge or idea how to edit that. I'm completely new to Linux. So till I can learn or even understand it well, I would just be extra careful not to delete anything from the array by mistake. Just built my brand new unRaid box and I'm loving it.

 

Thank you for all the tools and informative posts you have developed and written, appreciate it greatly. Makes life for newbie's like me much easier.

See here:

http://lime-technology.com/forum/index.php?topic=5446.msg134218#msg134218

 

Joe L.

Link to comment

There is already a file by the name smb-extra.conf in the config dir. Do I overwrite that?

Append your new lines to the end of it.

Also I'm using Notepad++ as the editor and saving the file as unix script file - would that work? Attached a copy of the file.

That will work.

 

You might now also need to create the BIN directory by typing

mkdir /mnt/user/BIN

I'm not sure the copies of files will be saved unless the directory to save them in exists first.

 

Joe L.

Link to comment

I run a script daily (via cron) that deletes from the RecycleBin anything older than 7 days.

You might find it useful, otherwise it could get very very large.

 

echo "===================================="
echo "===================================="
echo "Running RecyclebinCleanup on `date` "
find /mnt/user/BIN -type f  -atime +7 -print -exec rm -fr {} ';'

Link to comment

Thank You - Joe and graywolf - appreciate all the help.

 

I have a disk on which pre-clear is running right now (post read @ 70% when I left it in the morning) , so I haven't yet rebooted the system, will do and post details.

 

@ Joe L. - thank you will create the directory, even if the other script would create it, it wouldn't hurt creating it before -right?

 

@graywolf - Thank you! Love the idea and thanks for the script, but newbie question for you - how do I run it via cron, could you explain or link me some thing that I can read through.

 

Link to comment

You can add the following to your go file so that it will be added to cron on each boot

 

Of course, you'll want to make sure the path/file names match what you use.

Mine is set to run a 05:10 each day.

 

crontab -l > /tmp/file
echo '#' >> /tmp/file
echo '#Run RecycleBin cleanup script' >> /tmp/file
echo '10 05 * * * /boot/scripts/RecyclebinCleanup.sh 1>>/mnt/user/pmm/RecyclebinCleanup.log 2>&1' >> /tmp/file
echo '#' >> /tmp/file
crontab /tmp/file
rm -f /tmp/file

 

Yes, creating your BIN directory beforehand. IF you are 5.x, then you will want to do the following also. (ignore if on 4.7)

 

chown nobody:users /mnt/user/BIN
chmod 0770 /mnt/user/BIN

 

That will ensure the permissions are correct. Or you can just rerun the New Permission util.

 

Link to comment

Thank you again!

 

I have rebooted after adding the smb-extra.conf file. Everything looks okay and the BIN directory does show up under my shares, problem is I tried by deleting an unwanted file within a sub-directory in the share and it did not show up in the BIN folder - got permanently deleted.

 

Does that mean that the recycle bin is not working as it should? Or is it because it was deleted from a sub-directory and not the main share?

 

Here is my folder tree that is shown on the network:

 

//tower/movies(main share that is mapped to my Windows Machines)/English Movies/Movie 1(e.g. 127 Hours)/Movie1.mkv(all movie and metadata files). I deleted a backdrop (jpeg) file - backdrop.jpg within the Movie 1 folder, and it did not show up in the recycle BIN folder.

 

@ graywolf - thank you very much for the code and the instructions on how to get it added. I haven't added these lines to config/go file yet, thought I would wait until I get the BIN setup right. I do plan to add it on, and yes I am using unRaid Version 5.0-rc3 - so I would add these 2 lines to the config/go file - correct?

chown nobody:users /mnt/user/BIN
chmod 0770 /mnt/user/BIN

 

Thanks for all the help so far.

Link to comment

only need to do it once, after the BIN directory is created.

 

Or if you do a ls -l /mnt/user and BIN already shows nobody users then no need

 

Deleting from sub-folders should use the BIN

 

Just to make sure you are aware, the BIN only works when you delete using the SMB shares. So if you are telnet/putty into unRaid and delete from there, that is not SMB so they are permanently deleted.

 

If you delete from your windows/mac machine that uses the SMB shares, then it should go into the BIN

 

Link to comment

I am deleting from my windows machine - not command line. I deleted from the windows machine and went back into the BIN folder on the same machine to see if the deleted file showed up there - no file!

 

Also, when I right click and the file and choose delete in the windows machine, it tells me that the file is going to be permanently deleted - do you still want to do this? Is that supposed to be the case? I assumed it would be because it wouldn't got to the Windows Recycle Bin, but to the one we created on the unRaid box right?

Link to comment

I am deleting from my windows machine - not command line. I deleted from the windows machine and went back into the BIN folder on the same machine to see if the deleted file showed up there - no file!

 

Also, when I right click and the file and choose delete in the windows machine, it tells me that the file is going to be permanently deleted - do you still want to do this? Is that supposed to be the case? I assumed it would be because it wouldn't got to the Windows Recycle Bin, but to the one we created on the unRaid box right?

you might want to post the contents of your smb-extra.conf file  (or zip a copy and attach it to your next post)

 

Joe L.

Link to comment

Joe - the file is attached on Reply#10 on this topic.

 

Haven't changed anything on that created the file in Notepad++ and saved it as a Unix script on to the /boot/config folder, the other thing I did install yesterday was simple features, before I rebooted, which is working great.

Link to comment
  • 2 months later...

Hi, still having this issue - had not deleted anything for quite sometime but I did now and I'm still not seeing the recycle bin being used.

 

I checked the smb-extra.conf file, and I think I see what the issue is but don't know how to fix it, so all help is welcome.

 

For some reason the script under global is deleted after the reboot - I do copy and create the file with the whole script below, exactly as is:

[bIN]
path = /mnt/user/BIN
read only = No

[global]
vfs objects = recycle 
        recycle:repository = /mnt/user/BIN/%m
        recycle:keeptree = Yes
        recycle:touch = Yes
        recycle:versions = Yes
        recycle:exclude = *.tmp
        recycle:exclude_dir = /tmp
        recycle:noversions = *.doc

 

But after the reboot the part that remains is as follows:

[bIN]
path = /mnt/user/BIN
read only = No

 

Attaching a copy of the file here. I have tried it twice by editing the file, saving and rebooting, no luck - recycle bin is still not used. Any ideas why this is happening?

 

Thanks - Abhi

 

Edit: I am using Notepad++ as the editor and saving the file as a UNIX script file. I also have the user share - BIN - already created.

smb-extra.conf

Link to comment
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...