Skip to content

Flash a linux raspberry pi disk image to a GPT-partitioned device

License

Notifications You must be signed in to change notification settings

colisee/rpi2GPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 

Repository files navigation

rpi-img2GPT

Flash a raspios disk image to a GPT-partitioned device

Usage:

sudo rpi-img2GPT [options] --image=image-file --device=device-name

Options:
  --boot-size=size-of-boot-partition
  --root-size=size-of-root-partition
  --home-size=size-of-home-partition
  --root-size=size-of-var-partition
  --enable-ssh
  --quiet

Notes:

  • You can use the suffix (K, M, G, T) as in 64G when specifying sizes
  • A size of MAX means the remaining disk space
  • By default, the boot and root partitions are set respectively to 64M and MAX

Example:

sudo rpi-img2GPT \
	--image 2021-05-07-raspios-buster-armhf-lite.img \
	--device /dev/sdc \
	--boot-size 128M \
	--root-size 64G \
	--home-size 16G \
	--var-size MAX \
	--enable-ssh

What the command does

This command will:

  • Erase the specified device (usually a hard disk) and create a GPT table
  • Create 2 partitions: boot and root
  • Create up to 2 additional partitions (home and var) if their size is specified
  • Copy the content of the disk image to the device
  • Change the file /boot/cmdline.txt to:
    • Define the new root mount (switching to PARTLABEL from PARTUUID)
    • Remove the init and fsck arguments
  • Change the file /etc/fstab to update the mount points
  • Add an empty file /boot/ssh if the argument --enable-ssh was specified

About

Flash a linux raspberry pi disk image to a GPT-partitioned device

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages