David Dyer-Bennet
2010-Aug-09 17:21 UTC
[zfs-discuss] Directory tree renaming -- disk usage
If I have a directory with a bazillion files in it (or, let''s say, a directory subtree full of raw camera images, about 15MB each, totalling say 50GB) on a ZFS filesystem, and take daily snapshots of it (without altering it), the snapshots use almost no extra space, I know. If I now rename that directory, and take another snapshot, what happens? Do I get two copies of the unchanged data now, or does everything still reference the same original data (file content)? Seems like the new directory tree contains the "same old files", same inodes and so forth, so it shouldn''t be duplicating the data as I understand it; is that correct? This would, obviously, be fairly easy to test; and, if I removed the snapshots afterward, wouldn''t take space permanently (have to make sure that the scheduler doesn''t do one of my permanent snapshots during the test). But I''m interested in the theoretical answer in any case. -- David Dyer-Bennet, dd-b at dd-b.net; http://dd-b.net/ Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/ Photos: http://dd-b.net/photography/gallery/ Dragaera: http://dragaera.info
Casper.Dik at Sun.COM
2010-Aug-09 17:26 UTC
[zfs-discuss] Directory tree renaming -- disk usage
>If I have a directory with a bazillion files in it (or, let''s say, a >directory subtree full of raw camera images, about 15MB each, totalling >say 50GB) on a ZFS filesystem, and take daily snapshots of it (without >altering it), the snapshots use almost no extra space, I know. > >If I now rename that directory, and take another snapshot, what happens? >Do I get two copies of the unchanged data now, or does everything still >reference the same original data (file content)? Seems like the new >directory tree contains the "same old files", same inodes and so forth, so >it shouldn''t be duplicating the data as I understand it; is that correct? > >This would, obviously, be fairly easy to test; and, if I removed the >snapshots afterward, wouldn''t take space permanently (have to make sure >that the scheduler doesn''t do one of my permanent snapshots during the >test). But I''m interested in the theoretical answer in any case.snapshots never take additional space until it starts to reference deleted data. If the directory is renamed then the parent directory is changed and the directory''s inode but the rest of the data is not modified and has no effect on the amount of data stored. Casper
On 09 August, 2010 - David Dyer-Bennet sent me these 1,2K bytes:> If I have a directory with a bazillion files in it (or, let''s say, a > directory subtree full of raw camera images, about 15MB each, totalling > say 50GB) on a ZFS filesystem, and take daily snapshots of it (without > altering it), the snapshots use almost no extra space, I know. > > If I now rename that directory, and take another snapshot, what happens? > Do I get two copies of the unchanged data now, or does everything still > reference the same original data (file content)? Seems like the new > directory tree contains the "same old files", same inodes and so forth, so > it shouldn''t be duplicating the data as I understand it; is that correct?The files hasn''t changed, unless you rename the directory by creating a new, copy stuff over and remove the old. The only change is the name of the directory.> This would, obviously, be fairly easy to test; and, if I removed the > snapshots afterward, wouldn''t take space permanently (have to make sure > that the scheduler doesn''t do one of my permanent snapshots during the > test). But I''m interested in the theoretical answer in any case./Tomas -- Tomas ?gren, stric at acc.umu.se, http://www.acc.umu.se/~stric/ |- Student at Computing Science, University of Ume? `- Sysadmin at {cs,acc}.umu.se