On Sat, Apr 30, 2016 at 10:39:35PM -0400, Theodore Ts'o wrote: > On Mon, Apr 04, 2016 at 12:39:53AM +0200, Adam Borowski wrote: > > As "filefrag" seems to work fine for non-root, I think it should be moved > > from */sbin/ to */bin/. In the past, it used FIBMAP which indeed was > > root-only but as since kernel 2.6.28 we have FIEMAP, filefrag is useful for > > ordinary users. > > It's the "useful for ordinary users" test which I question. Most > users (unless they have sudo access) aren't going to have raw access > to the block device, so the actual block numbers aren't going to > matter. Nor does knowing how fragmented a file might be going to be > of interest to most users. To system administrators and file system > developers, yes --- but to most users, I don't think so.
Looking at block numbers is useless on ext4, yes. But on CoW-capable filesystems it lets you know whether you're looking at two references to the same file (or, if you actually parse the output, what parts are shared between two modified copies of the file). This is useful for example if: * you're looking for duplicates (for whatever reason) * you're interested in knowing how much disk space a set of files takes > Moving binaries around can break shell scripts, and doesn't really add > a lot of value. If you're the sort of user that is interested in > using filefrag, you'll probably also be interested in mkfs or debugfs, > and those are in /sbin as well. So just add /sbin to your path. :-) mkfs and debugfs have pretty limited uses for non-root (although non-zero if eg. qemu is involved). On the other hand, reflink detection has mainstream uses even for a sharply restricted user (because of quota, etc). -- A tit a day keeps the vet away.

