Reply

Re: Windows SMB created folder undeletable

nickjames
Luminary

Windows SMB created folder undeletable

At one point I started creating folders in the root directory of my RN via Windows SMB instead of creating shares on the RN. I'm trying to delete one of those SMB folders that I created. It successfully deletes but reappears moments later. How can I permanently delete this folder? 

Message 1 of 16

Accepted Solutions
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

When I rerun that command, snapper list-config, all of the subvolumes shown match the GUI and Windows with the exception of NOT seeing Test123 in the SSH session.


My guess here is that you renamed the original share folder to Test123 from Windows.  Then you deleted the share from the NAS admin UI.  That would generate an error because the share folder no longer existed.  But it appears to have deleted the share from the ReadyNAS database, and also deleted the snapshot configuration.

 

Before you can delete Test123, you need to delete all the snapshots that it has.  If you had a snapper config, you could have deleted them as a group.  But since you don't, they need to be deleted one at a time. From your earlier btrfs subvolume list /RAID50.6x2TB | grep -i Test123 we can see 83 snapshots that need to be deleted.

 

The first "real" snapshot in your older post has a path of Test123/.snapshots/10/snapshot

To manually delete that one, enter btrfs subvolume delete -c /RAID50.6x2TB/Test123/.snapshots/10/snapshot

 

It could take a while for the deletion to complete (not sure how long).

 

If it does complete with no error, proceed to the next one (/RAID50.6x2TB/Test123/.snapshots/41/snapshot.  Continue until you delete them all (ending with /RAID50.6x2TB/Test123/.snapshots/1517/snapshot).  Note if you use the up arrow key on the keyboard, you will see the previous command.  You can then use the left and right arrows to position the cursor, and change the numeric value (10 to 41, etc until you get to 1517).  That should reduce the amount of typing.

 

When they are all done, then enter btrfs subvolume delete -c /RAID50.6x2TB/Test123/.snapshots to delete the .snapshots folder and finally btrfs subvolume delete -c /RAID50.6x2TB/Test123/ to delete the share.

View solution in original post

Message 14 of 16

All Replies
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

At one point I started creating folders in the root directory of my RN via Windows SMB instead of creating shares on the RN. I'm trying to delete one of those SMB folders that I created. It successfully deletes but reappears moments later. How can I permanently delete this folder? 


Are you certain this is a folder you created?  There are some folders that aren't shares, but still are folders created by the NAS - Home of course, but also some hidden folders.

 

It sounds like some process is actively using the folder, and recreating it when it isn't found.

 

Have you tried ssh?

Message 2 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable

Hi @StephenB - Yes, I'm certain that I created it. I had never tried SSH until today. I'm not able to get it to remove but my SSH skills aren't the best. Here is some of the output:

 

root@DUMPSTER:/RAID50.6x2TB# ls
... Test123
root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123
rm: cannot remove 'Test123': Directory not empty
root@DUMPSTER:/RAID50.6x2TB# ls Test123
root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123/
rm: cannot remove 'Test123/': Directory not empty
root@DUMPSTER:/RAID50.6x2TB# ls
... Test123
root@DUMPSTER:/RAID50.6x2TB#

Message 3 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:


root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123
rm: cannot remove 'Test123': Directory not empty
root@DUMPSTER:/RAID50.6x2TB# ls Test123
root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123/
rm: cannot remove 'Test123/': Directory not empty


Can you try ls -als Test123

 

Maybe also try setting verbose mode on the rm command: rm -vrf Test123

Message 4 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable


@StephenB wrote:

@nickjames wrote:


root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123
rm: cannot remove 'Test123': Directory not empty
root@DUMPSTER:/RAID50.6x2TB# ls Test123
root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123/
rm: cannot remove 'Test123/': Directory not empty


Can you try ls -als Test123

 

Maybe also try setting verbose mode on the rm command: rm -vrf Test123


I've been trying to post but for some reason it keeps getting deleted? Let's try again... I'm still not able to delete that folder:

 

root@DUMPSTER:/RAID50.6x2TB# ls -als Test123
total 32
 0 drwxrwxrwx+ 1 guest guest  20 Jul 15 22:51 .
32 drwxr-xr-x  1 root  root  436 Sep  4 09:56 ..
root@DUMPSTER:/RAID50.6x2TB# rm -rf Test123
rm: cannot remove 'Test123': Directory not empty
Message 5 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

I've been trying to post but for some reason it keeps getting deleted?

 

Something is triggering the automatic spam filter.

 


@nickjames wrote:

 

Maybe also try setting verbose mode on the rm command: rm -vrf Test123



Note you left out the -v (verbose mode).

 

But try this instead:

btrfs subvolume list /RAID50.6x2TB | grep -i Test123

and post whatever output you get (note you might not get any).

 

 

Message 6 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable


@StephenB wrote:

@nickjames wrote:

I've been trying to post but for some reason it keeps getting deleted?

 

Something is triggering the automatic spam filter.

 


@nickjames wrote:

 

Maybe also try setting verbose mode on the rm command: rm -vrf Test123



Note you left out the -v (verbose mode).

 

But try this instead:

btrfs subvolume list /RAID50.6x2TB | grep -i Test123

and post whatever output you get (note you might not get any).

 

 


Looks like a bunch of snap shots might be in there?

It's starting to come back to me... originally I had directories that I created in Windows via SMB but not shares on the RN. I was trying to get those Windows SMB directories removed but re-created on the RN. I have a feeling that share is no longer on the RN but got renamed or something to that effect. I'm not sure. Anyhow, here is the result of those commands:

 

root@DUMPSTER://RAID50.6x2TB# rm -vrf Test123
rm: cannot remove 'Test123': Directory not empty
root@DUMPSTER://RAID50.6x2TB# btrfs subvolume list /RAID50.6x2TB | grep -i Test123
ID 1310 gen 1384590 top level 5 path Test123
ID 1312 gen 1344259 top level 1310 path Test123/.snapshots
ID 2587 gen 19673 top level 1312 path Test123/.snapshots/10/snapshot
ID 3088 gen 74662 top level 1312 path Test123/.snapshots/41/snapshot
ID 3554 gen 128458 top level 1312 path Test123/.snapshots/71/snapshot
ID 4056 gen 183207 top level 1312 path Test123/.snapshots/102/snapshot
ID 4559 gen 238624 top level 1312 path Test123/.snapshots/133/snapshot
ID 5115 gen 290136 top level 1312 path Test123/.snapshots/161/snapshot
ID 5588 gen 344801 top level 1312 path Test123/.snapshots/192/snapshot
ID 6069 gen 398497 top level 1312 path Test123/.snapshots/222/snapshot
ID 6565 gen 453206 top level 1312 path Test123/.snapshots/253/snapshot
ID 7108 gen 507521 top level 1312 path Test123/.snapshots/283/snapshot
ID 7618 gen 561440 top level 1312 path Test123/.snapshots/314/snapshot
ID 8116 gen 614007 top level 1312 path Test123/.snapshots/345/snapshot
ID 8618 gen 665788 top level 1312 path Test123/.snapshots/375/snapshot
ID 9128 gen 719743 top level 1312 path Test123/.snapshots/406/snapshot
ID 9718 gen 772645 top level 1312 path Test123/.snapshots/436/snapshot
ID 10214 gen 827279 top level 1312 path Test123/.snapshots/467/snapshot
ID 10710 gen 881725 top level 1312 path Test123/.snapshots/498/snapshot
ID 11200 gen 930691 top level 1312 path Test123/.snapshots/526/snapshot
ID 11708 gen 982151 top level 1312 path Test123/.snapshots/557/snapshot
ID 12221 gen 1036746 top level 1312 path Test123/.snapshots/587/snapshot
ID 12751 gen 1087750 top level 1312 path Test123/.snapshots/618/snapshot
ID 13281 gen 1140790 top level 1312 path Test123/.snapshots/648/snapshot
ID 13808 gen 1195134 top level 1312 path Test123/.snapshots/679/snapshot
ID 14361 gen 1204992 top level 1312 path Test123/.snapshots/710/snapshot
ID 14875 gen 1209971 top level 1312 path Test123/.snapshots/740/snapshot
ID 15556 gen 1215451 top level 1312 path Test123/.snapshots/771/snapshot
ID 16033 gen 1220140 top level 1312 path Test123/.snapshots/799/snapshot
ID 16562 gen 1225177 top level 1312 path Test123/.snapshots/830/snapshot
ID 17140 gen 1230236 top level 1312 path Test123/.snapshots/861/snapshot
ID 17635 gen 1235463 top level 1312 path Test123/.snapshots/890/snapshot
ID 18167 gen 1241584 top level 1312 path Test123/.snapshots/921/snapshot
ID 18647 gen 1246758 top level 1312 path Test123/.snapshots/951/snapshot
ID 19143 gen 1251913 top level 1312 path Test123/.snapshots/982/snapshot
ID 19623 gen 1257016 top level 1312 path Test123/.snapshots/1012/snapshot
ID 19863 gen 1259686 top level 1312 path Test123/.snapshots/1027/snapshot
ID 20359 gen 1265070 top level 1312 path Test123/.snapshots/1058/snapshot
ID 20845 gen 1270144 top level 1312 path Test123/.snapshots/1088/snapshot
ID 21342 gen 1275260 top level 1312 path Test123/.snapshots/1119/snapshot
ID 21839 gen 1282477 top level 1312 path Test123/.snapshots/1148/snapshot
ID 22422 gen 1288277 top level 1312 path Test123/.snapshots/1179/snapshot
ID 22970 gen 1293877 top level 1312 path Test123/.snapshots/1210/snapshot
ID 23421 gen 1298404 top level 1312 path Test123/.snapshots/1238/snapshot
ID 23917 gen 1303320 top level 1312 path Test123/.snapshots/1269/snapshot
ID 24411 gen 1308349 top level 1312 path Test123/.snapshots/1299/snapshot
ID 24907 gen 1313386 top level 1312 path Test123/.snapshots/1330/snapshot
ID 25434 gen 1318154 top level 1312 path Test123/.snapshots/1360/snapshot
ID 25930 gen 1323113 top level 1312 path Test123/.snapshots/1391/snapshot
ID 26429 gen 1328629 top level 1312 path Test123/.snapshots/1422/snapshot
ID 26909 gen 1333536 top level 1312 path Test123/.snapshots/1452/snapshot
ID 27168 gen 1336199 top level 1312 path Test123/.snapshots/1468/snapshot
ID 27280 gen 1337364 top level 1312 path Test123/.snapshots/1475/snapshot
ID 27392 gen 1338504 top level 1312 path Test123/.snapshots/1482/snapshot
ID 27408 gen 1338683 top level 1312 path Test123/.snapshots/1483/snapshot
ID 27504 gen 1339639 top level 1312 path Test123/.snapshots/1489/snapshot
ID 27520 gen 1339834 top level 1312 path Test123/.snapshots/1490/snapshot
ID 27536 gen 1340003 top level 1312 path Test123/.snapshots/1491/snapshot
ID 27552 gen 1340165 top level 1312 path Test123/.snapshots/1492/snapshot
ID 27568 gen 1340343 top level 1312 path Test123/.snapshots/1493/snapshot
ID 27584 gen 1340500 top level 1312 path Test123/.snapshots/1494/snapshot
ID 27600 gen 1340670 top level 1312 path Test123/.snapshots/1495/snapshot
ID 27616 gen 1340844 top level 1312 path Test123/.snapshots/1496/snapshot
ID 27632 gen 1341001 top level 1312 path Test123/.snapshots/1497/snapshot
ID 27648 gen 1341177 top level 1312 path Test123/.snapshots/1498/snapshot
ID 27664 gen 1341348 top level 1312 path Test123/.snapshots/1499/snapshot
ID 27680 gen 1341501 top level 1312 path Test123/.snapshots/1500/snapshot
ID 27696 gen 1341656 top level 1312 path Test123/.snapshots/1501/snapshot
ID 27712 gen 1341814 top level 1312 path Test123/.snapshots/1502/snapshot
ID 27728 gen 1342003 top level 1312 path Test123/.snapshots/1503/snapshot
ID 27744 gen 1342180 top level 1312 path Test123/.snapshots/1504/snapshot
ID 27760 gen 1342339 top level 1312 path Test123/.snapshots/1505/snapshot
ID 27779 gen 1342540 top level 1312 path Test123/.snapshots/1506/snapshot
ID 27795 gen 1342691 top level 1312 path Test123/.snapshots/1507/snapshot
ID 27811 gen 1342839 top level 1312 path Test123/.snapshots/1508/snapshot
ID 27827 gen 1342986 top level 1312 path Test123/.snapshots/1509/snapshot
ID 27843 gen 1343140 top level 1312 path Test123/.snapshots/1510/snapshot
ID 27859 gen 1343321 top level 1312 path Test123/.snapshots/1511/snapshot
ID 27875 gen 1343497 top level 1312 path Test123/.snapshots/1512/snapshot
ID 27891 gen 1343643 top level 1312 path Test123/.snapshots/1513/snapshot
ID 27907 gen 1343812 top level 1312 path Test123/.snapshots/1514/snapshot
ID 27923 gen 1343966 top level 1312 path Test123/.snapshots/1515/snapshot
ID 27939 gen 1344113 top level 1312 path Test123/.snapshots/1516/snapshot
ID 27955 gen 1344258 top level 1312 path Test123/.snapshots/1517/snapshot
root@DUMPSTER://RAID50.6x2TB#
Message 7 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

It's starting to come back to me... originally I had directories that I created in Windows via SMB but not shares on the RN. I was trying to get those Windows SMB directories removed but re-created on the RN. I have a feeling that share is no longer on the RN but got renamed or something to that effect. I'm not sure. 

 


The reason you cannot delete it with rm is that this is a BTRFS subvolume, and not an ordinary folder. In other words, a share. It is possible that you might have renamed it from Windows after you created it - definitely not something that you are supposed to do. (One disadvantage of using admin credentials with the NAS is that it will let you do stuff that you shouldn't).

 

Are you seeing it on the shares page of the admin web ui? If it does, just delete it from there.

 

 

If not, are there any shares listed on the shares page that don't show up in your volume folder?

  1. If there is a share that has no folder, then the resolution is to rename Test123 to match the folder name, and then delete it from the admin Web UI.
  2. On the other hand, if all shares have a corresponding folder (subvolume), then the solution is to delete the subvolume with ssh (which is a different command from rm).

 

 

Message 8 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable


@StephenB wrote:

@nickjames wrote:

It's starting to come back to me... originally I had directories that I created in Windows via SMB but not shares on the RN. I was trying to get those Windows SMB directories removed but re-created on the RN. I have a feeling that share is no longer on the RN but got renamed or something to that effect. I'm not sure. 

 


The reason you cannot delete it with rm is that this is a BTRFS subvolume, and not an ordinary folder. In other words, a share. It is possible that you might have renamed it from Windows after you created it - definitely not something that you are supposed to do. (One disadvantage of using admin credentials with the NAS is that it will let you do stuff that you shouldn't).

 

Are you seeing it on the shares page of the admin web ui? If it does, just delete it from there.

 

 

If not, are there any shares listed on the shares page that don't show up in your volume folder?

  1. If there is a share that has no folder, then the resolution is to rename Test123 to match the folder name, and then delete it from the admin Web UI.
  2. On the other hand, if all shares have a corresponding folder (subvolume), then the solution is to delete the subvolume with ssh (which is a different command from rm).

 

 


All shares have a corresponding folder in the RN GUI. This is the only share that does not. It sounds like I need to delete the subvolume. How do I do that and is there any risk associated with removing it?

Message 9 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:
All shares have a corresponding folder in the RN GUI. This is the only share that does not. It sounds like I need to delete the subvolume. How do I do that and is there any risk associated with removing it?

The risk is that you'll accidentally delete the wrong thing, and lose a subvolume you care about.  It'd be good to backup your data if you don't have an up-to-date one.

 

You'd start by deleting the snapshots. The first step there is to find the snapper config for Test123.  Try entering 

snapper list-configs | grep Test123 

and let us know what it returns.

 

 

Message 10 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable


@StephenB wrote:

@nickjames wrote:
All shares have a corresponding folder in the RN GUI. This is the only share that does not. It sounds like I need to delete the subvolume. How do I do that and is there any risk associated with removing it?

The risk is that you'll accidentally delete the wrong thing, and lose a subvolume you care about.  It'd be good to backup your data if you don't have an up-to-date one.

 

You'd start by deleting the snapshots. The first step there is to find the snapper config for Test123.  Try entering 

snapper list-configs | grep Test123 

and let us know what it returns.

 

 


root@DUMPSTER://RAID50.6x2TB#
root@DUMPSTER://RAID50.6x2TB# snapper list-configs | grep Test123
root@DUMPSTER://RAID50.6x2TB#

 

I don't know the verbose output switch

 

Message 11 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

I don't know the verbose output switch

 


You are looking back a few posts I think.  I wanted you to add the -v (verbose) switch to your rm command.  You re-ran the command w/o it in your followup.  Later on you did include it (rm -vrf Test123).

 


@nickjames wrote:
root@DUMPSTER://RAID50.6x2TB#
root@DUMPSTER://RAID50.6x2TB# snapper list-configs | grep Test123

root@DUMPSTER://RAID50.6x2TB#


Ok.  I am thinking there probably still is a config for the subvolume, but it might be using the original share name (which seems likely if you renamed the share folder from Windows).

 

Let's try that again without the grep filter.  Just enter snapper list-configs  Cross-check the list of configs with your share list. Give us the list of configs that aren't share names.  The configs are identified by numbers, and we want to the number of the config file for that original share (if it still exists).  For instance, if Test and Dummy weren't shares on my own NAS, the information we are looking for would look like this:

 

 

12     | /data/Test
19     | /data/Dummy

 

Message 12 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable

Because snapper list-configs grep command didn't produce any information, I was saying that I didn't know how to rerun that command but with a verbose switch to hopefully get more data.

 

When I rerun that command, snapper list-config, all of the subvolumes shown match the GUI and Windows with the exception of NOT seeing Test123 in the SSH session.

Message 13 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

When I rerun that command, snapper list-config, all of the subvolumes shown match the GUI and Windows with the exception of NOT seeing Test123 in the SSH session.


My guess here is that you renamed the original share folder to Test123 from Windows.  Then you deleted the share from the NAS admin UI.  That would generate an error because the share folder no longer existed.  But it appears to have deleted the share from the ReadyNAS database, and also deleted the snapshot configuration.

 

Before you can delete Test123, you need to delete all the snapshots that it has.  If you had a snapper config, you could have deleted them as a group.  But since you don't, they need to be deleted one at a time. From your earlier btrfs subvolume list /RAID50.6x2TB | grep -i Test123 we can see 83 snapshots that need to be deleted.

 

The first "real" snapshot in your older post has a path of Test123/.snapshots/10/snapshot

To manually delete that one, enter btrfs subvolume delete -c /RAID50.6x2TB/Test123/.snapshots/10/snapshot

 

It could take a while for the deletion to complete (not sure how long).

 

If it does complete with no error, proceed to the next one (/RAID50.6x2TB/Test123/.snapshots/41/snapshot.  Continue until you delete them all (ending with /RAID50.6x2TB/Test123/.snapshots/1517/snapshot).  Note if you use the up arrow key on the keyboard, you will see the previous command.  You can then use the left and right arrows to position the cursor, and change the numeric value (10 to 41, etc until you get to 1517).  That should reduce the amount of typing.

 

When they are all done, then enter btrfs subvolume delete -c /RAID50.6x2TB/Test123/.snapshots to delete the .snapshots folder and finally btrfs subvolume delete -c /RAID50.6x2TB/Test123/ to delete the share.

Message 14 of 16
nickjames
Luminary

Re: Windows SMB created folder undeletable

As always, thank you@StephenB. We are lucky to have you on these forums!

That did the trick... until next time!

 

One last thing... clean up. I'll disable SSH and create a new user on the RN without administrator privilege's. Would you suggest that as a good practice so I don't get myself into this mess in the future?

Message 15 of 16
StephenB
Guru

Re: Windows SMB created folder undeletable


@nickjames wrote:

One last thing... clean up. I'll disable SSH and create a new user on the RN without administrator privilege's. Would you suggest that as a good practice so I don't get myself into this mess in the future?


Definitely a good idea to access the NAS over SMB w/o using admin credentials. 

 

Disabling SSH is up to you - one benefit to leaving it on is that you can often use it to access the NAS when the web ui becomes non-responsive.  If you disable it, then of course you need the web ui to re-enable.

Message 16 of 16
Top Contributors
Discussion stats
  • 15 replies
  • 823 views
  • 0 kudos
  • 2 in conversation
Announcements