cron+fstrim+ssd logolása

Csak hogy lássam, hogy egyáltalán csinál e valamit!


root@ubuntu:/etc/cron.weekly# cat ./fstrim 
#!/bin/sh
# script datas for logging
ME=$(basename $0)
MP=$$

# trim all mounted file systems which support it
/sbin/fstrim --all -v | while read MSG; do
    /usr/bin/logger -t "${ME}(${MP})" "${MSG}"
done

#test
#grep "fstrim\([0-9]*\)" /var/log/syslog
exit 0

A testgépen:
Partíciók és driveok


root@ubuntu:/etc/cron.weekly# fdisk -l

Disk /dev/loop0: 437,9 MiB, 459102208 bytes, 896684 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 111,8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3c4986ab

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    499711    497664   243M 83 Linux
/dev/sda2       501758 234440703 233938946 111,6G  5 Extended
/dev/sda5       501760 234440703 233938944 111,6G 8e Linux LVM

Disk /dev/sdb: 1,8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/ubuntu--vg-root: 107,7 GiB, 115620184064 bytes, 225820672 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ubuntu--vg-swap_1: 3,9 GiB, 4152360960 bytes, 8110080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

A tesztgép fstabja jelenleg:


root@ubuntu:/etc/cron.weekly# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system>                            <mount point>      <type>  <options>                 <dump>  <pass>
/dev/mapper/ubuntu--vg-root                 /                  ext4    errors=remount-ro          0       1   
# /boot was on /dev/sda1 during installation
UUID=0c60faf1-242d-4e7b-930e-09653e69b92a   /boot              ext2    defaults                   0       2   
/dev/mapper/ubuntu--vg-swap_1               none               swap    sw,discard                 0       0   

UUID=9ccb7a01-54a2-4f33-82d6-366211f8ef49   /home              btrfs  subvol=home,noatime         0       0   
UUID=9ccb7a01-54a2-4f33-82d6-366211f8ef49   /media/repository  btrfs  subvol=repository,noatime   0       0   
UUID=9ccb7a01-54a2-4f33-82d6-366211f8ef49   /media/power       btrfs  subvol=power,noatime        0       0   
UUID=9ccb7a01-54a2-4f33-82d6-366211f8ef49   /srv/storage       btrfs  subvol=storage,noatime      0       0   

/srv/tftpboot/images/systemrescuecd-x86-4.5.4.iso /srv/tftpboot/systemrescuecd udf,iso9660 ro,loop 0      0   

És a log ide vonatkozó része


root@ubuntu:/etc/cron.weekly# grep "fstrim\([0-9]*\)" /var/log/syslog
Sep  5 10:57:42 ubuntu fstrim(23426): /boot: 0 B (0 bytes) trimmed
Sep  5 10:57:42 ubuntu fstrim(23426): /: 0 B (0 bytes) trimmed
Sep  5 11:07:09 ubuntu fstrim(23737): /boot: 0 B (0 bytes) trimmed
Sep  5 11:07:09 ubuntu fstrim(23737): /: 299,1 MiB (313663488 bytes) trimmed

A saját desktopomon:


root@desktop:/etc/cron.weekly# grep "fstrim\([0-9]*\)" /var/log/syslog
Sep  5 10:51:03 desktop fstrim(20777): /boot: 0 B (0 bytes) trimmed;
Sep  5 10:51:03 desktop fstrim(20777): /: 89,6 MiB (93929472 bytes) trimmed;
Sep  5 10:52:09 desktop fstrim(24864): /boot: 0 B (0 bytes) trimmed
Sep  5 10:52:09 desktop fstrim(24864): /: 85,7 MiB (89808896 bytes) trimmed
Sep  5 10:55:38 desktop fstrim(3471): /boot: 0 B (0 bytes) trimmed
Sep  5 10:55:38 desktop fstrim(3471): /: 74,8 MiB (78393344 bytes) trimmed
Sep  5 11:04:06 desktop fstrim(30223): /boot: 0 B (0 bytes) trimmed
Sep  5 11:04:06 desktop fstrim(30223): /: 75 MiB (78585856 bytes) trimmed
Sep  5 11:06:20 desktop fstrim(5097): /boot: 0 B (0 bytes) trimmed
Sep  5 11:06:20 desktop fstrim(5097): /: 107,2 MiB (112381952 bytes) trimmed

Ugyan mit lehetne még mondani erről?

Hozzászólások

Az SSD nem tamogatja a nativ trimet ?

Fedora 22, Thinkpad x220

de. csak úgy lassabb, és még az ezzel foglalkozó oldalak többsége is azt mondja, hogy érdemesebb hetente/naponta fstimet használni inkább.
kevesebb lesz az írási művelet. - állítólag -

hogy ténylegesen mennyivel kevesebb fene tudja. mindenesetre az fstrim benne van a cronban eleve, csak nincs loggolva. hogy miért nem lehetett azt a 3 sort hozzáírni, azt sem tudom.

Ha a meghajtó támogatja a qTRIM-et nyugodtan használhatod a discard opciót! Aztán a vezérlő majd eldönti mikor, mit, hogyan...

> BERUS
Motor: Mageia 5.

az egyik amin próbáltam samsung 850 evo, a másik intenso ssd


root@ubuntu:~# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       Samsung SSD 850 EVO 120GB               
	Serial Number:      ***************     
	Firmware Revision:  EMT01B6Q
	Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
	Used: unknown (minor revision code 0x0039) 
	Supported: 9 8 7 6 5 
	Likely used: 9
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		16	16
	sectors/track	63	63
	--
	CHS current addressable sectors:   16514064
	LBA    user addressable sectors:  234441648
	LBA48  user addressable sectors:  234441648
	Logical  Sector size:                   512 bytes
	Physical Sector size:                   512 bytes
	Logical Sector-0 offset:                  0 bytes
	device size with M = 1024*1024:      114473 MBytes
	device size with M = 1000*1000:      120034 MBytes (120 GB)
	cache/buffer size  = unknown
	Nominal Media Rotation Rate: Solid State Device
Capabilities:
	LBA, IORDY(can be disabled)
	Queue depth: 32
	Standby timer values: spec'd by Standard, no device specific minimum
	R/W multiple sector transfer: Max = 1	Current = 1
	DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4 
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
	Enabled	Supported:
	   *	SMART feature set
	    	Security Mode feature set
	   *	Power Management feature set
	   *	Write cache
	   *	Look-ahead
	   *	Host Protected Area feature set
	   *	WRITE_BUFFER command
	   *	READ_BUFFER command
	   *	NOP cmd
	   *	DOWNLOAD_MICROCODE
	    	SET_MAX security extension
	   *	48-bit Address feature set
	   *	Device Configuration Overlay feature set
	   *	Mandatory FLUSH_CACHE
	   *	FLUSH_CACHE_EXT
	   *	SMART error logging
	   *	SMART self-test
	   *	General Purpose Logging feature set
	   *	WRITE_{DMA|MULTIPLE}_FUA_EXT
	   *	64-bit World wide name
	    	Write-Read-Verify feature set
	   *	WRITE_UNCORRECTABLE_EXT command
	   *	{READ,WRITE}_DMA_EXT_GPL commands
	   *	Segmented DOWNLOAD_MICROCODE
	   *	Gen1 signaling speed (1.5Gb/s)
	   *	Gen2 signaling speed (3.0Gb/s)
	   *	Gen3 signaling speed (6.0Gb/s)
	   *	Native Command Queueing (NCQ)
	   *	Phy event counters
	   *	READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
	   *	DMA Setup Auto-Activate optimization
	    	Device-initiated interface power management
	   *	Asynchronous notification (eg. media change)
	   *	Software settings preservation
	    	Device Sleep (DEVSLP)
	   *	SMART Command Transport (SCT) feature set
	   *	SCT Write Same (AC2)
	   *	SCT Error Recovery Control (AC3)
	   *	SCT Features Control (AC4)
	   *	SCT Data Tables (AC5)
	   *	reserved 69[4]
	   *	DOWNLOAD MICROCODE DMA command
	   *	SET MAX SETPASSWORD/UNLOCK DMA commands
	   *	WRITE BUFFER DMA command
	   *	READ BUFFER DMA command
	   *	Data Set Management TRIM supported (limit 8 blocks)
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
		frozen
	not	expired: security count
		supported: enhanced erase
	2min for SECURITY ERASE UNIT. 8min for ENHANCED SECURITY ERASE UNIT. 
Logical Unit WWN Device Identifier: 5002538da02496db
	NAA		: 5
	IEEE OUI	: 002538
	Unique ID	: da02496db
Checksum: correct
Device Sleep:
	DEVSLP Exit Timeout (DETO): 50 ms (drive)
	Minimum DEVSLP Assertion Time (MDAT): 30 ms (drive)

ill.


$ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       INTENSO SSD 128GB                       
	Serial Number:      ************        
	Firmware Revision:  N0530A  
	Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
	Supported: 9 8 7 6 5 
	Likely used: 9
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		16	16
	sectors/track	63	63
	--
	CHS current addressable sectors:   16514064
	LBA    user addressable sectors:  250064404
	LBA48  user addressable sectors:  250064404
	Logical  Sector size:                   512 bytes
	Physical Sector size:                   512 bytes
	Logical Sector-0 offset:                  0 bytes
	device size with M = 1024*1024:      122101 MBytes
	device size with M = 1000*1000:      128032 MBytes (128 GB)
	cache/buffer size  = unknown
	Nominal Media Rotation Rate: Solid State Device
Capabilities:
	LBA, IORDY(can be disabled)
	Queue depth: 32
	Standby timer values: spec'd by Standard, no device specific minimum
	R/W multiple sector transfer: Max = 2	Current = 2
	DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4 
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
	Enabled	Supported:
	   *	SMART feature set
	    	Security Mode feature set
	   *	Power Management feature set
	   *	Write cache
	   *	Look-ahead
	   *	Host Protected Area feature set
	   *	WRITE_BUFFER command
	   *	READ_BUFFER command
	   *	NOP cmd
	   *	DOWNLOAD_MICROCODE
	    	SET_MAX security extension
	    	Automatic Acoustic Management feature set
	   *	48-bit Address feature set
	   *	Mandatory FLUSH_CACHE
	   *	FLUSH_CACHE_EXT
	   *	SMART error logging
	   *	SMART self-test
	   *	General Purpose Logging feature set
	   *	WRITE_{DMA|MULTIPLE}_FUA_EXT
	   *	{READ,WRITE}_DMA_EXT_GPL commands
	   *	Segmented DOWNLOAD_MICROCODE
	   *	Gen1 signaling speed (1.5Gb/s)
	   *	Gen2 signaling speed (3.0Gb/s)
	   *	Gen3 signaling speed (6.0Gb/s)
	   *	Native Command Queueing (NCQ)
	   *	Host-initiated interface power management
	   *	READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
	   *	DMA Setup Auto-Activate optimization
	    	Device-initiated interface power management
	   *	Software settings preservation
	    	unknown 78[10]
	   *	DOWNLOAD MICROCODE DMA command
	   *	WRITE BUFFER DMA command
	   *	READ BUFFER DMA command
	   *	Data Set Management TRIM supported (limit 8 blocks)
	   *	Deterministic read ZEROs after TRIM
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
		frozen
	not	expired: security count
		supported: enhanced erase
	2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT. 
Checksum: correct

Mi van akkor, ha nem nullázódik az érték?

L ~ : sudo /sbin/fstrim --all -v
/home: 9,1 GiB (9811599360 bytes) trimmed
/: 9,1 GiB (9739755520 bytes) trimmed

Majd nem sokkal később:

L ~ : sudo /sbin/fstrim --all -v
/home: 9,1 GiB (9742749696 bytes) trimmed
/: 9,1 GiB (9742745600 bytes) trimmed