locked
Invalid file handle RRS feed

  • Question

  • I copied a whole bunch of files to my WHS array, deleted a few, copied them again, copied some more files, and now a whole bunch of them are just sitting there, if I try to delete them it won't. Says "Invalid file handle"...

    Any way to forcibly delete these filles?? These are not critical files but I'm putting WHS through it's paces, so it's important. (to me)

    Saturday, February 24, 2007 2:50 AM

Answers

All replies

  • Were you trying to copy/delete through the shares via SMB (\\Server\Photos\ etc..) or by logging on to the console?

    The reason I ask is that WHS stores the pointers to the file (called tombstones) on one disk (Primary) and the actual data on another disk (secondary) if you have atleast two disks. And if you had deleted the data from the secondary, accessing the file from the primary will give you Invalid file handle since there is no data to read from.

    Also, is by any chance, any of your disk drives in unhealthy state (from storage tab)?

    Saturday, February 24, 2007 6:14 PM
    Moderator
  •  Dileep K wrote:

    Were you trying to copy/delete through the shares via SMB (\\Server\Photos\ etc..) or by logging on to the console?

    The reason I ask is that WHS stores the pointers to the file (called tombstones) on one disk (Primary) and the actual data on another disk (secondary) if you have atleast two files. And if you had deleted the data from the secondary, accessing the file from the primary will give you Invalid file handle since there is no data to read from.

    Also, is by any chance, any of your disk drives in unhealthy state (from storage tab)?

    I was accessing the files through SMB.

    No, all the drives were healthy "originally", however, There may be an issue. My drives are all SATA drives connected via a Sil 3124 host controller and Sil 3726 port multipliers (which work fine btw), and I did move the cables from one port to another. That shouldn't have an effect on WHS or the drives as these are all SATA, so it shouldn't matter which port they are connected on.

    Related to this, now that I have these pointers but no files attached to them I guess, any way to delete them? (If I try deleting through SMB, gives me the Invalid file handle error.

    Saturday, February 24, 2007 6:39 PM
  • Actually, I'm pretty sure the ports do matter. If you wanted to switch the ports, your best bet would be to removed the HD via the WHS Console, switch the port, and then Add it back in.

    You could always try connecting the HD's back to the ports they were initially on and see if this resolves it.
    Saturday, February 24, 2007 7:01 PM
  • Yes, the correct sequence is to remove the hard drive from the storage pool, switch the ports and then add it back.

    You can try what ZacConnect suggests- to switch 'em back and see whether you can get to those files.

    If not, you may try the following to try deleting the pointers (Please note that it *may not* work, and if used on other valid files, it may delete your data on those files. So use the below command carefully, and beware of the risk of losing data)

    1. open a command prompt on the WHS server

    2. Go to the folder containing the invalid files (D:\shares\...) 

    3. Type fsutil reparsepoint delete <FileName>

    4. Hit Enter

    5. Now try deleting the pointer

     

     

    Saturday, February 24, 2007 7:13 PM
    Moderator
  • Another option might be to reinstall the WHS OS with the Upgrade option. From what I understand this keeps the D: drive, and makes new pointers. That is, if you have a LOT of these files..

    The problem I see though, with switching the ports back is that any files saved to that HD after the initial port switch will now probably be broken.
    Saturday, February 24, 2007 7:41 PM
  • Nope, didn't work.

    It says: "The file or directory is not a reparse point".

    Right now, I have only non critical data on the WHS array since I'm still evaluating this, but there has to be a way to clean these things up rather than reinstalling the O/S, not that I can't do that.

    Saturday, February 24, 2007 8:23 PM
  • I am having the exact same problem, but I haven't touched the drives.  I copied some files over to the WHS and now if I try to copy them, access them, delete them, anything, I get the message Invalid File Handle.  I also tried going to the WHS web site and downloading the files back to my computer but that doesn't work either.  The data that I have on the drive I would really like to have back and I moved it just as a temporary move.
    Thursday, March 1, 2007 10:56 PM
  • I'll go one weirder.  I have some files (videos) that I copied to WHS.  I can access them fine from my workstation in my office but if I try to play them on the Media Center PC out in the living room I get the invalid file handle.

    I went back into my office PC, copied the files to a new subdirectory and I can access the files in the new subdirectory on the MCE box.  But I still can't access the original files from MCE.

    Any suggestions on cleaning this stuff up?

    Friday, March 2, 2007 1:01 AM
  • the saga continues... I found on one of the posts that re-installing WHS may correct the problem  (it will reindex everything). I did just that.  SOME files I can now access and SOME file I cannot access.  this is just really weird.
    Friday, March 2, 2007 1:26 AM
  • can you access the files on WHS using remote desktop?  You should be able to browse the share like \\server\share .  What I've found is that the files cannot be accessed by a machine connecting in as Guest but I can access the files using an authenticated account with read/write access. 

    Next step is to see if I can access the files with an account that has read only access.

    Saturday, March 3, 2007 12:58 AM
  • Please follow the bug reporting steps if you haven't already.
    Monday, March 5, 2007 7:17 PM
    Moderator
  • Hi,

    I got the same error after movieng an copying a lot of files to a share that i have creadted. \\server\download i have go the error 3 times on different files. To copy the files back to a pc i had to logon with RDP and copy the file to another share \\server\software and the i could move/copy the file and delete it again. Have anyone found a solution or is this a bug?

    Regards

    Anders 

    Monday, March 5, 2007 8:01 PM
  • Ok, I've had the very same problem...

    Tried disconnecting the "Mapped" network drives - didn't work :(

    Logged onto the WHS directly (ie: not via remote console) - could access the problem files without issues. Strange???

    I saw the post about how accessing the files via a named account rather than guest seemed to work so I logged onto remote WHS console and disabled the guest account. Re-enabled it (WHS did its stuff) - the problem went away. I can now access the files via a Windows share without issues.

    BTW - I use the guest account exclusively for accessing the shares on WHS.
    Tuesday, March 20, 2007 9:59 AM
  • Same issue here.

     

    Using named accounts and Guest is disabled.

     

    Cannot copy some files to client pc (Windows Vista Premium) from WHS (latest(?) CTP, build 3790) through "Shared Folders on Server".

     

    I did remove a drive using the Remove Wizard and it finished its job without error.

    Added another bigger drive instead and kept using the WHS as backup and file storage.

     

    After getting the "Invalid File Handle"-message, I searched this forum and tried different suggestions.

     

    Now I've discovered that I can copy from the WHS desktop itself, using Windows Explorer and transfer from the shared folders to public folder on the client.

     

    Any new advisory on this matter?

     

     

    Sunday, May 6, 2007 12:19 AM
  • There is a known issue with CTP build where remove disk completes even if WHS is unable to unmigrate all files successfully from it. I think this is what must be happening with your WHS. Could you please check %QLOGS%\qsm.log in the server for entries around the same timeframe as your disk removal? See whether it gave any error related to the files in question.

    Alternatively, you may also file a connect bug (copying this thread) and we can take a look at this for you.
    Sunday, May 6, 2007 5:09 PM
    Moderator
  •  Dileep K wrote:
    There is a known issue with CTP build where remove disk completes even if WHS is unable to unmigrate all files successfully from it. I think this is what must be happening with your WHS. Could you please check %QLOGS%\qsm.log in the server for entries around the same timeframe as your disk removal? See whether it gave any error related to the files in question.

    Alternatively, you may also file a connect bug (copying this thread) and we can take a look at this for you.

     

    Where can I find this file?

    Tried looking in root on system disk and using the Search tool, no folder or file with that name.

    Monday, May 7, 2007 10:06 PM
  • Oh I'm sorry, you can get to the file by either of the following ways from the server:

     

    1. Open an explorer window on the server and type the following on the address bar %QLOGS% and then hit Enter. This will take you to the logs directory. You will find the file qsm.log there.

    2. ALternatively, you can browse to C:\Documents And Settings\All Users\Application Data\Microsoft\Windows Home Server\Logs and look for qsm.log there.
    Tuesday, May 8, 2007 12:57 AM
    Moderator
  • Thanx, found it...uh...a 36 MB log-file...

    Anything special to search for?

    Tuesday, May 8, 2007 8:57 PM
  • You may search for any of the file names that is giving you "Invalid handle" and see what it is coming up with.
    Tuesday, May 8, 2007 11:58 PM
    Moderator
  • Not sure if this is related, but I was unable to copy files/delete them from another computer.  I was getting error Invalid File Handle, I have tried all suggestions listed.  None of them worked for me.  I was able to figure out that the shared folders did not have Network Service listed in the Security dialog.  I added the group, and gave it Read and Execute, List, and Read permissions.  That fixed the issue for me.  I was able to copy/delete files after that.  Even using Guest account worked aftwards.
    Wednesday, May 30, 2007 5:15 AM
  • Used the fsutil reparsepoint delete <filename> and it worked for me...Thanks

    Monday, August 27, 2007 2:33 AM
  • For me the solution didn't seem too bad - I logged on as Administrator using Remote Desktop, then copied all the offending files to new folders.  That seemed to fix the tombstone association for the copy (go figure), and I then deleted the originals, again as Admin.

    Wednesday, September 5, 2007 2:00 PM
  •  

    Logging into the WHS using RDC works for me as well, however I don't see this as being a valid long-term fix for this obvious bug.  If I have to copy all of the files to new folders every 1, 2 or 3 months, it's gonna be a big headache.  I have noticed that the longer a given file is on the server, the more likely I am to get the "Invalid File Handle" error when I try to copy it to another box via shared folders.

     

    Interestingly enough, I have no problems accessing the files via my D-Link DSM 520 media extender.

     

    I do hope this is fixed in the RTM.

    Thursday, September 6, 2007 2:57 PM
  • I was getting Invalid File Handle errors when trying to move certain files from my software share to the desktop of my vista computer. I checked and discovered some other files also prompting the error message when trying to move/copy them to the desktop. Now whats wierd, is that all the vista computers were affected (including WHS when Remote Desktop into it) BUT the only Windows XP machine could move these items in and out without the error message. I looked at the folder permissions as Randy25M said and discovered that the Network Service was also missing. This Software Share Folder was the only folder without, and the only folder with this Inavlid File Handle errors on some of the files. I also discovered that this was the only folder in which i changed the permissions so that other computers could not access the folder. After putting Network Service back in exactly as Randy25M advised - CURED!!! all my vista machines (including the WHS itself) could copy / delete and move these files. I will test this over the weekend and post back.

    Thursday, September 27, 2007 12:38 PM
  • The idea was to transfer my destop machine files to the server while I install RAID 5 on my desktop machine. Now I cannot get them back.

     

    I have Network Service (and other accounts) with full rights, read-only access removed from all files, disabled all but my own user account, transfered files using the desktop shortcut (not the server interface), and still cannot successfully transfer files off the server. I have two drives on the server, I removed file duplication on all folders, waited for the server to balance and still no transfer.

     

    I also tried removing the primary drive off the server and connected it to my desktop computer hoping to copy the files off. Again I could see the files, but insufficient rights disallowed me from copying.

     

    I can accees them, see pictures, play music, I just cannot copy them back to my desktop computer.

    Need less to say I am not happy.

     

    Any OTHER suggestions?

     

    Monday, October 1, 2007 2:43 AM
  • I had something similar today.  I have folder.jpg thumbnails in my ripped DVD folders on my WHS for use on my MCE computers.  None of the thumbnails were showing up but if I went from the Vista MCE computer and looked at the share the file was there.  I could open it and look at the image just fine.  However, if I tried to copy it to the Vista desktop it gave me an invalid file handle. 

     

    In another thread here (don't remember who to give credit to - sorry), someone suggested going to the shared folder on the WHS desktop and select the share-level folder and remove then re-add the administrators to the security tab.  I did this and all of my systems are now showing the thumbnails as they should and I can copy them to the desktops just fine.  Please note that all of the security info seemed fine but there must have been some problem this procedure rectified.

     

    I'm not sure if this is related or will help any.

     

    David

    Thursday, October 18, 2007 3:10 PM
  • reparsepoint worked for me.  Does anyone know what it does?

     

    Saturday, December 8, 2007 11:55 PM
  •  Cruzmeister wrote:
    reparsepoint worked for me.  Does anyone know what it does?

    If you mean "fsutil reparsepoint delete <filename>", it deletes the reparse point (a 4 KB "pointer" file that points to where the actual file is stored).  However, the problem with the original Invalid File Handle error should be a concern for you (it means it can't find the actual file at the location it expected it to be, which could mean the actual file is gone).
    Sunday, December 9, 2007 12:13 AM
    Moderator
  • Thanks for the quick and complete answer.  I understand now.  In my case the original files were big (> 1 gig) and the corrupt files were attempted copies that were just a few megs.  The files got corrupted when I cancelled a copying operation.  The originals are fine and work so I didn't have any problems going to the corrupted files and deleting the reparse points.  I could see this being a problem if the original files were corrupted.  Thanks!

    Sunday, December 9, 2007 12:18 AM
  •  

    Hey, i wrote an application which should solve your problem. It's based on Dileep K's response, but means that you dont have to do ZSacConnects drastic alternative of reinstalling Smile

     

    I had the same problem with one of my folders, except there were a few 100 files in there. Hope this helps.

     

    What it does: Takes a directory, then repairs all files in it by running the fsutil application on each file. I take no responsability if this application i've written damages any of your files. It was written to attempt to help you fix the problem described in this thread.

     

    Download: http://www.4shared.com/file/37306865/910e94db/Repair_Handle_Invalid.html

     

    Source:

     

    using System;

    using System.Data;

    using System.Text;

    using System.Windows.Forms;

    using System.IO;

    using System.Diagnostics;

     

    namespace Repair_Handle_Invalid

    {

    public partial class frmRepairFiles : Form

    {

    public frmRepairFiles()

    {

    InitializeComponent();

    }

    private void btnRepair_Click(object sender, EventArgs e)

    {

    bool AllFilesSucceeded = true;

    int FilesProcessed = 0;

    foreach(string currentfile in System.IO.Directory.GetFiles(txtDirectory2Repair.Text))

    {

    if (RepairFile(currentfile) == false) { lblStatus.Text = "There was an error while repairing file " + currentfile; AllFilesSucceeded = false; }

    else { lblStatus.Text = "Success on file " + currentfile; FilesProcessed = +1; }

    }

    if (AllFilesSucceeded == false) { MessageBox.Show("Process completed. " + FilesProcessed + " were attempted to be recovered. At least one file failed to be repaired", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); }

    else { MessageBox.Show("Process completed successfully. " + FilesProcessed + " were attempted to be recovered.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }

    }

    public bool RepairFile(string Path)

    {

    try

    {

    Process RepairCurrentFile = new Process();

    RepairCurrentFile.StartInfo.FileName = Environment.ExpandEnvironmentVariables("%SystemRoot%") + "\\System32\\fsutil.exe";

    RepairCurrentFile.StartInfo.Arguments = "reparsepoint delete " + Path;

    RepairCurrentFile.Start();

    RepairCurrentFile.WaitForExit();

    return true;

    }

    catch { return false; }

    }

    private void btnBrowse_Click(object sender, EventArgs e)

    {

    FolderBrowserDialog BrowseForFolder = new FolderBrowserDialog();

    BrowseForFolder.SelectedPath = txtDirectory2Repair.Text;

    BrowseForFolder.ShowDialog();

    txtDirectory2Repair.Text = BrowseForFolder.SelectedPath;

    }

    }

    }

    Saturday, February 9, 2008 12:17 PM
  • I have recently been suffering with this problem for no obvious reason, many thanks for the program - it worked a treat

     

    Thursday, March 13, 2008 3:31 PM
  • The fsutil reparsepoint delete <FileName> command worked in my case. Now is someone out there adept enough at vbscript to use this on an entire directory or even a nested directory?

     

    I'm sure I could figure it out eventually but right now I'm just too damn lazy.

    Thanks

     

     

    Sunday, March 16, 2008 12:55 AM
  • Beechus,

     

    For some reason the program isn't working for me. It appears to be going through the motions (lots of cmd windows popping up and shutting down) but in the end, the message saying that the process was successful but only 1 file was attempted to be recovered.

     

    Any thoughts?

     

     

    Sunday, March 16, 2008 1:52 AM
  •  

    I have the same problem and its affecting only 465 GB of data so I am kind of worried now.....

     

    I tried practically everything from Changing permissions and ownership to cursing but nothing helped so far

    Does MS have a solution for this problem???

     

    BTW i didn't change anything in the machine so it seems to be a self started problem

    Or could Robocopy have something to do with it?

    any Ideas to solve this?

     

    Using OEm Homeserver an Vista machines

     

    Regs Roppie

    Saturday, March 22, 2008 10:47 PM
  • Once you get this problem, there appears to be no way to recover the data Sad My Home Server started destroying my files slowly- so i moved away from their system of storing my files and now just do it manually- all my files are safe Smile

    Saturday, March 22, 2008 11:01 PM
  • Are you telling that you no longer use WHS or are you saying that ist is due to tha backup method?

    I am losing confidence this now. Main Q is did I somthing to affect the machine or started the problem itself?

     

    Regs Roppie

    Sunday, March 23, 2008 8:38 AM
  • Here is what I found to be the cause in my situation - nothing changed that I noticed - but I had 3 physical hard drives installed but only two drive letters in my computer.  Went to Disk Management and saw that the system saw all three physical drives but didn't assign a drive letter to the one with the real data - I assigned the drive letter to the non assigned disk, and was able to get to the data - I then copied it off with no problems.  I still had the same file handle issues because the drive letter might not have been the same - but I copied the data off, and then rebuilt it.  Why go to all this effort? I had 2 TB worth of data that I didn't want to re do.  So I copied all the data off, rebuilt the OS and things worked out. 

    Not sure why the physical disk lost the drive letter assigned to it - but since I built (bought) the full version and was previously using the RC version, wasn't too upset.

    For those of us that are semi technical - I had no idea that the data was housed on seperate drives and the shares used pointers - I could have been cleaning up and caused the problem.  From now on, I'll use the \\server\share method instead of remote desktop to copy files -

    Just my two cents worth -

    Rob
    Rob
    Tuesday, January 12, 2010 1:11 AM
  • So Today I Started getting this on EVERY file in my share. just a hair under 1TB of data all together.. The console shows file conflicts in all my share folders as well. When I remote in to the server I Get the same thing when trying to access most files, Otherwise if its a pic, video, or mp3 it says file not found in picture viewer/media player.. I Also tried pulling the drive & seeing if I could access the files directly from my Win 7 desktop & This was also unsuccessful. 
    This started today after running a chkdsk yesterday. But I Was able to access everything immediately after the chkdsk completed. No hardware has changed & there is only a single 2tb drive in my server.

    Its running another chkdsk back in the WHS now. But ANY incite on how to get my files back would be GREATLY appreciated, as this was the backup for years worth of stuff & I Just re-formatted my desktop a couple days ago & haddnt moved the pictures back (the music and videos are replaceable with alot of hours of ripping my CD's & DVD's, but the pictures of my daughter since birth are un-replaceable) 
    Thursday, January 28, 2010 1:05 AM
  • Hi,

    my €2 worth.... I had a similar problem after messing around removing and adding drives. I ran a WHS Cleanup tool available here:

    http://www.whsplus.com/2009/04/12/windows-home-server-cleanup-tool/

    It worked for me but please use with caution, backup before runing etc etc

    Sam
    Thursday, January 28, 2010 3:32 PM