Skip to content

Linux File Filesystem Backups

ChromeOS has a special tool that is designed to perform a backup of your Linux File system and restore the backup when needed. Linux File system backups are essentially snapshots of the state of your Linux installation, complete with all applications and settings. You can even restore the backup on a different device, as long as it also uses the same architecture as your ChromeOS Device.

Accessing the Backup Tool

It is important to shut down your Linux environment before performing a backup or restoration of your Linux file system. The backup process may take anywhere between a few minutes to a few hours to complete, depending on the amount of content that is stored in your Linux file system and the speed of the SSD. Your device will also tend to get warm while the backup is in progress.

  1. Launch the ChromeOS Settings Application
  2. Select "Advanced"
  3. Select "Developers"
  4. Select "Linux Development Environment"
  5. Select "Backup & Restore"

From here, you will have the ability to back up and restore your Linux File system.

Important Note : If you plan to store the backup on a network file share or cloud storage service, you must perform the backup onto the local storage of your device or a attached USB storage device before you move the backup to the network share or cloud storage service. If you attempt to back up directly to a network share or cloud storage mount, your backup will fail.

LXC Snapshots (Advanced)

The Linux Environment is built on top of LXC containers, which allows users to create LXC snapshots. This is useful for testing and quickly restoring the state of a container. LXC snapshots are not a replacement for proper backups as the snapshots are not as portable as proper backups and consume a lot of space on your ChromeOS Device as you cannot save Snapshots to external storage. The advantages of LXC snapshots are that they are far faster than the ChromeOS Linux Backup Tool and you do not need to stop your Linux environment while the snapshot is in progress.

LXC Snapshots will need to be done via the command line, as there is currently no user interface to create or manage snapshots. All commands are done on the ChromeOS Shell and not within a Linux Terminal, you can access the ChromeOS Shell by pressing ALT+CTRL+T while on the desktop.

Creating Snapshots

First, use the vmc command to enter the virtual machine that runs your containers. By default, this is "termina".

vmc start termina

Next we will create a snapshot of the container with the lxc snapshot command, you will need to specify the container name that you wish to snapshot, which by default is "penguin".

lxc snapshot penguin

You can now use the "lxc info" command and you should see the snapshots.

(termina) chronos@localhost ~ $ lxc info penguin 
Name: penguin
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/12/25 00:29 UTC
Status: Running
Type: persistent
Profiles: default
Pid: 320
Ips:
  eth0: inet    100.115.92.198  vethe657a4d7
  eth0: inet6   fe80::216:3eff:fec6:2e4a        vethe657a4d7
  lo:   inet    127.0.0.1
  lo:   inet6   ::1
Resources:
  Processes: 365
  CPU usage:
    CPU usage (in seconds): 58527
  Memory usage:
    Memory (current): 19.51MB
    Memory (peak): 59.74MB
  Network usage:
    eth0:
      Bytes received: 260.68MB
      Bytes sent: 107.03MB
      Packets received: 136368
      Packets sent: 115774
    lo:
      Bytes received: 72.42MB
      Bytes sent: 72.42MB
      Packets received: 276923
      Packets sent: 276923
Snapshots:
  snap0 (taken at 2022/01/05 23:05 UTC) (stateless)

There are no limits to the number of snapshots that you can create as long as you have sufficient disk space available on your {FORMFACTOR}.

Restoring LXC Snapshots

Restoring a LXC snapshot will replace the contents and configuration the container with the contents of the snapshot. This also includes all user data.. Just like creating a snapshot, you will use the vmc command to enter the virtual machine that runs your containers. By default, this is "termina".

vmc start termina

We will use the lxc info termina command to get the snapshot names and locate the snapshot you wish to restore, which will be found under "Snapshots". In this example, the name is "snap0"

(termina) chronos@localhost ~ $ lxc info penguin 
Name: penguin
...
...
Snapshots:
  snap0 (taken at 2022/01/05 23:05 UTC) (stateless)

We will now need to stop the container via the lcx stop command. By default, the container name is penguin.

lxc stop penguin

Finally, you can now restore the container with the lxc restore command. In the example below, we are going to replace the contents of the termina container with the state of the snap0 container when the snapshot was created.

lxc restore penguin snap0

This will take a few minutes to complete. Once the restore is complete, you can start the container by launching a Linux terminal or other GUI application.

Deleting Snapshots

You may delete snapshots when you wish to reclaim space on your device. This will also need to be done within the ChromeOS Shell. Just like creating a snapshot, you will use the vmc command to enter the virtual machine that runs your containers. By default, this is "termina".

vmc start termina

We will use the lxc info termina command to get the snapshot names, which will be found under "Snapshots". In this example, the name is "snap0"

(termina) chronos@localhost ~ $ lxc info penguin 
Name: penguin
...
...
Snapshots:
  snap0 (taken at 2022/01/05 23:05 UTC) (stateless)

Once we know the snapshot command, you can delete the snapshot by running the lxc delete command followed by the container name and snapshot. As a example, this command will delete snap0 snapshot on the termina container.

lxc delete penguin/snap0

Deleting snapshots can be done while the container is running and may take several minutes to complete.