1

So let’s say a have a file called bob with the size of 10GB in /home. I make a snapshot of /home and delete the original bob file. However I can still access the bob file because I have a snapshot it. My question is how come the hard disk drive is not going to be full if I keep doing these a number of times? Becuase the size of the snapshot is very small.

1

If you are talking about LVM snapshots then this explains it pretty well:

A wonderful facility provided by LVM is 'snapshots'. This allows the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time.

If you understand how file systems work, you understand that when you delete a file—such as bob—from your system, the file itself is not removed. But rather the inode entry for that file is removed. The data still exists on the volume. The snapshot takes a frozen image of the LVM table at that point in time and—this is key—it notes the inode entry used.

Meaning when you access data via a snapshot, it is really just remapping the LVM metadata to the in odes connected to that source data. And since post-snapshot you will not be given access to the inodes used by the system in the previous snapshots, that data is still retained on a deep file system level.

So an LVM snapshot is essentially a “delta” of your filesystem in one past state compared to what it is in it’s current state and done in a way that assures any “roll backs” to past data are retained.

| improve this answer | |
0

If you keep snapshots of a file or files, they do not get duplicated. There is only a single copy of the data that all snapshots refer to until you try to change a version, then you get new data. Hence "copy on write".

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.