Contributor
Contributor

Cannot delete a vmdk file from datastore in the GUI or using CLI, getting an "invalid argument" error

Jump to solution

Hi,

I cannot delete a vmdk file from my datastore. The file in question (S9_1-flat.vmdk) cannot be deleted using the vSphere Client or using CLI. I've attached the output from my SSH session:

/vmfs/volumes/50bb5d47-5677d7b4-cb59-90b11c1479d7/S9 # ls -al

drwxr-xr-x    1 root     root          3640 Aug 17 15:45 .

drwxr-xr-t    1 root     root          1540 Aug 17 14:59 ..

-rw-r--r--    1 root     root            27 Jul 10 09:15 S9-365b1e05.hlog

-rw-------    1 root     root     17179869184 Aug 17 15:45 S9-365b1e05.vswp

-rw-------    1 root     root     107374182400 Aug 18 11:56 S9-flat.vmdk

-rw-------    1 root     root          8684 Aug 17 15:46 S9.nvram

-rw-------    1 root     root           491 Aug 17 15:45 S9.vmdk

-rw-r--r--    1 root     root             0 Mar 21  2014 S9.vmsd

-rw-------    1 root     root          4172 Aug 17 15:45 S9.vmx

-rw-------    1 root     root             0 Aug 17 15:45 S9.vmx.lck

-rw-r--r--    1 root     root          3033 Aug 17 15:39 S9.vmxf

-rw-------    1 root     root          4068 Aug 17 15:45 S9.vmx~

-rwxrwxrwx    1 root     root     1099511627776 Jun 29 10:07 S9_1-flat.vmdk

-rw-------    1 root     root     586263035904 Aug 18 11:01 S9_2-flat.vmdk

-rw-------    1 root     root           520 Aug 17 15:45 S9_2.vmdk

-rw-------    1 root     root       8561355 Aug 15 19:44 vmmcores-1.gz

-rw-------    1 root     root       3581220 Aug 16 07:52 vmmcores-2.gz

-rw-------    1 root     root       2968111 Aug 16 07:53 vmmcores-3.gz

-rw-r--r--    1 root     root        227605 Aug 17 14:54 vmware-79.log

-rw-r--r--    1 root     root        227281 Aug 17 15:02 vmware-80.log

-rw-r--r--    1 root     root        232708 Aug 17 15:16 vmware-81.log

-rw-r--r--    1 root     root        226958 Aug 17 15:28 vmware-82.log

-rw-r--r--    1 root     root        235389 Aug 17 15:35 vmware-83.log

-rw-r--r--    1 root     root        230933 Aug 17 15:38 vmware-84.log

-rw-r--r--    1 root     root        236001 Aug 18 09:18 vmware.log

-rw-------    1 root     root      97517568 Aug 17 15:45 vmx-S9-911941125-1.vswp

/vmfs/volumes/50bb5d47-5677d7b4-cb59-90b11c1479d7/S9 # rm -f S9_1-flat.vmdk

rm: can't remove 'S9_1-flat.vmdk': Invalid argument

(Note that the permissions on the file are currently set as 777 as I initially thought that this could be a permissions issue).

Another thing to add is that the "S9_1.vmdk" file has gone missing, and if I attempt to create a new Hard Disk in Settings I get the message "S9_1.vmdk already exists". What is the best way to remove "S9_1.vmdk" that seems to be hidden, and also remove "S9_1-flat.vmdk"? Will I have to delete the entire datastore?

Any assistance would be much appreciated.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Commander
Commander

File is not locked by any host, but as a quick solution you may delete and recreate the datastore as I can see only this VM folder reside on the DS.

Regards, Suresh https://vconnectit.wordpress.com/

View solution in original post

0 Kudos
7 Replies
Commander
Commander

Are you able to see the vmdk in datastore browser ? Try to delete it from there

Cannot remove file

Regards, Suresh https://vconnectit.wordpress.com/
0 Kudos
Contributor
Contributor

Hi Suresh,

I've tried that, but I get the following error (screenshot attached):

Error caused by file
/vmfs/volumes/50bb5d47-5677d7b4-cb59-90b11c1479d7/S9/S9_1-flat.vmdk

0 Kudos
Commander
Commander

could you please provide me the output of the following command ,

vmkfstools -D /vmfs/volumes/50bb5d47-5677d7b4-cb59-90b11c1479d7/S9/S9_1-flat.vmdk

Just to check if this file is locked by any host by chance, though the error is not specific to file locking

Regards, Suresh https://vconnectit.wordpress.com/
0 Kudos
Contributor
Contributor

Hi Suresh,

Here is the output from the command:

~ # vmkfstools -D /vmfs/volumes/50bb5d47-5677d7b4-cb59-90b11c1479d7/S9/S9_1-flat

.vmdk

Lock [type 10c00001 offset 79634432 v 1674, hb offset 3235840

gen 379, mode 0, owner 00000000-00000000-0000-000000000000 mtime 6017

num 0 gblnum 0 gblgen 0 gblbrk 0]

Addr <4, 157, 188>, gen 878, links 1, type reg, flags 0, uid 0, gid 0, mode 777

len 1099511627776, nb 1048576 tbz 82408, cow 0, newSinceEpoch 1048576, zla 4304, bs 1048576

0 Kudos
Commander
Commander

File is not locked by any host, but as a quick solution you may delete and recreate the datastore as I can see only this VM folder reside on the DS.

Regards, Suresh https://vconnectit.wordpress.com/

View solution in original post

0 Kudos
Contributor
Contributor

Thanks for your help, I think we'll delete the datastore.

0 Kudos
Enthusiast
Enthusiast

This is because the DS is corrupt, run the hexdump command to check the corruption.

Punit Solanki psolanki@vmware.com
0 Kudos