Skip to content
0850 554 5439 [email protected]

How can we help?

Search our guides and tutorials, or browse the categories below.

Versioning: go back to an older version and restore a deleted file

Object Storage (S3) 519 views Step-by-step guide Last verified: Markdown
What you will learnHow to see a file's versions in Protected Storage, go back to an older version, restore a deleted file and set how long old versions are kept, from the panel and with aws-cli.
Time10 minutes

1. Key concepts

Concept Meaning
Version A file as it was at a given moment. Every upload creates a new version with its own version ID.
Current version The version you see in the list and get when you download.
Old version Earlier states kept in the background because they were overwritten.
Delete marker The marker placed when you delete a file. The file no longer shows in the list but its versions remain.

Versioning is on in every bucket in Protected Storage and cannot be turned off. It costs nothing extra; old versions and files with delete markers count against your plan's space.

2. Before you start

If you use aws-cli, set up your profile for the Protected Storage endpoint:

code
aws configure --profile gyro-kilit
# Access Key ID and Secret Access Key: the key you created in the panel
# Default region name: tr-ist-1

In the commands below, the bucket name firma-yedek and the file reports/month-end.xlsx are examples. Add these two options to every command:

code
--profile gyro-kilit --endpoint-url https://s3-kilit.gyrohosting.com

3. Go back to an older version or restore a deleted file from the panel

  1. In the customer panel, open your Protected Storage service and switch to the Versions tab.
  2. Choose the bucket, optionally type a prefix (for example reports/) and press List. You can browse by clicking folders and continue with More if there are over 50 results. Each version shows a badge: Current, Old version, Delete marker, and where it applies the lock mode and end date, Legal hold.
  3. To go back to an older version, press Restore on that version's row. A copy of the version you chose becomes the new current version; the versions in between are not deleted and stay in the list. Restoring from the panel works for versions up to 5 GB; for larger files use the command in Section 4.3.
  4. To bring back a deleted file, press Remove delete marker on the file's latest Delete marker row. The file returns to the list as it was before deletion.
  5. To delete a version you no longer need and free space, press Delete permanently and tick the confirmation box. Locked versions cannot be deleted before the lock ends; the panel shows why and the end date. In a locked bucket, use the Lock button to see or change a version's lock.
Note

Delete permanently cannot be undone. Restoring, however, creates a new version, so you can undo it too: if you restored the wrong version, restore the previous one again.

From the File manager

In the File manager, Delete does not remove a file permanently; it adds a delete marker. The file disappears from the list and from the static website, but its earlier versions remain. A file you upload again under the same name also becomes a new version. The Versions button (clock icon) on a file's row opens that file's versions; you can make an older version current from there with Restore.

On a mounted bucket

If you mounted the bucket on your server with Mount storage in read/write mode, every save or overwrite of a file on the server creates a new version and every file you delete creates a delete marker; you can restore these versions as described in this guide. To keep space from growing needlessly, set the old-version retention days under Lifecycle and don't keep frequently changing files (logs, databases, caches) in this bucket. Protected buckets are mounted read-only by default: Mount a bucket on a server as a folder.

4. The same operations with aws-cli

4.1 List versions

  1. List all versions and delete markers of a file (or a folder):
code
aws s3api list-object-versions --bucket firma-yedek --prefix reports/month-end.xlsx \
  --profile gyro-kilit --endpoint-url https://s3-kilit.gyrohosting.com
  1. In the output you see each version's VersionId, LastModified and IsLatest under Versions, and delete markers under DeleteMarkers. Note the VersionId of the version you want to restore.

4.2 Download an older version

  1. Download the version to a local file:
code
aws s3api get-object --bucket firma-yedek --key reports/month-end.xlsx \
  --version-id <VERSION_ID> month-end-old.xlsx \
  --profile gyro-kilit --endpoint-url https://s3-kilit.gyrohosting.com

4.3 Make an older version current again

  1. Copy the old version over the same name; the copy becomes the new current version:
code
aws s3api copy-object --bucket firma-yedek --key reports/month-end.xlsx \
  --copy-source "firma-yedek/reports/month-end.xlsx?versionId=<VERSION_ID>" \
  --profile gyro-kilit --endpoint-url https://s3-kilit.gyrohosting.com

4.4 Restore a deleted file

  1. In the list-object-versions output, find the VersionId of the delete marker under DeleteMarkers with IsLatest: true.
  2. Delete only that delete marker; the file comes back:
code
aws s3api delete-object --bucket firma-yedek --key reports/month-end.xlsx \
  --version-id <DELETE_MARKER_ID> \
  --profile gyro-kilit --endpoint-url https://s3-kilit.gyrohosting.com
Careful

If you give delete-object the ID of a file version, that version is deleted permanently and cannot be recovered (unless it is locked). delete-object or aws s3 rm without a version ID only adds a delete marker.

4.5 With rclone

With --s3-versions, rclone lists old versions with a timestamp added to the file name; with --s3-version-at it reads the bucket as it was at a given moment:

code
rclone ls gyro-kilit:firma-yedek/reports --s3-versions
rclone copy gyro-kilit:firma-yedek/reports ./restore --s3-version-at "2026-11-10 03:00:00"
Time zone

rclone reads this time in the local time of the machine running it. If your server uses UTC, or you aren't sure, write the time explicitly in UTC: --s3-version-at "2026-11-10T00:00:00Z" (03:00 Turkey time). If a time in the wrong zone falls before the files were uploaded, the list looks empty.

For rclone setup: Protected Storage with restic and rclone.

5. How long are old versions kept?

  • By default a version is deleted automatically 30 days after it becomes an old version.
  • You can change this per bucket under your service's Lifecycle section, in the Delete old versions: N days field (1-3650 days; 0 = off, old versions are never deleted).
  • The rule runs once every night, at 03:30 Turkey time. Versions that should be deleted on the day you change the period are deleted that night, not immediately during the day.
  • The day count starts from the moment a file gets a new version or is deleted.
  • The same rule also cleans up delete markers left alone once all versions of a file are gone, so the version list doesn't fill with empty markers. (For rules saved before 19.11.2026, press Save once on the Lifecycle page without changing the day count to get this cleanup; the panel shows a notice in that case.)
  • A locked version is not deleted by this rule before its lock ends; the rule is applied the first night after the lock ends.
  • Versions deleted automatically cannot be recovered. Keep the retention period at least as long as the time within which you want to be able to restore files.
Tip

Large files that are overwritten under the same name every day, such as nightly backups, pile up old versions. To protect your plan space, upload such files with a dated name or shorten the old-version period.

6. Troubleshooting

Symptom Likely cause What to do
The deleted file is not in the version list either The old-version retention period has ended or the version was deleted permanently It cannot be recovered. Increase the retention period; use Object Lock for important data.
I get AccessDenied The key has no write permission on this bucket, or the version is locked Check the permission under Access keys; locked versions cannot be deleted before the period ends.
My plan space fills faster than expected Old versions and files with delete markers take space Check Usage; shorten the old-version retention period. For early warning, set a per-bucket threshold (% or GB) under Usage alerts.
I shortened the period but old versions are still there The rule runs once a night (03:30), or the version is locked Check again the next morning; locked versions are deleted after the lock ends.
aws s3 ls doesn't show the deleted file There is a delete marker Normal; check with list-object-versions and follow Section 4.4.

7. FAQ

Can I turn versioning off?

No. In Protected Storage versioning is on in every bucket. You manage space use with the Delete old versions: N days setting and, when needed, Delete permanently.

Are old versions charged?

There is no separate charge; the space taken by old versions counts against your plan space.

Does a restore delete the other versions?

No. A restore makes a copy of the version you chose the new current version; all versions stay in the list.

Can I roll a whole folder back to an earlier moment?

With rclone's --s3-version-at option you can download the folder as it was at a given moment to another place, or upload it again (Section 4.5).

Do delete markers take space?

A delete marker itself is tiny; the old versions beneath it take the real space.

Next step

Was this helpful?

Thanks for your feedback!

Still Need Help?

Our support team is here around the clock for anything you can't find above.