Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
09-15-2025, 02:43 PM
|
#1
|
|
Member
Registered: Oct 2022
Posts: 145
Rep:
|
How to see how much data was read and written since boot?
[ Log in to get rid of this advertisement]
I would like to know how many GB of data were read and written by all processes since boot. Ideally I would like to see this statistic for each data storage device individually, but it would be good without this too. How can this be accomplished?
gnome-system-monitor shows this statistic on an individual process basis only.
|
|
|
|
09-15-2025, 03:04 PM
|
#2
|
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,618
|
Not sure that you can. Unless you kept tract of it at the start.
I suppose that you could look at Lifetime writes:
Example:
Code:
tune2fs -l /dev/sda2
Then look at it again later. Subtract the difference.
|
|
|
|
09-15-2025, 03:12 PM
|
#3
|
|
LQ Guru
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 6,485
|
Set a process to report the total writes to storage early in the shutdown process, and then late in the reboot process, and have those log to a file. (Make sure logrotate is installed and configured to limit the growth of that log.) Now you can either go look at the log and do the math, or write a process to scan the log and do the math for you and report. That would give you the total written during shutdown and boot.
If your report program runs the same total writes detection and subtracts the logged number from the last boot you have the total written since boot.
If you get fancy you can create some neat graphs if you like.
I do not need this, but it sounds like a useful process for someone who NEEDS to know!
Last edited by wpeckham; 09-15-2025 at 03:16 PM.
|
|
|
|
09-15-2025, 03:58 PM
|
#4
|
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,859
|
Quote:
Originally Posted by exerceo
I would like to know how many GB of data were read and written by all processes since boot. Ideally I would like to see this statistic for each data storage device individually, but it would be good without this too. How can this be accomplished?
gnome-system-monitor shows this statistic on an individual process basis only.
|
See the "proc(5)" manpage and search for "diskstats" and the tip on what section of the kernel documentation to read next (probably /usr/src/linux/Documentation/admin-guide/iostats.rst). You might need to install the kernel sources package to see those files. Unfortunately, I see nothing that indicates the amount (MB, GB, whatever) of data that has been transferred to/from each device -- only the number of reads and writes (along with a bunch of timing data). If you're looking for some sort of performance indicator, reads and writes might help you locate overloaded disks (containing "hot" files).
Hope this helps a bit...
Cheers.
|
|
|
|
09-15-2025, 05:25 PM
|
#5
|
|
Member
Registered: Jul 2021
Location: Arcadia
Distribution: LFS, (Slackware-15.0 backup)
Posts: 299
Rep: 
|
Code:
[root@arcadia migration]# iostat
Linux 5.15.188 (arcadia.lo) 09/16/2025 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
7.55 1.33 4.39 0.06 0.00 86.67
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
dm-0 0.38 4.28 23.84 0.00 2602255 14508612 0
sda 0.00 0.05 0.00 0.00 30118 0 0
sdb 0.50 6.29 31.09 0.00 3830503 18917864 0
sdc 0.00 0.06 0.00 0.00 33920 0 0
[root@arcadia migration]#
Maybe that helps.
|
|
|
|
09-16-2025, 01:35 AM
|
#6
|
|
LQ Veteran
Registered: May 2008
Posts: 7,245
|
Using --pretty and -dmN makes it look a little nicer. Especially so if, like me, you use device-mapper:
Code:
$ iostat --pretty -dmN
Linux 6.16.6-local (crux) 09/16/25 _x86_64_ (4 CPU)
tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd Device
0.83 0.00 0.01 0.00 745 2130 0 lukssda4
0.00 0.00 0.00 0.00 1 0 0 sysvg-lvswap0
0.00 0.00 0.00 0.00 1 0 0 sysvg-lvslack150
0.77 0.00 0.01 0.00 742 2130 0 sysvg-lvcrux38
0.22 0.00 0.00 0.00 134 206 0 lukssda5
0.02 0.00 0.00 0.00 17 0 0 datavg-lvslackware
0.17 0.00 0.00 0.00 100 206 0 datavg-lvlocal
0.01 0.00 0.00 0.00 10 0 0 datavg-lvlibrary
0.00 0.00 0.00 0.00 4 0 0 datavg-lvwork
0.00 0.00 0.00 0.00 1 0 0 datavg-lvmirrors
0.53 0.01 0.01 0.00 889 2337 0 sda
Last edited by GazL; 09-16-2025 at 01:46 AM.
|
|
|
|
09-16-2025, 05:51 AM
|
#7
|
|
Member
Registered: Apr 2003
Posts: 951
Rep: 
|
Caveat - untested.
Code:
cat /proc/diskstats | awk '$6 > 0 || $10 > 0 {printf "%s - Read: %.2f GB, Written: %.2f GB\n", $3, $6 * 512 / 1073741824, $10 * 512 / 1073741824}'
|
|
|
|
09-16-2025, 07:03 AM
|
#8
|
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,479
|
Conceptually ok, but what about 4k sector devices ?. And/or a mix of both.
The monitoring tools like iostat manage this for you - as the OP would have found out with a basic search. However they tend to be interval driven rather than a single period since boot, so the above would be also my preferred route.
|
|
|
|
All times are GMT -5. The time now is 06:30 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|