Inferring Trimming Activity of Solid

Inferring Trimming Activity of Solid-State Drives
Based on Energy Consumption
James Shey, Ryan Rakvic, Hau Ngo, Owens Walker, Thomas Tedesso, Justin A. Blanco, Kevin Fairbanks
Electrical and Computer Engineering Department
United States Naval Academy
Annapolis, MD, US.
{shey, rakvic, ngo, owalker, tedesso, blanco, fairbank}@usna.edu
Abstract—Solid-state drives (SSDs) have become pervasive in
modern computing and are replacing hard disk drives in many
applications. However, the mechanism by which SSDs store and
modify data is intrinsically different from hard disk drives.
For example, a memory location on a SSD must be erased
prior to being written. The main contribution of this paper
is a set of measurement and analysis techniques for inferring
the behavior of a SSD by observing its power consumption.
This paper measures and analyzes the energy consumption of
the TRIM command for three separate SSDs. Energy and time
models are derived for all three SSDs and it is shown that these
models are approximately linear as a function of the size of the
file being trimmed. Additionally, empirically obtained signatures
are presented to identify when a TRIM command is issued to
the SSD based on the observed waveform. Our findings support
the hypothesis that energy and time models, as well as power
signatures, differ among drive manufacturers.
Index Terms—SSD; power consumption; modeling;
I. I NTRODUCTION
Solid State Drives (SSDs) come from a niche market, but
recently entered the mainstream storage-media market and are
available on a wide variety of consumer computers, including
laptops. As an alternative to conventional hard disk drives
(HDDs), SSDs have several benefits including lower readwrite latency and lower energy consumption [1]. SSDs have
become pervasive in modern computing, aided by the fact
they are manufactured with equivalent interfaces and form
factors as magnetic HDDs, allowing an smooth transition.
However, the mechanism by which SSDs store and modify
data is intrinsically different from HDDs. Many factors, which
are hardware and software related, affect the operation of SSDs
[2].
The main contribution of this paper is a measurement and
analysis technique for inferring a specific SSD command,
TRIM, by observing the power consumption of the measured
device. The impact of this work touches the fields of computer
security and privacy as an SSD’s power consumption can
be profiled and aberrant behavior flagged similar to the side
channel detection described in [3]. From a digital forensics
and/or confidentiality concern standpoint, it may be important to know with some certainty how the behavior of a
particular SSD will affect the ability to retrieve information.
Additionally, from a reliability viewpoint, a change in the
power consumption behavior could signal that a device is
malfunctioning. Accordingly, it is important to develop various
techniques to examine SSDs and ensure a particular device is
behaving as expected. There has been work on the energy
efficiency of SSDs [4–6], but an extensive literature review
indicates that this is the first effort to correlate a specific class
of SSD functionality, such as TRIM, with power consumption.
This paper is organized as follows. A brief review of the
architecture and operation of SSDs is provided in Section II
while Section III discusses related work. The experimental
design is presented in Section IV and the results are discussed
in Section V. Finally, Section VI draws conclusions and
proposes future work.
II. SSD A RCHITECTURE AND O PERATION
SSDs have faster access speeds because they do not have the
moving mechanisms that are present their HDD counterparts.
Without the moving heads and rotating platters, every block on
the same physical chip can be accessed with the same latency.
While SSDs can be built on either NOR or NAND flash
memory technology, most modern SSDs utilize the NAND
architectures. Floating transistors in NAND-flash memory are
arranged in rectangular grids known as memory blocks. Each
transistor in a column is connected in series such that the
drain terminal of one is connected to the source terminal of
the next transistor in the column. A typical memory block has
32 to 256 columns and 4096 to 65536 rows. Each row in a
block is called a page. Within a memory block, word lines are
connected to the gates of each row. The source terminal of the
first transistor in each column, known as the source select, is
connected to the source line. Due to the setup of NAND flash
memory, it must be erased in blocks.
To ensure that the access time remains fast throughout the
lifetime of the SSD, many manufacturers employ a technique
to reclaim pages with obsolete data known as garbage collection. The SSD controller keeps track of whether the data
within the pages of each block are valid or obsolete. When the
SSD is idle, the controller performs the garbage collection task
which relocates pages with valid data in a partially filled block
to another (presumably better utilized) block, and then erases
the original partially filled block. How aggressively and how
often the SSDs perform garbage collection is manufacturer
dependent [1, 7, 8].
To ensure longevity of the drive manufacturers employ wear
leveling. Each transistor can be written to a finite number of
times. Wear leveling works with garbage collecting to write
data to blocks that have the lowest number of writes.
TRIM is a command that allows the operating system to
send the SSD a message indicating that a file (which translates
to all pages that belong to that file) can be marked as obsolete
so that all the pages belonging to a deleted file data can be
erased [8].
III. R ELATED W ORK
As SSDs continue to gain popularity, studying their performance characteristics has become an area of major interest
[1, 7, 9]. In [7], the performance of SSDs using the TRIM
feature is analyzed and it is shown that the TRIM feature can
have a noticeable degradation on performance for SSDs.
In [6, 8, 10, 11], it has been demonstrated that the features that SSD manufactures present in their datasheets are
sometimes misleading. As an example, leading manufactures
sometimes claim to perform TRIM, but a detailed black-box
approach [8] found otherwise. This black-box analysis utilizes
a software suite (including the algorithm outlined in [11]) to
verify the bits on the drive in order to make inferences about
SSD behavior [8]. In our work, we make use of the blackbox approach [8] in our experimental setup and the algorithm
in [11] to test whether a drive has actually been erased after
having been given the command to erase it.
There are numerous articles that have studied the power
usage of different digital devices [12, 13] and, in particular,
hard drives [4–6, 14–16]. There has also been work on the
efficiency of SSDs by determining the relationship between
workload and energy [3, 4] and one effort [6], through the use
of power analysis, demonstrated that a specific SSD performed
writes in coarser granularity than a single page. Other related
work [14, 15] has focused primarily on modeling, whereas the
research presented here is experimental.
Figure 1. System Setup including (a) Daughterboard and (b) Data Recorder
Table I
S OLID -S TATE D RIVES T ESTED
A. Computer Setup
The testbed system is an Intel Core i5-2400 System with
16 GB DDR3 PC3-10600 running Windows 7 Service Pack
1. The system contains two drives, the first is an HDD that
contains the Operating System and all software required for
the experiments, and the second is the SSD to be tested. This
setup ensures that the read, write, and delete commands for
the target SSD are controlled through the testbed programs (as
opposed to the OS). The test SSDs are listed in Table I.
B. SSD Monitoring
IV. E XPERIMENT D ESIGN
This section describes the experimental setup used to monitor the power consumption of an SSD and map it to commands provided to the SSD. The entire measurement system
is automated through the workload program to synchronize
the measurements of the executed commands with the data
recorder via the computer’s serial port. The overall setup is
shown in Fig. 1. TRIM commands were evaluated for file
sizes of 1GB, 5 GB, 10 GB, 15 GB, 20 GB, and 25 GB
as well as total disk usage of 25%, 50%, 75%, and 100%.
The common, fixed file size measurements allow SSDs to be
compared directly. Ten trial runs were conducted for each data
point. The remainder of this section discusses the setup of
the computer, monitoring of the SSD, and operation of the
workload program.
To monitor the test SSD, a daughterboard consisting of two
low-resistance precision resistors was inserted into the drive’s
4 pin Disk Drive Power Connector lines, as shown in Fig.
1(a). A common measurement approach, this layout is similar
to the setup used in [14]. The daughterboard provides test
points to monitor the voltage across the resistor and across
the SSD. Both voltages are measured using 14 bits/sample at
2 MS/s with 10:1 passive probes by a GEN3i High-Speed
Data Recorder with a GN412 High-Speed 100 MS/s Data
Acquisition Card, shown in Fig. 1(b). This setup allowed
adequate sampling to capture all changes in the SSD current
and voltage while maintaining an error of less than 1mV. The
data recorder also monitors the serial port of the computer,
enabling the recording of when commands are executed for
different operations on the computer.
for each drive which is shown in Fig. 6 and Fig. 7. Signature
in this context is a unique pattern of energy consumption and
not a mathematical model. The rectangular pulses represent
a shift in the average power consumption of the drive. The
time and energy scales on these signatures prototypes are the
same where time 0 for each signature is the time at which the
OS issued the TRIM command. The median delay from the
issue of the TRIM command until the signature is seen for
each drive is derived from the data of Fig. 5. Signatures are
shown for both the TRIM Enabled and Disabled cases. It is
significant to note that in the case of TRIM Disabled, there
is no discernible pattern for the pulses and the pulses are not
distinguishable from periodic pulses in the SSD’s activity. The
individual results for each SSD are discussed in the following
sections.
A. Crucial
The Crucial SSD exhibited a consistent energy signal each
time the TRIM command was executed and the amount of
energy required for TRIM appeared to be a linear function of
the file size as shown in Fig. 4. The linear regression model of
the SSD’s energy consumption, E, in Joules, against trimmed
file size, ψ, in Gigabytes (GB) is
E = 0.1067ψ + 0.5252
(1)
with a coefficient of determination (R2 ) of 0.9975. The time,
T, in seconds, for the Crucial to complete the TRIM command
is modeled as
T = 0.1899ψ + 1.0445
Figure 2. Workload Program Flow Chart
C. Workload
A Python program was designed to automate the creation
and deletion of files and ensure time synchronization between
the host computer and the data recorder. A flow chart for
the program is presented in Fig. 2. The program creates a
file of desired size containing random bytes to ensure that
the power consumed is not data dependent. The data recorder
is synchronized before the delete command is issued via the
serial port. The algorithm developed by Bell-Boddington [11]
is used to verify that the TRIM command has fully deleted the
file. If the file has not been fully erased, the program formats
the drive prior to the creation of another file.
V. E XPERIMENTAL R ESULTS
The TRIM command was executed for each drive (ten trial
runs per data point, per drive) and the experiment yielded the
energy consumption model shown in Fig. 3 and the elapsed
time for completion of the TRIM command shown in Fig. 4.
Fig. 5 shows the histogram of the time from the issue of
the TRIM command from the computer until the signature
for each drive is seen. From this data and analysis of the
waveform of each drive for each run, signatures were created
(2)
which is the linear regression equation corresponding to Fig.
4 with an R2 of 0.9954
The Crucial had the widest range of time from when the
TRIM command was issued until the corresponding energy
signature was seen, 5.9698s to 46.8988s, with the median
being 20s, as shown in Fig. 5. All times above 30s were for
deletion of files of 50% of the drive or greater.
The Crucial energy signature always ended with a pulse
averaging 490.5854 ms corresponding to 0.3653 J. Additionally, the Crucial exhibited the closest R2 to 1 for both energy
consumption and elapsed time as a function of the file size
of the trimmed file. This analysis led to the signature shown
in Fig. 6(a) and Fig. 7(a). In Fig. 7(a), the first pulse is of
variable length and can be a combination of up to 3 pulses.
This signature can potentially be used to identify that the
TRIM command is being issued to the Crucial SSD.
B. OCZ
The OCZ would trim each time the TRIM command was
issued but would only fully delete the file for file sizes less than
1 GB. This result corroborates the finding in [8], where some
SSDs would not fully delete the data with a TRIM command
and thus portions of the original file were recoverable. For file
sizes greater than 1 GB, the OCZ appeared to delete portions
Table II
OCZ TRIM O PERATION
Figure 3. Energy to trim one file
of the file in a stepped approach. Table II shows the amount
of the file deleted when the TRIM command was used.
The linear regression model of Fig. 3 for the OCZ’s energy
consumption is
E = 0.0787ψ + .8322
(3)
with an R2 of 0.9783. The time for the TRIM model is
T = 0.18ψ + 1.8109
Figure 4. Time to trim one file
Figure 5. Time from TRIM command issued until signature
(4)
and is the linear regression of Fig. 4 with an R2 of 0.9797.
This lower R2 value for Fig. 3 and Fig. 4 can be attributed
to the OCZ trimming in a stepwise pattern (as seen in Fig. 3,
Fig. 4, and Table II).
Looking at the time from the when the TRIM command was
issued until the corresponding energy signature was seen, the
OCZ had a range of 5.5654s to 20.6408s, as shown in Fig.
5, with a median of 17s. The OCZ had the highest steadystate power usage at 415mW, but the energy consumption
for the OCZ TRIM was the lowest compared to the other
SSDs. Steady-state power is the power the SSD uses when
there are no commands issued to it. This lower value for the
TRIM command is not surprising since the OCZ did not fully
delete the trimmed file. One possible explanation for not fully
deleting a trimmed file is the performance limitations imposed
by fully trimming a file as outlined in [7].
The OCZ TRIM command signature shown in Fig. 6(b) and
Fig. 7(b) is based on this experimental data. The appreciable
difference between the trim of two different file sizes for the
OCZ SSD is the duration of the pulse, as shown in Fig. 7(b)
compared to Fig. 6(b).
Figure 6. 1 GB file TRIM signature
Figure 7. 5 GB file TRIM signature
C. Samsung
Similar to the Crucial, the Samsung SSD appeared to
erase the whole file with every TRIM command. The linear
regression of Fig. 3 for the Samsung’s energy consumption is
E = 0.9217ψ + 1.42
(5)
with an R2 of 0.9955.
The corresponding linear regression of the time for the
TRIM model from Fig. 4 is
T = 1.8895ψ + 3.6646
(6)
with an R2 of 0.9904.
The Samsung SSD had the lowest steady-state power usage
of all the SSDs tested and the time from issuing the TRIM
Command until the corresponding energy signature was seen
as nearly the same as that of the OCZ SSD, 5.3145s to 20.503s
with a median of 20s, as shown in Fig. 5.
The signature for the Samsung was built on this data and is
shown in Fig. 6(c) and Fig. 7(c). The appreciable difference
between the TRIM models of two different file sizes is the
duration of the first pulse as shown in Fig. 7(c) when compared
to Fig 6(c).
VI. C ONCLUSIONS AND F UTURE W ORK
This paper examined the energy signature of three SSDs to
infer trim commands issued to them. The signatures presented
in this paper demonstrate that it is possible to infer TRIM
activity based on energy usage and visual pattern matching.
Additionally, our results suggest a linear relationship between
energy consumption and the file size of the file being trimmed
and between TRIM completion time and the size of the file
being trimmed.
Different signatures emerge when analyzing the SSDs from
different manufacturers. This may be attributable to each
manufacturer using a proprietary controller and algorithms to
accomplish the functions of a SSD, as discussed in [7, 8].
Figure 8. 1 GB File Write
The ability to distinguish the TRIM command from other
commands is an integral part of fully understanding a SSD.
An observed 1 GB file write for each drive can be seen in
Fig. 8. This observation is not overlaid on Fig. 6 due the
magnitudes of power for the write. Visually comparing the
TRIM signatures (Fig. 6) and observed write (Fig. 8), it is
possible to differentiate the TRIM command from the write.
Models and signatures for write and read need to be fully
developed as well as SSD controller functions (e.g., garbage
collection and wear leveling) to create a more comprehensive
signature library.
All data were analyzed in the time domain in this work.
Further analysis using frequency domain features and machine
learning may yield additional information as well as automated
approaches to SSD behavior inference based on energy/power
signatures. Preliminary work is also being conducted to evaluate the energy consumption using a Rogowski coil and the
results appear promising. This would be less invasive than the
daughterboard technique currently in use and would improve
the scalability of the approach.
ACKNOWLEDGMENT
We would like to thank Rupam Mondal for his work on the
Python workload program.
[13]
R EFERENCES
[1] H. Huang, S. Li, A. Szalay, and A. Terzis, “Performance
modeling and analysis of flash-based storage devices,” in
Mass Storage Systems and Technologies (MSST), 2011
IEEE 27th Symposium on, May 2011, pp. 1–11.
[2] N. Agrawal, V. Prabhakaran, T. Wobber, J. D. Davis,
M. Manasse, and R. Panigrahy, “Design Tradeoffs for
SSD Performance,” in USENIX Annual Technical Conference, Boston, MA, USA, 2008, pp. 57–70.
[3] M. Tehranipoor and F. Koushanfar, “A survey of hardware trojan taxonomy and detection,” Design Test, IEEE,
vol. PP, no. 99, pp. 1–1, 2013.
[4] S. Shin and D. Shin, “Power Analysis for Flash Memory
SSD,” in Workshop for Operating System Support for
Non-Volatile RAN (NVRAMOS 2010), Jeju, Korea, 2010.
[5] E. Seo, S. Park, and B. Urgaonkar, “Empirical Analysis
on Energy Efficiency of Flash-based SSDs,” in Proceedings of the conference on Power Aware Computing and
Systems (HotPower ’08), San Diego, CA, USA.
[6] B. Yoo, Y. Won, J. Choi, S. Yoon, S. Cho, and S. Kang,
“SSD Characterization: From Energy Consumption’s
Perspective,” in Proceedings of the 3rd USENIX conference on Hot topics in storage and file systems (HotStorage 2011), Portland, OR, USA, 2011, pp. 3–3.
[7] G. Kim and D. Shin, “Performance Analysis of SSD
write using TRIM in NTFS and EXT4,” Computer Sciences and Convergence Information Technology (ICCIT),
pp. 422–423, 2011.
[8] G. Bonetti, M. Viglione, A. Frossi, F. Maggi, and
S. Zanero, “A Comprehensive Black-box Methodology
for Testing the Forensic Characteristics of Solid-state
Drives,” in Proceedings of the 29th Annual Computer
Security Applications Conference, New Orleans, LA,
USA, 2013, pp. 269–278.
[9] J. Yoo, Y. Won, J. Hwang, S. Kang, J. Choi, S. Yoon, and
J. Cha, “VSSIM: Virtual machine based SSD simulator,”
in Mass Storage Systems and Technologies (MSST), 2013
IEEE 29th Symposium on, May 2013, pp. 1–14.
[10] S. Li and H. Huang, “Black-box performance modeling
for solid-state drives,” in Modeling, Analysis Simulation
of Computer and Telecommunication Systems (MASCOTS), 2010 IEEE International Symposium on, Aug
2010, pp. 391–393.
[11] G. Bell and R. Boddington, “Solid State Drives: The
Beginning of the End for Current Practice in Digital
Forensic Recovery?” Journal of Digital Forensics, Security and Law, pp. 1–20, 2010.
[12] M. Wendt, M. Grumer, C. Steger, R. Weiss, U. Neffe,
and A. Muhlberger, “Energy consumption measurement
[14]
[15]
[16]
technique for automatic instruction set characterization of
embedded processors,” in Instrumentation and Measurement Technology Conference Proceedings, 2007. IMTC
2007. IEEE, May 2007, pp. 1–4.
V. Konstantakos, A. Chatzigeorgiou, S. Nikolaidis, and
T. Laopoulos, “Energy consumption estimation in embedded systems,” in Instrumentation and Measurement
Technology Conference, 2006. IMTC 2006. Proceedings
of the IEEE, April 2006, pp. 235–238.
J. Yan, C. Lonappan, A. Vajid, D. Singh, and W. Kaiser,
“Accurate and low-overhead process-level energy estimation for modern hard disk drives,” in Green Computing
and Communications (GreenCom), 2013 IEEE and Internet of Things (iThings/CPSCom), IEEE International
Conference on and IEEE Cyber, Physical and Social
Computing, Aug 2013, pp. 171–178.
V. Mohan, S. Gurumurthi, and M. Stan, “Flashpower: A
detailed power model for nand flash memory,” in Design,
Automation Test in Europe Conference Exhibition, 2010,
March 2010, pp. 502–507.
G. Hong, “Analysis of peak current consumption
for large-scale, parallel flash memory,” in Workshop
for Operating System Support for Non-Volatile RAN
(NVRAMOS 2011), Jeju, Korea, 2011.