- Обзор и руководство по использованию Timeshift — инструмента для резервного копирования системы в Linux
- Установка Timeshift
- Создание снимка системы
- Восстановление системы из снимка
- Пример использования Timeshift смотрите в видео:
- Как использовать Timeshift для восстановления системы в консольном режиме на Linux
- Резервное копирование linux timeshift
- Features
- Minimal Setup
- Multiple Snapshot Levels
- Rsync & BTRFS Snapshots
- User Data is Excluded by Default
- Better Snapshots & Rotation
- System Restore
- Cross-Distribution Restore
- Supported System Configurations
- Installation
- Ubuntu-based Distributions
- Un-Install
- Known Issues & Limitations
- BTRFS volumes
- Disk Space
- Bootloader & EFI
- Disclaimer
- Contribute
- Donate
Обзор и руководство по использованию Timeshift — инструмента для резервного копирования системы в Linux
Timeshift — это программа для создания и восстановления снимков системы в Linux. Она позволяет быстро вернуть систему в предыдущее состояние, если что-то пойдет не так. В этом руководстве мы расскажем, как пользоваться програмой Timeshift.
Установка Timeshift
Прежде всего, установим Timeshift. Для этого откройте терминал и выполните следующую команду:
Для Arch Linux (Установка из AUR):
Если у вас не установлены необходимые зависимости, то они также будут установлены.
Создание снимка системы
После установки откройте Timeshift из меню приложений. Перед созданием снимка Timeshift проведет сканирование вашей системы и покажет информацию о свободном месте на жестком диске.
1. В окне Timeshift нажмите на кнопку «Create»
2. Выберите тип снимка: «Rsync» или «Btrfs»
3. Выбрать расположение для снимка, например, внешний жесткий диск или другое устройство хранения данных
4. Введите название снимка и добавьте описание (опционально)
5. Нажмите на кнопку «Create»
Процесс создания снимка займет некоторое время в зависимости от объема данных на вашем компьютере. Если у вас файловая система BTRFS , то снимок будет создан мгновенно.
После завершения вы увидите информацию о размере снимка и оставшемся месте на жестком диске.
Восстановление системы из снимка
В случае, если ваша система перестала работать корректно или возникли какие-то проблемы, вы можете восстановить систему из снимка.
2. Выберите снимок, который вы хотите восстановить
3. Нажмите на кнопку «Restore»
4. Выберите тип восстановления (полный или только системные файлы)
5. Подтвердите восстановление
Процесс восстановления может занять некоторое время. После успешного завершения восстановления вы увидите сообщение о том, что восстановление завершено успешно.
Пример использования Timeshift смотрите в видео:
Как использовать Timeshift для восстановления системы в консольном режиме на Linux
Если у вас установлен Timeshift на вашем компьютере или Linux-сервере и вы создали резервную копию системы, вы можете восстановить систему с помощью консоли.
1. Подключите внешний диск или другое устройство хранения, на котором находится резервная копия.
2. Смонтируйте раздел, на который была сохранена резервная копия, при помощи команды mount:
Здесь sdaX — это раздел, на котором находится резервная копия, а /mnt — каталог, куда будет произведено монтирование.
3. Запустите программу восстановления Timeshift с помощью команды:
4. Выберите снимок, который вы хотите восстановить, и следуйте инструкциям на экране.
5. После завершения процесса восстановления перезагрузите систему командой reboot.
Это должно помочь вам восстановить систему из Timeshift снимка через консольный режим.
Резервное копирование linux timeshift
Features
Minimal Setup
- Timeshift requires very little setup. Just install it, run it for the first time and take the first snapshot. Cron job can be enabled for taking automatic snapshots of the system at regular intervals. The backup levels can be selected from the Settings window.
- Snapshots are saved by default on the system (root) partition in path /timeshift. Other linux partitions can also be selected. For best results the snapshots should be saved to an external (non-system) partition.
Multiple Snapshot Levels
- Multiple levels of snapshots can be enabled – Hourly, Daily, Weekly, Monthly and Boot
- Number of snapshots to retain can be specified for each level
- Boot snapshots provide an additional level of backup and are created every time the system starts. Boot snapshots are created with a delay of 10 mins so that system startup is not affected.
Rsync & BTRFS Snapshots
It is strongly recommended to use BTRFS snapshots on systems that are installed on BTRFS partition. BTRFS snapshots are perfect byte-for-byte copies of the system. Nothing is excluded. BTRFS snapshots can be created and restored in seconds, and have very low overhead in terms of disk space.
User Data is Excluded by Default
Timeshift is designed to protect system files and settings. It is NOT a backup tool and is not meant to protect user data. Entire contents of users’ home directories are excluded by default. This has two advantages:
- You don’t need to worry about your documents getting overwritten when you restore a previous snapshot to recover the system.
- Your music and video collection in your home directory will not waste space on the backup device.
You can selectively include items for backup from the Settings window. Selecting the option “Include hidden items” from the Users tab will backup and restore the .hidden files and directories in your home folder. These folders contain user-specific config files and can be included in snapshots if required.
Note: It is not recommended to include user data in backups as it will be overwritten when you restore the snapshot.
Better Snapshots & Rotation
- Unlike similar tools that are scheduled to take backups at a fixed time of the day, Timeshift is designed to run once every hour and take snapshots only when a snapshot is due. This is more suitable for desktop users who keep their laptops and desktops switched on for few hours daily. Scheduling snapshots at a fixed time on such users will result in missed backups since the system may not be running when the snapshot is scheduled to run. By running once every hour and creating snapshots when due, Timeshift ensures that backups are not missed.
- Applications like rsnapshot rotate a snapshot to the next level by creating a hard-linked copy. Creating a hard-linked copy may seem like a good idea but it is still a waste of disk space, since only files can be hard-linked and not directories. The duplicated directory structure can take up as much as 100 MB of space. Timeshift avoids this wastage by using tags for maintaining backup levels. Each snapshot will have only one copy on disk and is tagged as “daily”, “monthly”, etc. The snapshot location will have a set of folders for each backup level (“Monthly”, “Daily”, etc) with symbolic links pointing to the actual snapshots tagged with the level.
System Restore
- Snapshots can be restored by selecting a snapshot from the main window and clicking Restore button on the toolbar.
- Snapshots can be restored either from the running system (online restore) or from another system that has Timeshift installed on it (offline restore).
- If the main system is not bootable, then it is possible to boot from an Ubuntu Live CD, install Timeshift on the live system, and restore a snapshot on the main system.
- Restoring backups from the running system requires a reboot to complete the restore process.
Cross-Distribution Restore
- You can also Timeshift across distributions. Let’s say you are currently using Xubuntu and decide to try out Linux Mint. You install Linux Mint on your system and try it out for a week before deciding to go back to Xubuntu. Using Timeshift you can simply restore the last week’s snapshot to get your Xubuntu system back. Timeshift will take care of things like reinstalling the bootloader and other details.
- Since installing a new linux distribution also formats your root partition you need to save your snapshots on a separate linux partition for this to work.
- It is recommended to include hidden items in home directory by selecting the option “Include Hidden Items” from Settings>Users.
Supported System Configurations
- Normal – OS installed on non-encrypted partitions
- LUKS Encrypted – OS installed on LUKS-encrypted partitions
- LVM2 – OS installed on LVM2 volumes (with or without LUKS)
- BTRFS – OS installed on BTRFS volumes (with or without LUKS)
- Only Ubuntu-type layouts with @ and @home subvolumes are supported
- @ and @home subvolumes may be on same or different BTRFS volumes
- @ may be on BTRFS volume and /home may be mounted on non-BTRFS partition
- Other layouts are not supported
Installation
Ubuntu-based Distributions
Ubuntu, Linux Mint, Elementary OS, etc.
Packages are available in the Launchpad PPA for supported Ubuntu releases. Run the following commands in a terminal window:
sudo add-apt-repository -y ppa:teejee2008/ppa sudo apt-get update sudo apt-get install timeshift
DEB and RUN packages are available on Releases page for older Ubuntu releases which have reached end-of-life.
Un-Install
Run the following command in a terminal window:
sudo apt-get remove timeshift
Remember to delete all snapshots before uninstalling. Otherwise, the snapshots continue to occupy space on your system. To delete all snapshots, run the application, select all snapshots from the list (CTRL+A) and click the Delete button on the toolbar. This will delete all snapshots and remove the /timeshift folder in the root directory.
Known Issues & Limitations
BTRFS volumes
BTRFS volumes must have an Ubuntu-type layout with @ and @home subvolumes. Other layouts are not supported. Systems having the @ subvolume and having /home on a non-BTRFS partition are also supported.
Disk Space
Timeshift requires a lot of disk space to keep snapshot data. The device selected as snapshot device must have sufficient free space to store the snapshots that will be created.
If the backup device is running out of space, try the following steps:
- Reduce the number of backup levels – Uncheck the backup levels and keep only one selected
- Reduce the number of snapshots that are kept – In the Schedule tab set the number of snapshots to 5 or less.
- You can also disable scheduled snapshots completely and create snapshots manually when required
Bootloader & EFI
- Only those systems are supported which use GRUB2 bootloader. Trying to create and restore snapshots on a system using older versions of GRUB will result in a non-bootable system.
- EFI systems are fully supported. Ensure that the /boot/efi partition is mapped while restoring a snapshot. It will be mapped automatically if detected.
- If you are restoring from Live CD/USB, and your installed system uses EFI mode, then you must boot from Live CD/USB in EFI mode.
Disclaimer
This program is free for personal and commercial use and comes with absolutely no warranty. You use this program entirely at your own risk. The author will not be liable for any damages arising from the use of this program.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Contribute
You can contribute to this project in various ways:
- Submitting ideas, and reporting issues in the tracker
- Translating this application to other languages
- Contributing code changes by fixing issues and submitting a pull request
- Making a donation via PayPal
Donate
Timeshift is a non-commercial application. I work on it in my free time based on my requirements and interest. If you wish to support this project, you can make a donation for $10 or more via PayPal. Your contributions will help keep the project alive and support future development.
PayPal ~ If you find this application useful and wish to say thanks, you can buy me a coffee by making a donation with Paypal.