VMware Cloud Community
ascheltens22
Contributor
Contributor
Jump to solution

Can't delete files or directories on a datastore

Hi,

I've tried to move VM's from a datastore to another.

It worked fine.

But some VM left some files and directories behind.

For example, I've found a vmxf file not modified since 2 years, and it can't be deleted.

With command vkmfstools -D I have this result :

vmkfstools -D /vmfs/volumes

/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf

Lock [type 10c00001 offset 57563136 v 945, hb offset 3723264

gen 627, mode 0, owner 00000000-00000000-0000-000000000000 mtime 873810

num 0 gblnum 0 gblgen 0 gblbrk 0]

Addr <4, 99, 19>, gen 53, links 1, type reg, flags 0, uid 0, gid 0, mode 600

len 3232, nb 1 tbz 0, cow 0, newSinceEpoch 1, zla 2, bs 8192

It's in mode 0 so not locked, and I also can't find any MAC.

the rm command :

rm NAGIOS2.vmxf

rm: can't remove 'NAGIOS2.vmxf': No such file or directory

I've got another symptom an a directory that apperas empty and that I can't remove :

rmdir logs2

rmdir: 'logs2': Directory not empty

ls logs2

ls: logs2/rhttpproxy.0.gz: No such file or directory

Has someone a solution ?

Regards.

1 Solution

Accepted Solutions
SupreetK
Commander
Commander
Jump to solution

Looks like the inode entry for the files could be missing. If your end goal is to remove (unmount) the datastore and don't really care about the files on it, unpresent it from the hosts on the storage array and reboot the hosts. Once the hosts are rebooted, they should not see this datastore anymore. On the vCenter unless there are any VM / VM Templates still registered from this datastore, perform a cluster level rescan once the hosts are rebooted and the datastore should not be visible on the vCenter anymore. This is a hard way to remove any datastore and should be performed as the last resort option.

Cheers,

Supreet

View solution in original post

Reply
0 Kudos
14 Replies
Marmotte94
Enthusiast
Enthusiast
Jump to solution

Hi,

You can find more information about this file with this command in SSH from ESXi.

# vmfsfilelockinfo -p /vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf

Thank you,

Please, visit my blog http://www.purplescreen.eu/
Reply
0 Kudos
SupreetK
Commander
Commander
Jump to solution

Can you run the command <ls -lah> from within the folder '/vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/' and 'logs2' and share the output?

Cheers,

Supreet

Reply
0 Kudos
ascheltens22
Contributor
Contributor
Jump to solution

Hi,

thank you for your time !

Here's the result of the command :

ls -lah

total 1040

drwxr-xr-x    1 root     root         420 Sep 30 18:38 .

drwxr-xr-t    1 root     root        2.2K Oct  3 07:57 ..

-rw-------    1 root     root        3.2K Jun 23  2017 NAGIOS2.vmxf

Reply
0 Kudos
ascheltens22
Contributor
Contributor
Jump to solution

Marmotte, here's the result :

vmfsfilelockinfo -p /vmfs/v

olumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf

vmfsfilelockinfo Version 2.0

Looking for lock owners on "NAGIOS2.vmxf"

"NAGIOS2.vmxf" is not locked by any ESX host and is Free

Total time taken : 0.03462965099606663 seconds.

Thank you for answering me.

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

Have you tried to delete the *vmxf from commandline with
rm -f /vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf
if that does not work try
dd if=/dev/zero of=/vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf bs=1 count=1
rm -f /vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

ascheltens22
Contributor
Contributor
Jump to solution

Hi continuum,

each command you wote me doesn't work.

rm -f /vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf

rm: can't remove '/vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf': No such file or directory

dd if=/dev/zero of=/vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS

2.vmxf bs=1 count=1

dd: can't open '/vmfs/volumes/559bd310-c01ae484-6591-a0369f6fcdc8/NAGIOS/NAGIOS2.vmxf': No such file or directory

Regards

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

I used the filenames and the path that you provided yourself - if that aint the correct full path - adjust it accordingly


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
ascheltens22
Contributor
Contributor
Jump to solution

That's the correct path and file.

It's weird to see the file with ls or in the vCenter Interface, and to see that when you try to delete it, it appears as an unexisting file !

Reply
0 Kudos
Marmotte94
Enthusiast
Enthusiast
Jump to solution

Did you try from an other ESXi ?

I think something wrong with Datastore ID or this file doesn't exist really (Same as the spoon). Smiley Wink

Thank you,

Please, visit my blog http://www.purplescreen.eu/
Reply
0 Kudos
ascheltens22
Contributor
Contributor
Jump to solution

Marmotte, I tried from my second ESXi and same result.

And I want to remove this datastore, but I can' because vCenter say's it's in use !

Reply
0 Kudos
SupreetK
Commander
Commander
Jump to solution

Looks like the inode entry for the files could be missing. If your end goal is to remove (unmount) the datastore and don't really care about the files on it, unpresent it from the hosts on the storage array and reboot the hosts. Once the hosts are rebooted, they should not see this datastore anymore. On the vCenter unless there are any VM / VM Templates still registered from this datastore, perform a cluster level rescan once the hosts are rebooted and the datastore should not be visible on the vCenter anymore. This is a hard way to remove any datastore and should be performed as the last resort option.

Cheers,

Supreet

Reply
0 Kudos
Marmotte94
Enthusiast
Enthusiast
Jump to solution

I think you can perform a rescan Storage Adapters and refresh Storage device as well.

Thank you.

Please, visit my blog http://www.purplescreen.eu/
ascheltens22
Contributor
Contributor
Jump to solution

For the moment, recan for the storage adapters and storage didn't work.

I think I'll try what SupreetK wrote !

I'll post the result later !

Reply
0 Kudos
ascheltens22
Contributor
Contributor
Jump to solution

Hi,

Used the last solution.

I deleted the lun on my SAN, and restarted every host.

Everything seems to be good now.

Thank all for your help !