How to tell if a physical HDD has failed withno drive letter
Moderator: DosItHelp
How to tell if a physical HDD has failed withno drive letter
How can I tell if a physical disk has failed on a remote machine if the disk doesn't have a logical drive letter?
The physical drive is pointing to a subdirectory on another physical disk using "Mount in Empty NTFS Folder" feature of Windows.
Supposing that: Physical disk label is called: Backup
and... Empty folder is: C:\Test\Backup
The physical drive is pointing to a subdirectory on another physical disk using "Mount in Empty NTFS Folder" feature of Windows.
Supposing that: Physical disk label is called: Backup
and... Empty folder is: C:\Test\Backup
Re: How to tell if a physical HDD has failed withno drive le
If the mount point is c:\test\backup then you could test for files or a folder within the mount point.
Say a folder "Files" exists in the root of the HDD then
if exist "c:\test\backup\Files\" echo the hard drive is mounted.
Or if a file called readme.txt exists in the root then this too will work:
if exist "c:\test\backup\readme.txt" echo the hard drive is mounted.
You can share the backup folder and use this:
if exist "\\server\share\Files\" echo the hard drive is mounted.
Say a folder "Files" exists in the root of the HDD then
if exist "c:\test\backup\Files\" echo the hard drive is mounted.
Or if a file called readme.txt exists in the root then this too will work:
if exist "c:\test\backup\readme.txt" echo the hard drive is mounted.
You can share the backup folder and use this:
if exist "\\server\share\Files\" echo the hard drive is mounted.
Re: How to tell if a physical HDD has failed withno drive le
Hmmm... Do you mean to blindly try to give it a temporary share name; and, if that share doesn't exist, then it means the hard drive has failed? Then, blindly unshare it.
Re: How to tell if a physical HDD has failed withno drive le
Are you serious? You want to see if a drive on a remote system exists and you don't want to actually access it?
What *do* you want to do? Use PSEXEC and access the system remotely - oh, hang on, *blindly* access the system remotely.
Be *very* aware that you didn't give any details apart from you want to see if a drive is mounted.
What *do* you want to do? Use PSEXEC and access the system remotely - oh, hang on, *blindly* access the system remotely.
Be *very* aware that you didn't give any details apart from you want to see if a drive is mounted.
Re: How to tell if a physical HDD has failed withno drive le
'
No need to check for any file, dir or drive letter.
Let's assume your server's name is backup and one of it's drives is shared as backup, in that case
orIt doesn't matter whether your system assigns a drive letter to a remotely shared drive/folder.
This is a local thingy which the remote share doesn't cares about.
What matters is whether the remote share is on-line, operational, accessible and that you have the required privileges.
No need to check for any file, dir or drive letter.
Let's assume your server's name is backup and one of it's drives is shared as backup, in that case
Code: Select all
if exist "\\backup\backup\" &&echo.exist ||not exist
Code: Select all
if exist "\\192.168.*.*\backup\" &&echo.exist ||not exist
This is a local thingy which the remote share doesn't cares about.
What matters is whether the remote share is on-line, operational, accessible and that you have the required privileges.
Re: How to tell if a physical HDD has failed withno drive le
I dont think I explained this very well. I don't care how the script detects if a disk has failed or not; as long as it's reliable. I was just saying it's possible that disk may be empty (where no files or folders are on it).
One more thing to consider.. Considering that the "Backup" folder under C:\Test\Backup is pointing to a physical disk (not the same physical disk that logical drive C: is on). If the "Backup" folder isn't there for any reason, the backup software unfortunately create a local "Backup" sub-directory under "C:\Test" (which is obviously not the same thing as that location pointing to a completely different physical disk). If that were to happen, a script that just checks for files and/or share name, will think that that disk is still there just because there is a folder which exists there.
I was thinking the only way to know for sure that the disk is up or not is to use diskpart to check for the volume label "Backup". If it is there, to check to see if it's pointing to an empty existing folder under C:\Test\Backup. I just dont know how to do that without depending on a separate diskpart.txt script file.
One more thing to consider.. Considering that the "Backup" folder under C:\Test\Backup is pointing to a physical disk (not the same physical disk that logical drive C: is on). If the "Backup" folder isn't there for any reason, the backup software unfortunately create a local "Backup" sub-directory under "C:\Test" (which is obviously not the same thing as that location pointing to a completely different physical disk). If that were to happen, a script that just checks for files and/or share name, will think that that disk is still there just because there is a folder which exists there.
I was thinking the only way to know for sure that the disk is up or not is to use diskpart to check for the volume label "Backup". If it is there, to check to see if it's pointing to an empty existing folder under C:\Test\Backup. I just dont know how to do that without depending on a separate diskpart.txt script file.
Re: How to tell if a physical HDD has failed withno drive le
What would happen if the disk isn't shared and the disk still hasn't failed
That's why I was suggesting that a temporary share would have to be created originally. However, even then, I dont think it would still be reliable for the reason I mentioned in my previous post; which looks like it needs the help of diskpart.

Ed Dyreen wrote:'
No need to check for any file, dir or drive letter.
Let's assume your server's name is backup and one of it's drives is shared as backup, in that caseorCode: Select all
if exist "\\backup\backup\" &&echo.exist ||not exist
It doesn't matter whether your system assigns a drive letter to a remotely shared drive/folder.Code: Select all
if exist "\\192.168.*.*\backup\" &&echo.exist ||not exist
This is a local thingy which the remote share doesn't cares about.
What matters is whether the remote share is on-line, operational, accessible and that you have the required privileges.
Re: How to tell if a physical HDD has failed withno drive le
If the disk isn't shared then it doesn't matter that it has or hasn't failed, you won't have access either way and,MKANET wrote:What would happen if the disk isn't shared and the disk still hasn't failed
if you don't have access, the disk may have failed.
You could run a wmic script on the remote system though, that should provide the info you're after
Code: Select all
wmic.EXE diskdrive

Re: How to tell if a physical HDD has failed withno drive le
Hi Ed, thanks for replying. Unfortunately WMIC diskdrive does not display disk volume labels; which is the only reliable/consistent information I can depend on Backup HDD volume label is always labeled: "Backup".
Anyway, below is the only way I know of to reliably detect if the "Backup HDD" drive has failed; which doesn't mess with share names.
Squashman, I appreciate your response, however, I needed this specifically for a batch file; and, wanted to keep things as simple as possible.
PS: Ed, I think you might have missed this since you might have been in a rush; but that question that you were answering was meant to be rhetorical; hence, why I had a the followup sentence.
Anyway, below is the only way I know of to reliably detect if the "Backup HDD" drive has failed; which doesn't mess with share names.
Code: Select all
psexec.exe \\%Server% echo list volume >%temp%\diskpart.txt|
diskpart /s %temp%\diskpart.txt | find "Backup" >nul&&del %temp%\diskpart.txt
if errorlevel 1 echo disk Backup has failed
Squashman, I appreciate your response, however, I needed this specifically for a batch file; and, wanted to keep things as simple as possible.
PS: Ed, I think you might have missed this since you might have been in a rush; but that question that you were answering was meant to be rhetorical; hence, why I had a the followup sentence.

Ed Dyreen wrote:If the disk isn't shared then it doesn't matter that it has or hasn't failed, you won't have access either way and,MKANET wrote:What would happen if the disk isn't shared and the disk still hasn't failed
if you don't have access, the disk may have failed.
You could run a wmic script on the remote system though, that should provide the info you're afterAnd now if you'll excuse me, I really need to do some homeworkCode: Select all
wmic.EXE diskdrive