Skip to content

Disk Image Operations

Naoyuki Tai edited this page Dec 27, 2023 · 4 revisions

Disk Image Operation Overview

Disk Image operations has 3 functions, loading disk image to disk, creating new disk image from a disk, and managing the disk images on a storage (eg - USB stick).

Load disk image

When the app loads the disk image, the app first prepares the disk to be able to boot from it. This is a multi-step process. Here is the overview of steps "Load Disk Image" does.

  1. Detect the disk size and partitions the disk. To support EFI boot, the disk requires FAT-32 EFI partition, as well as a boot and Linux partition. For the disk image to be compact, the swap file that Ubuntu installation creates is highly undesirable (the swap file content is meaningless, yet, it adds significant time to the disk operations.)
  2. Assigns new partition ID to the partitions
  3. Installs EFI boot partition
  4. Load the WCE contents to the Linux partition
  5. Updates and adjusts the EFI and Linux partition to recognize the new partition IDs
  6. Update /etc/fstab for the new partition ID
  7. Installs MBR boot loader

In between the major operations, fsck and retrieving the file system IDs are performed. It is important that if fsck (File System Check) fails, discard the disk. For majority of time, it simply means that the disk is broken.

Create Disk Image

Creating disk image is simpler compared to loading disk.

  1. Figures out which partition as source
  2. Run fsck and shrink the file system to the smallest to fit the contents
  3. Run partclone to create the disk image file and compresses
  4. Bring back/expand the file system to the partition

File system shrike/expand allows the created disk image to fit with any partition larger than the content requires.

When creating disk image, it is important to choose the disk image type.

Syncing disk images

Disk images are stored under the subdirectory of /usr/local/share/wce/wce-disk-images. Each sub-directory represents a disk image type.

See disk image type for the details.

Clone this wiki locally