Highlighted
Contributor
Contributor

Can't delete files or directories on a datastore

Jump to solution

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
Highlighted
Commander
Commander

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

0 Kudos
14 Replies
Highlighted
Enthusiast
Enthusiast

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/
0 Kudos
Highlighted
Commander
Commander

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

0 Kudos
Highlighted
Contributor
Contributor

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

0 Kudos
Highlighted
Contributor
Contributor

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.

0 Kudos
Highlighted
Immortal
Immortal

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 recovery problem ? - call me via skype "sanbarrow"
Highlighted
Contributor
Contributor

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

0 Kudos
Highlighted
Immortal
Immortal

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 recovery problem ? - call me via skype "sanbarrow"
0 Kudos
Highlighted
Contributor
Contributor

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 !

0 Kudos
Highlighted
Enthusiast
Enthusiast

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/
0 Kudos
Highlighted
Contributor
Contributor

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 !

0 Kudos
Highlighted
Commander
Commander

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

0 Kudos
Highlighted
Enthusiast
Enthusiast

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/
Highlighted
Contributor
Contributor

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 !

0 Kudos
Highlighted
Contributor
Contributor

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 !