LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
56 stars 6 forks source link

[linux_distrbituions][chromium_os] How to manually backup Crostini containers #622

Open LukeShortCloud opened 2 years ago

LukeShortCloud commented 2 years ago

Create a backup. This will create a backup file at /mnt/stateful/lxd_conf/backup.tar.gz.

(termina) chronos@localhost ~ $ lxc stop penguin
(termina) chronos@localhost ~ $ lxc publish penguin --alias penguin_backup
(termina) chronos@localhost ~ $ lxc image export backup $LXD_CONF/backup

Then mount the file path inside the container.

(termina) chronos@localhost ~ $ lxc config device add penguin lxd-conf disk source=$LXD_CONF path=/mnt/lxd_conf

Then start the container and copy it over (the "Downloads" folder in Chrome OS must first be shared with Linux):

(termina) chronos@localhost ~ $ lxc start penguin
(termina) chronos@localhost ~ $ lxc exec penguin /bin/bash
[root@penguin ~]$ cp /mnt/lxd_conf/backup.tar.gz /mnt/chromeos/MyFiles/Downloads/

https://osxlatitude.com/forums/topic/10926-how-to-backup-containers/

LukeShortCloud commented 2 years ago

Restore the image as a new container named "penguin2":

(termina) chronos@localhost ~ $ lxc file pull penguin/mnt/chromeos/MyFiles/Downloads/backup.tar.gz /tmp/
(termina) chronos@localhost ~ $ lxc image import /tmp/backup.tar.gz --alias backup
(termina) chronos@localhost ~ $ lxc init backup penguin2