How does deleting old backups from time machine work
up vote
2
down vote
favorite
Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.
But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?
time-machine incremental-backup
add a comment |
up vote
2
down vote
favorite
Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.
But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?
time-machine incremental-backup
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.
But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?
time-machine incremental-backup
Time machine uses incremental backups, so to restore a backup it needs all backups made. Time machine also has the feature to delete the oldest backup when there is no free space anymore.
But isn't this destroying the backup? There is a backup missing in the history. How does time machine handle this? What am I missing?
time-machine incremental-backup
time-machine incremental-backup
asked Nov 16 at 7:15
Lithilion
1237
1237
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
Short answer: it works fine thanks to weird filesystem magic.
Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:
- In the initial backup, it copies all files from the source
- In the first incremental, it copies only files that changed since the initial backup
- In the second incremental, it copies only files that changed since the first incremental
In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.
If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.
Time machine works a bit differently. Here's how the same sequence would work with Time Machine:
- In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).
In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).
Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.
In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.
In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.
If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.
In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.
(But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Short answer: it works fine thanks to weird filesystem magic.
Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:
- In the initial backup, it copies all files from the source
- In the first incremental, it copies only files that changed since the initial backup
- In the second incremental, it copies only files that changed since the first incremental
In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.
If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.
Time machine works a bit differently. Here's how the same sequence would work with Time Machine:
- In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).
In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).
Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.
In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.
In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.
If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.
In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.
(But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)
add a comment |
up vote
3
down vote
accepted
Short answer: it works fine thanks to weird filesystem magic.
Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:
- In the initial backup, it copies all files from the source
- In the first incremental, it copies only files that changed since the initial backup
- In the second incremental, it copies only files that changed since the first incremental
In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.
If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.
Time machine works a bit differently. Here's how the same sequence would work with Time Machine:
- In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).
In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).
Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.
In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.
In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.
If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.
In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.
(But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Short answer: it works fine thanks to weird filesystem magic.
Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:
- In the initial backup, it copies all files from the source
- In the first incremental, it copies only files that changed since the initial backup
- In the second incremental, it copies only files that changed since the first incremental
In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.
If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.
Time machine works a bit differently. Here's how the same sequence would work with Time Machine:
- In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).
In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).
Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.
In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.
In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.
If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.
In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.
(But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)
Short answer: it works fine thanks to weird filesystem magic.
Long answer: well, first, let's go over how a normal incremental backup system works (I think you already know this, but just to set the scene...) Suppose you do an initial backup and two incrementals based on it:
- In the initial backup, it copies all files from the source
- In the first incremental, it copies only files that changed since the initial backup
- In the second incremental, it copies only files that changed since the first incremental
In order to recover a bunch of files from the "latest backup", you'll need to splice together files from all three, depending on when each file was last modified.
If you delete the first backup, then all of the files that didn't change since that backup (& hence get backed up in one of the incrementals) are gone. This is the situation you assume in the question.
Time machine works a bit differently. Here's how the same sequence would work with Time Machine:
- In the initial backup, it copies all files from the source (into a timestamped snapshot directory on the backup target).
In the first incremental, it copies only files that changed since the initial backup (into a new snapshot directory) and adds hard links to files and directories that didn't change (except those that were deleted between the backups).
Hard links are additional directory entries that point to the same file that the original entry did. Standard unix filesystems allow files to be hard-linked, but not directories; Apple figured out how to allow it for directories as well under the MacOS Extended filesystem. Anyway, the net result is that the second snapshot directory actually contains all files that existed when the second backup was made.
In the second incremental, it again copies only files that changed since the first incremental, adds hard links to files and directories that didn't change (except those that were deleted). Again, this snapshot directory actually contains all files that existed when the third backup was made.
In order to recover a bunch of files from the "latest backup", no splicing is needed, since all of the files are already there in the latest snapshot directory. In fact, you can just open up the snapshot folder in the Finder, and see all the files that're part of that snapshot. But please don't make changes, or you may mess up not just that snapshot, but all the other ones it's interlinked with.
If you delete the first backup, then all of the files and directories in it get unlinked from that snapshot directory. But not necessarily deleted, that only happens when the last link is removed. Thus, all of the files (/versions of files) that were only in that snapshot get deleted, but those that were still around when the later backups were made still remain in existence, and are still in the other snapshot(s) they're valid for.
In fact, you (or the Time Machine backup system) can delete snapshots in any order without creating gaps in the later backups. TM uses this as part of its standard backup schedule: It creates a new snapshot once an hour, but after 24 hours it starts deleting most of those, leaving just one per day. After a month, it starts deleting most of the dailies, leaving just one per week. Because of the hard-linking, this doesn't cause any missing files in the snapshots that're retained.
(But again: don't make changes in the backup directories, or you may break things. TM has options to delete particular snapshots, or delete specific files from all snapshots they occur in, and these are safe. Other changes... not so safe.)
answered Nov 17 at 7:29
Gordon Davisson
25.3k44350
25.3k44350
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375902%2fhow-does-deleting-old-backups-from-time-machine-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown