User:Arwen/repartition

From PINE64
< User:Arwen
Revision as of 21:50, 26 January 2020 by Arwen (talk | contribs) (→‎Repartitioning your Pinebook Pro: Added that eMMC is the target and SD card temporary mount location, for the example.)
Jump to navigation Jump to search

Repartitioning your Pinebook Pro

There are multiple reasons to desire a different file system layout. This could be to allow 2 separate OS partitions for testing an update or new OS altogether.

The example is repartitioning the eMMC and using a SD card as the temporary location for your bootable OS. If the plan is something else, modify accordingly. Note that the RK3399 SoC does not include any NVMe SSD in it's initial 'Low level boot stage. So the need to reserve space at the beginning of the disk is not required for NVMes.

Make a backup

Backup your existing OS and data. Multiple times if it's important data.

Understand the risks

If you perform the steps wrong, you could end up with an un-bootable laptop. Even using a SD card may not help. If the eMMC thinks it's good enough to boot, it may not try the SD card.

Read about recovery options

Worse case, you may have to open up your Pinebook Pro and perform a boot with

Using a MicroSD card

This example shows using a SD card as temporary boot location.

Planning a partition table

Planning a partition table is sometimes preferred than simply making it work. If you make a mistake, you may have to live with it for a while til you can re-partition your disk.

  • Low level boot: The boot loader U-Boot and ARM64 support information must be installed as specified. These are partitions 2, 3 and 4 in the example below. You can then access the U-Boot or ARM Trusted Firmare code easier than having to remember beginning of disk off-sets. If you would prefer, you can leave these off. But, make absolutely sure you start at block 32768 or later for any other partitions.
  • Boot partition: The example below shows a 256MB /boot partition, which maybe desirable for Initial RAM disks. The default OS, Debian, that came with the Pinebook Pro uses only a 64MB partition. After various updates on the default Debian OS, a Pinebook Pro uses 50MB, which is 77% full. No real room for Initial RAM disks. Note that the current boot loader requires that the /boot be partition 1. This puts it out of order if you use dedicated Low level boot partitions, but is otherwise harmless.
  • Swap: Some prefer a swap partition to a swap file. This documentation shows an equal sized swap partition as the memory, (4GB). You can use smaller, though larger does not really get you anything. Further, if you prefer to use a swap file, that can be left off of your partition table.
  • Root: When using the default Debian OS, with some updates and minor packages added, the / partition used size is about 4.5GBs. In general, plan for growth to perhaps double or more. If you do not intend to experiment with other OSes on your disk, or seperate out application & potentially /home, your <code/ could be the remaining space on your disk.

Partitioning the eMMC

As user "root", perform the following step, (or modified for your use). This will:

  • Wipe the existing partition table
  • Create new, empty GPT partition table
  • Create the 3 boot support partitions
  • Create a larger /boot partition of 256MBs
  • Create a dedicated swap paritition of 4GBs
  • Create 2 identically sized OS partitions of 27GBs each

Here is a commands to make that partition table;

# sfdisk /dev/mmcblk1 --wipe always --label GPT <<EOF
unit: sectors
first-lba: 64
/dev/mmcblk1p2 : start=       64, size=    16320, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=1B5A4130-0958-455D-B9AB-C1F2E232FFF8, name="IDBLoader",         attrs="RequiredPartition"
/dev/mmcblk1p3 : start=    16384, size=     8192, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=D0972B65-4091-4E34-9A4C-8BD949C35E16, name="U-Boot",            attrs="RequiredPartition"
/dev/mmcblk1p4 : start=    24576, size=     8192, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=6C5329F3-9A03-4664-A15C-44E869EDE05C, name="TrustedFirmware-A", attrs="RequiredPartition"
/dev/mmcblk1p1 : start=    32768, size=   524288, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=3956C6AC-1AC8-4E45-A2A5-FD3CCA60D0CD, name="Linux-boot"
/dev/mmcblk1p5 : start=   557056, size=  8388608, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=C1565C17-D5C2-410C-892E-7371CB22947D, name="Linux-swap"
/dev/mmcblk1p6 : start=  8945664, size= 56598481, type=B921B045-1DF0-41C3-AF44-4C6F280D3FAE, uuid=E55D2252-DAC4-4EEB-AD41-D47F52B9889F, name="Linux-root"
/dev/mmcblk1p7 : start= 65544192, size= 56598481, type=B921B045-1DF0-41C3-AF44-4C6F280D3FAE, uuid=FB2E55D1-EA3B-418F-BB54-B9E92DF813F7, name="Linux-root-alternate"
EOF

Creating the file systems

Make FSes

Copying back the OS

Copy back your OS to the new disk 3 x DDs 3 x Rsync

Update the new OS

  • Update new /boot/extlinux/extlinux.conf, umount /boot
  • Update new /etc/fstab, umount /

Shutdown & boot to new disk

When all is ready, you shutdown and power off. This then lets you remove the SD card. After than, you can power on and test out your new partition table.