[ 
https://issues.apache.org/jira/browse/HDFS-8986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14730738#comment-14730738
 ] 

Gautam Gopalakrishnan commented on HDFS-8986:
---------------------------------------------

[~jagadesh.kiran] I was not referring to the {{.snapshot}} directory itself. 
Admins can turn snapshots on and off on a directory (or a parent) and a normal 
user's use of the {{-du}} command will vary depending on how many snapshots 
hold older blocks. To an end user the use of snapshots should be transparent, 
in this case it is not.

Let's say home directories are under {{/user}} and you as the hdfs admin enable 
snapshots on {{/user}}. Jane Doe could figure out how much space she uses by 
running a {{-du}} on {{/user/jdoe}}. Now with snapshots enabled, this 
measurement is no longer useful. End users shouldn't care that snapshots are on 
or off, the {{-du}} command should work as it always has. Alternatively, users 
should have a tool that allows them to measure usage within a directory 
excluding snapshots. Does this help?

> Add option to -du to calculate directory space usage excluding snapshots
> ------------------------------------------------------------------------
>
>                 Key: HDFS-8986
>                 URL: https://issues.apache.org/jira/browse/HDFS-8986
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: snapshots
>            Reporter: Gautam Gopalakrishnan
>            Assignee: Jagadesh Kiran N
>
> When running {{hadoop fs -du}} on a snapshotted directory (or one of its 
> children), the report includes space consumed by blocks that are only present 
> in the snapshots. This is confusing for end users.
> {noformat}
> $  hadoop fs -du -h -s /tmp/parent /tmp/parent/*
> 799.7 M  2.3 G  /tmp/parent
> 799.7 M  2.3 G  /tmp/parent/sub1
> $ hdfs dfs -createSnapshot /tmp/parent snap1
> Created snapshot /tmp/parent/.snapshot/snap1
> $ hadoop fs -rm -skipTrash /tmp/parent/sub1/*
> ...
> $ hadoop fs -du -h -s /tmp/parent /tmp/parent/*
> 799.7 M  2.3 G  /tmp/parent
> 799.7 M  2.3 G  /tmp/parent/sub1
> $ hdfs dfs -deleteSnapshot /tmp/parent snap1
> $ hadoop fs -du -h -s /tmp/parent /tmp/parent/*
> 0  0  /tmp/parent
> 0  0  /tmp/parent/sub1
> {noformat}
> It would be helpful if we had a flag, say -X, to exclude any snapshot related 
> disk usage in the output



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to