Project

General

Profile

Feature #7967

Want apparent size option for du(1)

Added by Dale Ghent over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2017-03-14
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

Traditionally, du(1) computes a file's size by recording its stat.st_blocks value as returned by fstat(). In the end, these values are tallied for the list of files du operated against and multiplied by a static block size (512 byes) to compute how much space, in blocks, the file consumes.

In today's world of compressed file systems, sparse files, so-on, du(1) could offer information regarding the "apparent" size of a given file, as the file size that the user understands it to be might be larger than the number of on-disk blocks it physically occupies. This may be done by using stat.st_size instead, as what ls does.

Other implementations of du address this issue. GNU Coreutils' du offers the --apparent-size long opt, and FreeBSD's du does the same albeit with a decidedly less-cumbersome -A option. It is the submitter's opinion that -A is fine for use in the illumos arena as it is currently not claimed by any du option.

History

#1

Updated by Dale Ghent over 3 years ago

  • % Done changed from 70 to 100
#3

Updated by Electric Monk over 3 years ago

  • Status changed from New to Closed

git commit 8aaea06ac924e217626f879f326b781e9780f7d7

commit  8aaea06ac924e217626f879f326b781e9780f7d7
Author: Dale Ghent <daleg@omniti.com>
Date:   2017-03-15T19:31:16.000Z

    7967 Want apparent size option for du(1)
    Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Also available in: Atom PDF