Is anyone aware of a way to determine if the machine has an SSD, before having my script continue to defrag. I haven't been able to find a command line method, except on Windows 7 machines and testing if Trim is enabled. However, not all SSDs currently on Agents were Trim enabled as we've got some older ones.
According to the documentation I have read... Windows 7 does not auto-defrag SSD's by default. I have not found a way to check other OSes. I don't have many customers using SSD's in non-windows 7 machines so I review the system audit.
Honestly, I feel that if you have to defrag to get your system running suitably, you probably need to upgrade or replace it. Also, if you’re not running Windows 7 by now, you should also upgrade. I know what you’re thinking... some clients have software that requires XP or won't run in Windows 7. When I run into this I get a copy of their software and install it on a Windows 7 test machine. I also use XP-Mode which we pre-install on the PC's we build for the client. We have a 100% success rate for clients that allow me the opportunity. They are the happiest and most loyal customers I have.
Hope this is helpful for you.
You pose a great question. We use JKDEFRAG for our proactive maintenance scripts to defrag hard disk drives for managed computers. I have learned that a DEFRAG operation is a bad idea (no speed improvement, and shortens the useful life) for SSDs. It would be great to somehow be able to determine if a disk was an SSD, and then skip the defrag operation.
For an unrelated proactive maintenance operation, we periodically run a program called SAMRTCTL.EXE to check the S.M.A.R.T. health of a disk. I looked at the output of the results for my personal laptop (which has an SSD disk). I see that for the Device Model is reports "SAMSUNG SSD RBX Series 64GB M" Below my signature is a copy & paste of the entrie output file.
So I suppose we would run the SAMRTCTL.EXE program, look at the saved results, and search for the text "SSD". I can't imagine those letters woudl appear in any other regular english words in the file.
Just an idea. Hope this helps.
smartctl version 5.38 [i686-mingw32-vista-sp2] Copyright (C) 2002-8 Bruce Allen
Home page is smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: SAMSUNG SSD RBX Series 64GB M
Serial Number: DFF0W0S907SE907A1164
Firmware Version: VAM05D1Q
User Capacity: 64,023,257,088 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: ATA/ATAPI-7 T13 1532D revision 1
Local Time is: Thu Apr 19 11:10:52 2012 EDT
==> WARNING: May need -F samsung or -F samsung2 enabled; see manual for details.
SMART support is: Available - device has SMART capability.
Enabled status cached by OS, trying SMART RETURN STATUS cmd.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x02) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
Total time to complete Offline
data collection: ( 120) seconds.
Offline data collection
capabilities: (0x53) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
No Offline surface scan supported.
No Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 12) minutes.
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
9 Power_On_Hours 0x0032 096 096 000 Old_age Always - 17462
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 251
175 Unknown_Attribute 0x0032 100 100 012 Old_age Always - 0
176 Unknown_Attribute 0x0032 100 100 012 Old_age Always - 0
177 Unknown_Attribute 0x0013 100 100 023 Pre-fail Always - 0
178 Unknown_Attribute 0x0013 098 098 012 Pre-fail Always - 1
179 Unknown_Attribute 0x0013 099 099 010 Pre-fail Always - 8
180 Unknown_Attribute 0x0013 051 051 010 Pre-fail Always - 1976
181 Unknown_Attribute 0x0032 100 100 010 Old_age Always - 0
182 Unknown_Attribute 0x0032 100 100 010 Old_age Always - 0
183 Unknown_Attribute 0x0013 100 100 010 Pre-fail Always - 0
187 Reported_Uncorrect 0x0033 100 100 000 Pre-fail Always - 0
195 Hardware_ECC_Recovered 0x001a 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 253 253 000 Old_age Always - 0
232 Unknown_Attribute 0x0013 100 100 012 Pre-fail Always - 61
233 Unknown_Attribute 0x0032 072 072 000 Old_age Always - 1180419652
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 17319 -
# 2 Short offline Completed without error 00% 17053 -
# 3 Short offline Completed without error 00% 16886 -
# 4 Short offline Completed without error 00% 16740 -
# 5 Short offline Completed without error 00% 16558 -
# 6 Short offline Completed without error 00% 16404 -
# 7 Short offline Completed without error 00% 16332 -
# 8 Short offline Completed without error 00% 16260 -
# 9 Short offline Completed without error 00% 16093 -
#10 Short offline Completed without error 00% 16046 -
#11 Short offline Completed without error 00% 15867 -
#12 Short offline Completed without error 00% 15711 -
#13 Short offline Completed without error 00% 15643 -
#14 Short offline Completed without error 00% 15422 -
#15 Short offline Completed without error 00% 15279 -
#16 Short offline Completed without error 00% 15186 -
#17 Short offline Completed without error 00% 14923 -
#18 Short offline Completed without error 00% 14777 -
#19 Short offline Completed without error 00% 14591 -
#20 Short offline Completed without error 00% 14496 -
#21 Short offline Completed without error 00% 14429 -
SMART Selective self-test log data structure revision number 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
Cannot open device \\.\PhysicalDrive1, Error=2
Smartctl open device: hdb failed: No such file or directory
Cannot open device \\.\PhysicalDrive2, Error=2
Smartctl open device: hdc failed: No such file or directory
Cannot open device \\.\PhysicalDrive3, Error=2
Smartctl open device: hdd failed: No such file or directory
I have seen an earlier post on this and they were looking at WMI and smartmon information, what I found at the time though is that there is no singular definitive entry that can tell us if the drive is SSD across all manufacturers. I did find the following from another forum but it is for Linux and don't require defragmentation under Linux;
If it returns 0, you have SSD...
As Kaseya audits some WMI info including DiskDrives there might be a way to build a database of drive models and Tag them as SSD, I'm not sure at the moment how you would go about this, but it might be one way.
A short term method would be to find these machines and to add a Custom Field that you can use to Mark them as machines with SSD's.
I was going to use the custom fields as a workaround for now already. We're also using JkDefrag which was the reason I wanted to be able to determine which are SSDs and skip/exclude. Since our environment isn't massive, the custom fields is okay. If we were huge, I can't see this being a viable solution.
We use have an agent procedure to copy down defraggler.exe and defraggler.ini and then run it. Defraggler is supposed to recognize SSD's and not run on them.
check the windows experience score for Disk if it's over 7 then don't defag it
i have been looking at this, and i think i have a pretty simple answer to this, if you ran defrag -a c: on any SSD, windows doesnt report it needs a defrag, so just output that info to a txt file and if it contains doesnt need a defrag dont do anything.
Please let me know if im wrong here, but i tested this on a number of SSD drives and it never said it needed a defrag.
Very easy, really. You can query WMI for the drive info. Most, if not all SSD drives have SSD in the model name. The attached script is a proof of concept.
I don't believe OCZ's or Samsung's report with SSD in the Model, but luckily, as far as I know, the few that do have SSD's that I manage, use Intel.
Thanks! That will work for me :)