Wed 27 Jul 2005 07:17:04 PM UTC, original submission:
I employ a hard-link based backup system similar to that described here:
http://www.mikerubel.org/computers/rsync_snapshots/
It saves only changed files in a set of time-stamped directories. To compute the differential storage usage of a collection of backup directories, it is useful to use:
% du -h --max-depth=1
However, this is made less useful by the fact that du apparently doesn't preserve the lexical ordering of the directories in the shell.
E.g., with this set:
b2005-03-05__04:08:17/
b2005-04-02__04:04:34/
b2005-05-07__04:04:47/
b2005-06-04__04:08:37/
b2005-07-02__04:08:05/
b2005-07-16__04:04:21/
b2005-07-21__04:04:21/
b2005-07-22__04:07:52/
b2005-07-23__04:04:30/
b2005-07-24__04:05:00/
b2005-07-25__04:03:45/
b2005-07-26__04:05:36/
b2005-07-27__04:09:00/
I get:
% du -h --max-depth=1
38G ./b2005-07-02__04:08:05
296M ./b2005-06-04__04:08:37
4.6G ./b2005-07-23__04:04:30
273M ./b2005-07-16__04:04:21
2.5G ./b2005-07-27__04:09:00
3.5G ./b2005-03-05__04:08:17
318M ./b2005-04-02__04:04:34
2.4G ./b2005-07-21__04:04:21
....
I.e., in a random order (not even sorted by the directories' inodes). I cannot use shell expansion to force the order I want:
% du -sh b*
because then du does not keep track of multiply-linked files, and counts them multiple times.
It would be very useful if du traversed directories in lexical order, or if you could optionally enable single-counting of multiply linked files when using multiple command line arguments.
JD Smith
|