[Novalug] Does swap shorten the life of solid state drives?

Jon LaBadie novalugml@jgcomp.com
Thu Jan 27 03:23:30 EST 2011


On Wed, Jan 26, 2011 at 05:39:45PM -0800, John Christopher wrote:
> I have a 30 GB SSD, 2 GB RAM, and Ubuntu 10.10.
> I bought the SSD back in October 2010.
> This is a light duty family computer that gets
> used for web surfing, writing homework papers
> on OpenOffice, etc.
> 
> According to a podcast I listened to recently,
> if you have an SSD and you are using Linux, 
> you should turn off swap because the swap 
> partition will be written to far more often 
> than the other partitions.  Is this correct?
> If so, how do I turn off swap?
> 
> Thanks for your help.

Jason already noted swapoff/swapon, but another use for swapon
is to show current swap usage:

  $ swapon -s
  Filename            Type           Size      Used      Priority
  /dev/sda2         partition      8385924        8        -1

This systems has been up for about 18 hours and currently only
8 1K blocks, out of 8 million are in use.

But what about over time?  The iostat command can report on total
disk activity since boot.

  $ iostat /dev/sda1 /dev/sda2 /dev/dm-?
  Linux 2.6.35.10-74.fc14.i686.PAE (mums.jgcomp.com) 01/27/2011 _i686_ (2 CPU)

  avg-cpu:  %user   %nice %system %iowait  %steal   %idle
             6.51    3.12   18.86    0.25    0.00   71.26

  Device:    tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn  Mnt_Point *
  sda1      0.02         0.09         0.00       4758         20  /boot
  sda2      0.01         0.07         0.00       3524          0  swap
  dm-0      1.53        20.68         7.53    1105922     402488  /
  dm-1      0.02         0.06         0.08       3106       4288  /var/spool
  dm-2      1.15        11.81         7.01     631866     375120  /var
  dm-3      0.01         0.05         0.01       2618        304  /usr/local
  dm-4      0.26         0.06         2.03       3082     108472  /tmp
  dm-5      0.85         2.38         5.96     127034     318768  /home
  dm-6      0.46         2.62         3.49     140090     186720  /opt
  dm-7      7.30        47.92        53.41    2563058    2856552  /vm

 * I added the mount point column.

The data represent all activity on each partition since boot.
To me, it doesn't seem like swap gets much activity.

Jon
-- 
Jon H. LaBadie                  novalugml@jgcomp.com
 JG Computing
 12027 Creekbend Drive		(703) 787-0884
 Reston, VA  20194		(703) 787-0922 (fax)



More information about the Novalug mailing list