User:Txnintn: Difference between revisions

From Alpine Linux
No edit summary
No edit summary
Line 55: Line 55:
|} <br>
|} <br>


Requirements:
Requirements:<br>
 
<br>
Raspberry PI 4
Raspberry PI 4<br>
 
<br>
Two Identical USB Drives - fit style drives recommended based on physical clearance issues.
Two Identical USB Drives - fit style drives recommended based on physical clearance issues.<br>
 
<br>
One Micro SD Drive with the same or larger capacity then the USB drives
One Micro SD Drive with the same or larger capacity then the USB drives<br>
   
  <br>
One USB drive for the installation files.
One USB drive for the installation files.<br>
 
<br>
Preparation:
Preparation:<br>
 
<br>
Created the following on the USB RAID disks:
Created the following for the USB RAID disks:<br>
sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.  
sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.<br>
sdx2 using the rest of the disk with a fd linux raid partition, formatted ext4
sdx2 using the rest of the disk with a fd linux raid partition, formatted ext4<br>
 
<br>
mmcblkx, sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.  
mmcblkx, sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.<br>
sdx2 sized to match USB RAID partition, Linux 83 and formatted Ext4.  Do not use Linux Raid.
sdx2 sized to match USB RAID partition, Linux 83 and formatted Ext4.  Do not use Linux Raid.<br>
 
<br>
The USB installation drive single partition fat 32 0c with boot and LBA flags.
The USB installation drive single partition fat 32 0c with boot and LBA flags.<br>
Extract the contents of alpine-rpi-3.x.x-aarch.tar.gz to sdc1 (spare USB) partition.
Extract the contents of alpine-rpi-3.x.x-aarch.tar.gz to sdc1 (spare USB) partition.<br>
 
<br>
The Raspberry Pi eprom must be set to boot USB port first and SD port second.
The Raspberry Pi eprom must be set to boot USB port first and SD port second.<br>
 
<br>
Installation:
Installation:<br>
 
<br>
Insert the "sda" USB disk into the bottom USB 3.0 port and the "sdb" USB drive into the upper USB 3.0 port.  Power up the system, after the system has failed to boot to the installed USB drives, the screen will change from white and red to black and white text, insert the installation USB (sdc) to start the install process. This will set the drive assignments properly.
Insert the "sda" USB disk into the bottom USB 3.0 port and the "sdb" USB drive into the upper USB 3.0 port.  Power up the system, after the system has failed to boot to the installed USB drives, the screen will change from white and red to black and white text, insert the installation USB (sdc) to start the install process. This will set the drive assignments properly.<br>
 
<br>
 
<br>
After logging in as root.
After logging in as root.<br>
To start the install,  
To start the install, <br>
TYPE:  setup-alpine and PRESS:  enter.
TYPE:  setup-alpine and PRESS:  enter.<br>
 
<br>
 
<br>
At, Select keyboard layout: [none], prompt.
At, Select keyboard layout: [none], prompt.<br>
TYPE:  us and PRESS:  enter.
TYPE:  us and PRESS:  enter.<br>
At, Select variant (or 'abort'):, prompt.  
At, Select variant (or 'abort'):, prompt. <br>
TYPE:  us and PRESS:  enter.
TYPE:  us and PRESS:  enter.<br>
 
<br>
 
<br>
At, Enter system hostname (fully qualified form, e.g. 'foo.example.org') [localhost] prompt.
At, Enter system hostname (fully qualified form, e.g. 'foo.example.org') [localhost] prompt.<br>
TYPE:  the localhost name, for example, rpi44gb and PRESS: enter.
TYPE:  the localhost name, for example, rpi44gb and PRESS: enter.<br>
 
<br>
 
<br>
At, Enter '?' for help on bridges, bonding and vlans.
At, Enter '?' for help on bridges, bonding and vlans.<br>
Which one do you want to initialize? (or '?' or 'done' [eth0], prompt.  
Which one do you want to initialize? (or '?' or 'done' [eth0], prompt. <br>
PRESS: enter, to use the default, ethernet0 connection.
PRESS: enter, to use the default, ethernet0 connection.<br>
 
<br>
Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp], prompt.  
Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp], prompt. <br>
PRESS:  enter to use the default, dhcp.
PRESS:  enter to use the default, dhcp.<br>
 
<br>
At the second,  Enter '?' for help on bridges, bonding and vlans.
At the second,  Enter '?' for help on bridges, bonding and vlans.<br>
Which one do you want to initialize? (or '?' or 'done' [wlan0], prompt.
Which one do you want to initialize? (or '?' or 'done' [wlan0], prompt.<br>
TYPE: done and PRESS: enter.
TYPE: done and PRESS: enter.<br>
 
<br>
Then at, Do you want to do and manual network configuration? (y/n) [n], prompt.
Then at, Do you want to do and manual network configuration? (y/n) [n], prompt.<br>
PRESS enter for the default, [n], for no.
PRESS enter for the default, [n], for no.<br>
 
<br>
 
<br>
At, Change password for root, prompt.
At, Change password for root, prompt.<br>
TYPE: the root password, and PRESS:  enter.
TYPE: the root password, and PRESS:  enter.<br>
At, Retype password, prompt.
At, Retype password, prompt.<br>
TYPE: the root password and PRESS:  enter.
TYPE: the root password and PRESS:  enter.<br>
 
<br>
 
<br>
At, Which timezone are you in? ('?' for a list) [UTC]. prompt.
At, Which timezone are you in? ('?' for a list) [UTC]. prompt.<br>
TYPE:  America, with a capital A, and press enter.
TYPE:  America, with a capital A, and press enter.<br>
 
<br>
At, What sub-timezone of 'America' are you in? ('?' for list), prompt.
At, What sub-timezone of 'America' are you in? ('?' for list), prompt.<br>
TYPE:  Chicago, with a capital C, and press enter.
TYPE:  Chicago, with a capital C, and press enter.<br>
 
<br>
At, HTTP/FTP proxy URL? (e.g. /http://proxy:8000', or 'none') [none], prompt.
At, HTTP/FTP proxy URL? (e.g. /http://proxy:8000', or 'none') [none], prompt.<br>
PRESS:  enter for the default, none.
PRESS:  enter for the default, none.<br>
 
<br>
 
<br>
At, Which NTP Client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony], prompt.
At, Which NTP Client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony], prompt.<br>
PRESS:  enter for the default, chrony.
PRESS:  enter for the default, chrony.<br>
 
<br>
 
<br>
When the list of mirrors stop and at --More--, prompt <br>
When the list of mirrors stop and at --More--, prompt <br>
PRESS: the letter "r". <br>
PRESS: the letter "r". <br>
<br>
<br>
r) Add random from the above list <br>
r) Add random from the above list <br>
f) Detect and add the fastest mirror from above list <br>
f) Detect and add the fastest mirror from above list <br>
Line 155: Line 155:
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>                 
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>                 
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
  <br>       
<br>       
At Which disk(s) would you like to use? (or '?' for help or 'none') [none], prompt. <br>
At Which disk(s) would you like to use? (or '?' for help or 'none') [none], prompt. <br>
TYPE: sda sdb and PRESS:  enter to continue. <br>
TYPE: sda sdb and PRESS:  enter to continue. <br>
<br>
<br>
The following disks are selected: <br>
The following disks are selected: <br>
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>                 
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>                 
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
 
<br>
How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?], prompt. <br>
How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?], prompt. <br>
TYPE:  lvm and PRESS: enter to continue. <br>
TYPE:  lvm and PRESS: enter to continue. <br>
<br>
<br>
<br>
<br>
The following disks are selected (with LVM): <br>
The following disks are selected (with LVM): <br>
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>               
         sda (15.4 GB USB SanDisk 3.2Gen1) <br>               
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
         sdb (15.4 GB USB SanDisk 3.2Gen1) <br>
<br>
<br>
How would you like to use it? ('sys', 'data', or '?' for help) [?], prompt. <br>
How would you like to use it? ('sys', 'data', or '?' for help) [?], prompt. <br>
TYPE:  sys for system disk and PRESS: enter to continue. <br>
TYPE:  sys for system disk and PRESS: enter to continue. <br>
Line 180: Line 180:
<br>
<br>
TYPE: y, for yes and PRESS: enter to continue. <br>
TYPE: y, for yes and PRESS: enter to continue. <br>
<br>
<br>
<br>
<br>
Partition #1 contains a vfat signature.<br>
Partition #1 contains a vfat signature.<br>
Partition #2 contains a ext4 signature.<br>
Partition #2 contains a ext4 signature.<br>
Line 194: Line 194:
100% ###################################### <br>
100% ###################################### <br>
=> initframfs: creating /boot/initramfs-rpi4 <br>
=> initframfs: creating /boot/initramfs-rpi4 <br>
<br>
<br>
<br>
<br>
Installation is complete.  Please reboot.  DO NOT REBOOT!!! <br>
Installation is complete.  Please reboot.  DO NOT REBOOT!!! <br>
<br>
<br>
 
<br>
Alpine installed the boot drive as a FD linux raid autodetect, IT WILL NOT BOOT on a Raspberry Pi.  
Alpine installed the boot drive as a FD linux raid autodetect, IT WILL NOT BOOT on a Raspberry Pi. The Raspberry Pi can only boot from fat16 or fat32 partition with boot and lba flags enabled. <br>
The Raspberry Pi can only boot from fat16 or fat32 partition with boot and lba flags enabled.  
<br>
 
TYPE:  watch  cat /proc/mdstat<br>
TYPE:  watch  cat /proc/mdstat
<br>
 
Personalities : [raid1]<br>
Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[0]<br>
md1 : active raid1 sdb2[1] sda2[0]
           14723072 blocks super 1.2 [2/2] [UU]<br>
           14723072 blocks super 1.2 [2/2] [UU]
           {>....................] resyc - 2.7% (397521/14723072) finish=22.1min speed=8768K/sec<br>
           {>....................] resyc - 2.7% (397521/14723072) finish=22.1min speed=8768K/sec
md0 : active raid1 sdb1[1] sda1[0]<br>
md0 : active raid1 sdb1[1] sda1[0]
           307136 blocks [2/2] [UU]<br>
           307136 blocks [2/2] [UU]  
<br>
 
The Raid MD1 is still resycing. Take a break, the drives should be finished in 20 to 30 minutes.<br>
The Raid MD1 is still resycing. Take a break, the drives should be finished in 20 to 30 minutes.<br>
 
<br>
PRESS: ctrl + c to exit watch cat /proc/mdtstat<br>
PRESS: ctrl + c to exit watch cat /proc/mdtstat<br>
 
<br>
 
<br>
Backup the boot raid partition first<br>
Backup the boot raid partition first<br>
Insert mmcblk0<br>
Insert mmcblk0<br>
TYPE:  dd if=/dev/sda1 of=/dev/mmcblk0p1 bs=512<br>
TYPE:  dd if=/dev/sda1 of=/dev/mmcblk0p1 bs=512<br>
 
<br>
 
<br>
Reboot
Reboot<br>
 
<br>
 
<br>
Unmount the RAID 1 filesystem<br>
Unmount the RAID 1 filesystem<br>
TYPE:  umount /dev/md0<br>
TYPE:  umount /dev/md0<br>
 
<br>
 
<br>
Stop the madam raid device <br>
Stop the madam raid device <br>
TYPE:  mdadm --stop /dev/md0 <br>
TYPE:  mdadm --stop /dev/md0 <br>
 
<br>
 
<br>
Remove the Superblocks <br>
Remove the Superblocks <br>
TYPE:  mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/mmcblk0p1 (due to dd backup copying) <br>
TYPE:  mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/mmcblk0p1 (due to dd backup copying) <br>
 
<br>
 
<br>
verify md0 has been removed <br>
verify md0 has been removed <br>
TYPE:  lsblk and or cat /proc/mdstat <br>
TYPE:  lsblk and or cat /proc/mdstat <br>
 
<br>
 
<br>
TYPE:  apk add nano or use vi to remove RAID /dev/md0 entries by editing /etc/fstab and /etc/mdadm.conf <br>  
TYPE:  apk add nano or use vi to remove RAID /dev/md0 entries by editing /etc/fstab and /etc/mdadm.conf <br>  
 
<br>
 
<br>
reboot <br>
reboot <br>
 
<br>
Verify partition table sizes are the same on the Micro SD card and USB Drives. <br>
Verify partition table sizes are the same on the Micro SD card and USB Drives. <br>
 
<br>
TYPE:  fdisk -l (some entries removed for clairification) <br>
TYPE:  fdisk -l (some entries removed for clairification) <br>
<br>
<br>
Line 274: Line 273:
/dev/sdb1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect ok <br>
/dev/sdb1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect ok <br>
/dev/sdb2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <-- <br>
/dev/sdb2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <-- <br>
 
<br>
The Micro SD card is larger then /dev/sda2 and /dev/sdb2.  <br>
<br>
If the Micro SD card is larger then /dev/sda2 and /dev/sdb2.  <br>
Resize the partion before continuing.  <br>
Resize the partion before continuing.  <br>
<br>
<br>
<br>
<br>
Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors <br>
Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors <br>
15193 cylinders, 64 heads, 32 sectors/track <br>
15193 cylinders, 64 heads, 32 sectors/track <br>
Units: sectors of 1 * 512 = 512 bytes <br>
Units: sectors of 1 * 512 = 512 bytes <br>
<br>
<br>
Device      Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type <br>
Device      Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type <br>
/dev/mmcblk0p1 *  1,0,1      300,63,32        2048    616447    614400  300M  c Win95 FAT32 (LBA) <br>
/dev/mmcblk0p1 *  1,0,1      300,63,32        2048    616447    614400  300M  c Win95 FAT32 (LBA) <br>
/dev/mmcblk0p2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <br>
/dev/mmcblk0p2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <br>
<br>
<br>
<br>
<br>
Disk /dev/sda: 14 GB, 15401484288 bytes, 30081024 sectors <br>
Disk /dev/sda: 14 GB, 15401484288 bytes, 30081024 sectors <br>
14688 cylinders, 64 heads, 32 sectors/track <br>
14688 cylinders, 64 heads, 32 sectors/track <br>
Units: sectors of 1 * 512 = 512 bytes <br>
Units: sectors of 1 * 512 = 512 bytes <br>
<br>
<br>
Device  Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type <br>
Device  Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type <br>
/dev/sda1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect <br>
/dev/sda1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect <br>
/dev/sda2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <br>
/dev/sda2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect <br>
<br>
<br>
<br>
<br>
Disk /dev/sdb: 14 GB, 15401484288 bytes, 30081024 sectors <br>
Disk /dev/sdb: 14 GB, 15401484288 bytes, 30081024 sectors <br>
14688 cylinders, 64 heads, 32 sectors/track
14688 cylinders, 64 heads, 32 sectors/track<br>
Units: sectors of 1 * 512 = 512 bytes
Units: sectors of 1 * 512 = 512 bytes<br>
 
<br>
Device  Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type
Device  Boot StartCHS    EndCHS        StartLBA    EndLBA    Sectors  Size Id Type<br>
/dev/sdb1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect
/dev/sdb1 *  1,0,1      300,63,32        2048    616447    614400  300M fd Linux raid autodetect<br>
/dev/sdb2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect
/dev/sdb2    301,0,1    1023,63,32      616448  30081023  29464576 14.0G fd Linux raid autodetect<br>
<br>
<br>
<br>
<br>
Install sfdisk to copy partition table information <br>
Install sfdisk to copy partition table information <br>
TYPE:  apk add sfdisk <br>
TYPE:  apk add sfdisk <br>
<br>
<br>
*** Warning*** <br>
*** Warning*** <br>
Before executing the following commands mmcblk0, sda, and sdb must be the exact same size partitons. <br>
Before executing the following commands mmcblk0, sda, and sdb must be the exact same size partitons. <br>
**************<br>
**************<br>
Copy mmcblk0 disk partition table to sda and sdb<br>
Copy mmcblk0 disk partition table to sda and sdb<br>
 
<br>
TYPE:  sfdisk -d /dev/mmcblk0 |  sfdisk --force /dev/sda<br>
TYPE:  sfdisk -d /dev/mmcblk0 |  sfdisk --force /dev/sda<br>
TYPE:  sfdisk -d /dev/mmcblk0 |  sfdisk --force /dev/sdb<br>
TYPE:  sfdisk -d /dev/mmcblk0 |  sfdisk --force /dev/sdb<br>
<br>
 
<br>
Copy mmcblk0p1 boot partition to sda1 and sdb1<br>
Copy mmcblk0p1 boot partition to sda1 and sdb1<br>
TYPE:  dd if=/dev/mmcblk0p1 of=/dev/sda1 bs=512<br>
TYPE:  dd if=/dev/mmcblk0p1 of=/dev/sda1 bs=512<br>
Line 330: Line 329:
View Raid One information<br>
View Raid One information<br>
TYPE: mdadm --detail /dev/md1<br>
TYPE: mdadm --detail /dev/md1<br>
 
<br>
/dev/md1
/dev/md1<br>
                         version : 1.2
                         version : 1.2<br>
           Creation Time        : Sat Jun 24 12:50:56 2023
           Creation Time        : Sat Jun 24 12:50:56 2023<br>
             Raid Level : raid 1
             Raid Level : raid 1<br>
             Array Size : 14723072 (14.04 GiB 15.08 GB)
             Array Size : 14723072 (14.04 GiB 15.08 GB)<br>
           Used Dev Size : 14723072 (14.04 GiB 15.08 GB)
           Used Dev Size : 14723072 (14.04 GiB 15.08 GB)<br>
           Raid Devices : 2
           Raid Devices : 2<br>
           Total Devices : 3
           Total Devices : 3<br>
             Persistence : Superblock is persistence
             Persistence : Superblock is persistence<br>
           
<br>           
             Update Time : Sat Jun 24 14:30:11 2023
             Update Time : Sat Jun 24 14:30:11 2023<br>
                       State : clean
                       State : clean<br>
         Active Devices : 2
         Active Devices : 2<br>
         Working Devices : 3
         Working Devices : 3<br>
         Failed Devices : 0
         Failed Devices : 0<br>
           Spare Devices : 1
           Spare Devices : 1<br>
txnintn
txnintn<br>

Revision as of 16:28, 29 July 2023

Title: Alpine Linux install: LVM over Raid1 with a Micro SD spare.

Discussion:

Alpine Linux setup-alpine scripts when executed with two disks and the install medium, if both disks are selected, i.e., sda and sdb, the script will automatically configure a RAID1 installation.
https://wiki.alpinelinux.org/wiki/Setting_up_the_build_environment_on_HDD#Basic_setup

Additionally, LVM with a 'sys' install can be selected during the setup-alpine script.

The Raspberry Pi requires fat 16 / 32 boot partition with boot and LBA flags enabled. The Raspberry PI will boot from the USB or the Micro SD port. By having a Micro SD RAID1 spare, if the primary USB drive fails, the Micro SD should be able to boot the system.

NOTE: A mirrored RAID array (level 1 or 5) protects you against hardware failure. It doesn't protect against rm -rf /, software errors, exploits, earthquakes, fire. Don't rely on RAID as a backup strategy.
https://wiki.alpinelinux.org/wiki/Setting_up_a_software_RAID_array#Advice


LVM requires the Micro SD spare partition to be the same size as USB RAID1 partitions. A larger capacity Micro SD drive 2nd partition can easily resized to match the USB partition. During the install the setup-alpine script will maximize the size of 2nd partition on RAID1 drives

Tech Tip, not all Micro SD and USB drives are the same size.

16GB Drives
MFG / Model Size
SanDisk Industrial Micro SD 14.84GB
SanDisk Ultra Ultra Fit USB 3.1 14.34GB
SanDisk Ultra USB 3.0 14.91GB
SanDisk Cruzer Glide USB 2.0 14.91GB
32GB Drives
MFG / Model Size
Samsung SD Pro Endurance Micro SD 29.81GB
SanDisk Ultra SD 29.72GB
SanDisk Ultra Fit USB 3.1 Gen1 28.67GB
Silicon Power 5 USB 3.2 28.85GB
SanDisk Ultra 3.0 OTG 28.85GB
64GB Drive
MFG / Model Size
Samsung EVO Select Micro SD 59.69GB
Samsung Fit USB 3.1 59.75GB


Requirements:

Raspberry PI 4

Two Identical USB Drives - fit style drives recommended based on physical clearance issues.

One Micro SD Drive with the same or larger capacity then the USB drives


One USB drive for the installation files.

Preparation:

Created the following for the USB RAID disks:
sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.
sdx2 using the rest of the disk with a fd linux raid partition, formatted ext4

mmcblkx, sdx1 a 300MB Fat32 Oc Partition, with boot and lba flags as required by Raspberry PI.
sdx2 sized to match USB RAID partition, Linux 83 and formatted Ext4. Do not use Linux Raid.

The USB installation drive single partition fat 32 0c with boot and LBA flags.
Extract the contents of alpine-rpi-3.x.x-aarch.tar.gz to sdc1 (spare USB) partition.

The Raspberry Pi eprom must be set to boot USB port first and SD port second.

Installation:

Insert the "sda" USB disk into the bottom USB 3.0 port and the "sdb" USB drive into the upper USB 3.0 port. Power up the system, after the system has failed to boot to the installed USB drives, the screen will change from white and red to black and white text, insert the installation USB (sdc) to start the install process. This will set the drive assignments properly.


After logging in as root.
To start the install,
TYPE: setup-alpine and PRESS: enter.


At, Select keyboard layout: [none], prompt.
TYPE: us and PRESS: enter.
At, Select variant (or 'abort'):, prompt.
TYPE: us and PRESS: enter.


At, Enter system hostname (fully qualified form, e.g. 'foo.example.org') [localhost] prompt.
TYPE: the localhost name, for example, rpi44gb and PRESS: enter.


At, Enter '?' for help on bridges, bonding and vlans.
Which one do you want to initialize? (or '?' or 'done' [eth0], prompt.
PRESS: enter, to use the default, ethernet0 connection.

Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp], prompt.
PRESS: enter to use the default, dhcp.

At the second, Enter '?' for help on bridges, bonding and vlans.
Which one do you want to initialize? (or '?' or 'done' [wlan0], prompt.
TYPE: done and PRESS: enter.

Then at, Do you want to do and manual network configuration? (y/n) [n], prompt.
PRESS enter for the default, [n], for no.


At, Change password for root, prompt.
TYPE: the root password, and PRESS: enter.
At, Retype password, prompt.
TYPE: the root password and PRESS: enter.


At, Which timezone are you in? ('?' for a list) [UTC]. prompt.
TYPE: America, with a capital A, and press enter.

At, What sub-timezone of 'America' are you in? ('?' for list), prompt.
TYPE: Chicago, with a capital C, and press enter.

At, HTTP/FTP proxy URL? (e.g. /http://proxy:8000', or 'none') [none], prompt.
PRESS: enter for the default, none.


At, Which NTP Client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony], prompt.
PRESS: enter for the default, chrony.


When the list of mirrors stop and at --More--, prompt
PRESS: the letter "r".

r) Add random from the above list
f) Detect and add the fastest mirror from above list
e) Edit /etc/apk/repositories with text editor

At, Enter mirror number (1-72) or URL to add (or r/f/e/done) [1], prompt.
PRESS: enter for the default number 1.


At, Setup a user? (enter a lower-case loginname, or 'no') [no], prompt.
PRESS: enter for the default no.


At, which ssh server? ('openssh', 'dropbear' or 'none'), prompt. TYPE: none and PRESS: enter to continue.
At, Available disks are:

       sda	(15.4 GB USB	SanDisk 3.2Gen1) 
sdb (15.4 GB USB SanDisk 3.2Gen1)


At Which disk(s) would you like to use? (or '?' for help or 'none') [none], prompt.
TYPE: sda sdb and PRESS: enter to continue.

The following disks are selected:

       sda	(15.4 GB USB	SanDisk 3.2Gen1) 
sdb (15.4 GB USB SanDisk 3.2Gen1)


How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?], prompt.
TYPE: lvm and PRESS: enter to continue.


The following disks are selected (with LVM):

       sda	(15.4 GB USB	SanDisk 3.2Gen1) 
sdb (15.4 GB USB SanDisk 3.2Gen1)


How would you like to use it? ('sys', 'data', or '?' for help) [?], prompt.
TYPE: sys for system disk and PRESS: enter to continue.


At, WARNING: Erase the above disk(s) and continue? (y/n) [n], prompt.

       sda (15.4 GB USB	SanDisk 3.2Gen1) 
sdb (15.4 GB USB SanDisk 3.2Gen1)


TYPE: y, for yes and PRESS: enter to continue.


Partition #1 contains a vfat signature.
Partition #2 contains a ext4 signature.
Partition #1 contains a vfat signature.
Partition #2 contains a ext4 signature.
Creating file systems
mkfs.fat 4.2 ((2021-01-31)

       Physical volume "/dev/md1" successfully created. 
Logical volume "lv_root" created.
  • service lvm added to runlevel boot

Installing system on /dev/vg0/lv_root"
100% ######################################
=> initframfs: creating /boot/initramfs-rpi4


Installation is complete. Please reboot. DO NOT REBOOT!!!


Alpine installed the boot drive as a FD linux raid autodetect, IT WILL NOT BOOT on a Raspberry Pi. The Raspberry Pi can only boot from fat16 or fat32 partition with boot and lba flags enabled.

TYPE: watch cat /proc/mdstat

Personalities : [raid1]
md1 : active raid1 sdb2[1] sda2[0]

         14723072 blocks super 1.2 [2/2] [UU]
{>....................] resyc - 2.7% (397521/14723072) finish=22.1min speed=8768K/sec

md0 : active raid1 sdb1[1] sda1[0]

         307136 blocks [2/2] [UU]


The Raid MD1 is still resycing. Take a break, the drives should be finished in 20 to 30 minutes.

PRESS: ctrl + c to exit watch cat /proc/mdtstat


Backup the boot raid partition first
Insert mmcblk0
TYPE: dd if=/dev/sda1 of=/dev/mmcblk0p1 bs=512


Reboot


Unmount the RAID 1 filesystem
TYPE: umount /dev/md0


Stop the madam raid device
TYPE: mdadm --stop /dev/md0


Remove the Superblocks
TYPE: mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/mmcblk0p1 (due to dd backup copying)


verify md0 has been removed
TYPE: lsblk and or cat /proc/mdstat


TYPE: apk add nano or use vi to remove RAID /dev/md0 entries by editing /etc/fstab and /etc/mdadm.conf


reboot

Verify partition table sizes are the same on the Micro SD card and USB Drives.

TYPE: fdisk -l (some entries removed for clairification)

Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors <--
15193 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 * 1,0,1 300,63,32 2048 616447 614400 300M c Win95 FAT32 (LBA) ok
/dev/mmcblk0p2 301,0,1 1023,63,32 616448 31116287 30499840 14.5G fd Linux raid autodetect <--


Disk /dev/sda: 14 GB, 15401484288 bytes, 30081024 sectors
14688 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes


Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 1,0,1 300,63,32 2048 616447 614400 300M fd Linux raid autodetect ok
/dev/sda2 301,0,1 1023,63,32 616448 30081023 29464576 14.0G fd Linux raid autodetect <--



Disk /dev/sdb: 14 GB, 15401484288 bytes, 30081024 sectors
14688 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes


Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sdb1 * 1,0,1 300,63,32 2048 616447 614400 300M fd Linux raid autodetect ok
/dev/sdb2 301,0,1 1023,63,32 616448 30081023 29464576 14.0G fd Linux raid autodetect <--


If the Micro SD card is larger then /dev/sda2 and /dev/sdb2.
Resize the partion before continuing.


Disk /dev/mmcblk0: 15 GB, 15931539456 bytes, 31116288 sectors
15193 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 * 1,0,1 300,63,32 2048 616447 614400 300M c Win95 FAT32 (LBA)
/dev/mmcblk0p2 301,0,1 1023,63,32 616448 30081023 29464576 14.0G fd Linux raid autodetect


Disk /dev/sda: 14 GB, 15401484288 bytes, 30081024 sectors
14688 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 1,0,1 300,63,32 2048 616447 614400 300M fd Linux raid autodetect
/dev/sda2 301,0,1 1023,63,32 616448 30081023 29464576 14.0G fd Linux raid autodetect


Disk /dev/sdb: 14 GB, 15401484288 bytes, 30081024 sectors
14688 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sdb1 * 1,0,1 300,63,32 2048 616447 614400 300M fd Linux raid autodetect
/dev/sdb2 301,0,1 1023,63,32 616448 30081023 29464576 14.0G fd Linux raid autodetect


Install sfdisk to copy partition table information
TYPE: apk add sfdisk

      • Warning***

Before executing the following commands mmcblk0, sda, and sdb must be the exact same size partitons.


Copy mmcblk0 disk partition table to sda and sdb

TYPE: sfdisk -d /dev/mmcblk0 | sfdisk --force /dev/sda
TYPE: sfdisk -d /dev/mmcblk0 | sfdisk --force /dev/sdb


Copy mmcblk0p1 boot partition to sda1 and sdb1
TYPE: dd if=/dev/mmcblk0p1 of=/dev/sda1 bs=512
TYPE: dd if=/dev/mmcblk0p1 of=/dev/sdb1 bs=512


Add mmcblk0 as a spare drive to RAID /dev/md1
TYPE: madam --add /dev/md1 /dev/mmcblk0p2


View Raid One information
TYPE: mdadm --detail /dev/md1

/dev/md1

                       version : 1.2
Creation Time  : Sat Jun 24 12:50:56 2023
Raid Level : raid 1
Array Size : 14723072 (14.04 GiB 15.08 GB)
Used Dev Size : 14723072 (14.04 GiB 15.08 GB)
Raid Devices : 2
Total Devices : 3
Persistence : Superblock is persistence


           Update Time : Sat Jun 24 14:30:11 2023
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1

txnintn