ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Look at the specifications of the SSD and post what the value of its TBW or DWPD. DWPD is the amount of drive capacity you can write per day over the warranty period. TBW is the total number of writes for the life of the drive and from there you can determine the writes per day. In most cases that far exceeds what most home users normally write to disk.
Doing a lot of file open, write, close, is slightly slower, but not that much.
The kernel has a buffer and will not write to disk as long as there is free memory, or a "commit interval" setting is reached. I think it's 5 seconds by default on ext4.
I have a Rasperry PI (used as server), and added "noatime,commit=10800" in fstab. Then it will take up to 3 hours to get written disk. Of course I lose more on power failure, but it's ok for me.
It's useful for sd-cards and when it's written to /var/log or other places.
You can use the command "sync" when you want it to actually write to disk.
mod your fstab to put /tmp into ram
tmpfs /tmp tmpfs defaults,noatime,size=3G 0 0
size part is not actually necessary size=3G not needed unless you want to limit it to whatever size you want manually ( i just copy pasted that off my fstab)
then write to /tmp to cut down/off writes to the ssd
Code:
#!/bin/sh
for i in `seq 1 10`
do echo $i >> /tmp/loop.txt
done
cp /tmp/loop.txt ~/
something like that, and stuff in /tmp is lost every time the PC looses electricity
The write process in op means you'll run out of disc space years before disc is worn out...
It's easy to calculate disc's life by looking at the number of bytes writes per day divided in TBW... we're talking decades. The disc will be replaced by other reasons than worn out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.