[tutorial] Making a RAID1 rootfs April 03, 2016 02:50PM |
Registered: 9 years ago Posts: 298 |
apt-get install mdadm rsync initramfs-toolsmdadm will popup something while you install it and also drop some warnings. It's ok, we will set it up and then rerun its configuration popups later.
mdadm --create /dev/md0 --metadata=0.90 --level=1 --raid-devices=2 missing /dev/sdb1
mkfs.ext4 -L rootfs /dev/md0
nano /etc/mdadm/mdadm.conf
DEVICE /dev/sd?*This forces the thing to look at all drives/partitions for RAID signatures.
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
ARRAY /dev/md0 metadata=0.90 UUID=66a8c96d:ac6a5da3:9d4deba6:47ca997f
dpkg-reconfigure mdadm
update-initramfs -u -k all
cd /boot && ls
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-3.18.5-kirkwood-tld-1 -d vmlinuz-3.18.5-kirkwood-tld-1 uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-3.18.5-kirkwood-tld-1 -d initrd.img-3.18.5-kirkwood-tld-1 uInitrd
mkdir /tmp/mnt mount /dev/md0 /tmp/mnt rsync -auHxv --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* /* /tmp/mnt
nano /tmp/mnt/etc/fstab
/dev/md0 / auto noatime,errors=remount-ro 0 1
poweroff
mount
root@debian:/boot# mount -----removed stuff------------ /dev/md0 on / type ext4 (rw,noatime,errors=remount-ro,data=ordered) -----other removed stuff-------
mdadm --add /dev/md0 /dev/sdb1
mdadm --detail /dev/md0
Re: [tutorial] Making a RAID1 rootfs April 03, 2016 03:15PM |
Admin Registered: 14 years ago Posts: 19,422 |
Re: [tutorial] Making a RAID1 rootfs April 03, 2016 03:55PM |
Registered: 9 years ago Posts: 298 |
Re: [tutorial] Making a RAID1 rootfs April 03, 2016 07:02PM |
Registered: 10 years ago Posts: 1,037 |
Conor
Re: [tutorial] Making a RAID1 rootfs May 11, 2016 09:19PM |
Re: [tutorial] Making a RAID1 rootfs May 13, 2016 05:30AM |
Registered: 9 years ago Posts: 298 |
Conor
Re: [tutorial] Making a RAID1 rootfs May 14, 2016 04:04PM |
Conor
Re: [tutorial] Making a RAID1 rootfs May 18, 2016 11:57AM |
bootcmd_exec=mw 0x800000 0 1; run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 0x1100000; fi; else if run load_dtb; then bootm 0x800000 - 0x1c00000; else bootm 0x800000; fi; fi bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec bootdelay=10 bootdev=usb device=0:1 devices=usb ide mmc disks=0 1 2 3 ethact=egiga0 if_netconsole=ping $serverip led_error=orange blinking led_exit=green off led_init=green blinking load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device 0x1c00000 $dtb_file load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x1100000 /boot/uInitrd load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x800000 /boot/uImage mainlineLinux=yes mtdids=nand0=orion_nand partition=nand0,2 scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start"; setenv scan_ide "ide reset"; setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 0x800000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version; stderr=serial stdin=serial stdout=serial uenv_import=echo importing envs ...; env import -t 0x810000 uenv_init_devices=setenv init_usb "usb start"; setenv init_ide "ide reset"; setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done; uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in 0; do run uenv_read_disk; done; done; uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read; fi; else if $devtype part $disknum; then run uenv_read; fi; fi uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi usb_ready_retry=15 arcNumber=3960 machid=f78 ethaddr=<my mac> mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root) bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3 dtb_file=/boot/dts/kirkwood-pogoplug_v4.dtb preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi preboot=run preboot_nc ipaddr=<ip of pogo> serverip=<ip of laptop>
Re: [tutorial] Making a RAID1 rootfs May 19, 2016 04:13AM |
Registered: 9 years ago Posts: 298 |
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device 0x1c00000 $dtb_file load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x1100000 /boot/uInitrd load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x800000 /boot/uImageThis means that uboot looks for a ext2 partition (and will also read ext3 because it's similar).
Re: [tutorial] Making a RAID1 rootfs May 19, 2016 04:54AM |
Admin Registered: 14 years ago Posts: 19,422 |
Re: [tutorial] Making a RAID1 rootfs May 19, 2016 03:57PM |
Registered: 9 years ago Posts: 298 |
Re: [tutorial] Making a RAID1 rootfs May 19, 2016 06:19PM |
Admin Registered: 14 years ago Posts: 19,422 |
Re: [tutorial] Making a RAID1 rootfs August 25, 2019 07:41PM |
Registered: 7 years ago Posts: 183 |
cat /proc/mdstat result: Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdc1[0] 4883638464 blocks super 1.2 [2/1] [U_] bitmap: 3/37 pages [12KB], 65536KB chunk sudo mdadm --detail /dev/md0 result: /dev/md0: Version : 1.2 Creation Time : Tue May 22 03:57:15 2018 Raid Level : raid1 Array Size : 4883638464 (4657.40 GiB 5000.85 GB) Used Dev Size : 4883638464 (4657.40 GiB 5000.85 GB) Raid Devices : 2 Total Devices : 1 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Sun Aug 25 14:02:05 2019 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Consistency Policy : unknown Name : XXXX:0 (local to host XXXX) UUID : be9b73d1:54b0c2db:8ab52103:5ecedc50 Events : 185305 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 - 0 0 1 removed
sudo mdadm --manage /dev/md0 --add /dev/sdd1 Result: mdadm: re-added /dev/sdd1
sudo mdadm --detail /dev/md0 result : /dev/md0: Version : 1.2 Creation Time : Tue May 22 03:57:15 2018 Raid Level : raid1 Array Size : 4883638464 (4657.40 GiB 5000.85 GB) Used Dev Size : 4883638464 (4657.40 GiB 5000.85 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Sun Aug 25 19:56:06 2019 State : clean, degraded, recovering Active Devices : 1 Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Consistency Policy : unknown Rebuild Status : 22% complete Name : XXXX:0 (local to host XXXX) UUID : be9b73d1:54b0c2db:8ab52103:5ecedc50 Events : 185308 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 1 8 49 1 spare rebuilding /dev/sdd1
sudo mdadm --detail /dev/md0 result: /dev/md0: Version : 1.2 Creation Time : Tue May 22 03:57:15 2018 Raid Level : raid1 Array Size : 4883638464 (4657.40 GiB 5000.85 GB) Used Dev Size : 4883638464 (4657.40 GiB 5000.85 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Intent Bitmap : Internal Update Time : Sun Aug 25 19:56:20 2019 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : unknown Name : XXXX:0 (local to host XXXX) UUID : be9b73d1:54b0c2db:8ab52103:5ecedc50 Events : 185314 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 1 8 49 1 active sync /dev/sdd1
Re: [tutorial] Making a RAID1 rootfs November 18, 2020 07:01PM |
Registered: 7 years ago Posts: 183 |
Re: [tutorial] Making a RAID1 rootfs February 16, 2021 08:22AM |
Registered: 4 years ago Posts: 7 |
Re: [tutorial] Making a RAID1 rootfs February 11, 2025 03:26PM |
Registered: 9 years ago Posts: 12 |
U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:52:06 -0700) ZyXEL NSA320 2-Bay Power Media Server SoC: Kirkwood 88F6281_A1 DRAM: 512 MiB WARNING: Caches not enabled NAND: 128 MiB In: serial Out: serial Err: serial Net: egiga0 MV88E1318 PHY initialized on egiga0 No link on egiga0 ping failed; host 10.10.10.160 is not alive No link on egiga0 ping failed; host 10.10.10.160 is not alive No link on egiga0 ping failed; host 10.10.10.160 is not alive No link on egiga0 ping failed; host 10.10.10.160 is not alive No link on egiga0 ping failed; host 10.10.10.160 is not alive Hit any key to stop autoboot: 0 No link on egiga0 dns lookup of time.apple.com failed, check setup ntpserverip not set starting USB... USB0: USB EHCI 1.00 scanning bus 0 for devices... 3 USB Device(s) found scanning usb for storage devices... ** First descriptor is NOT a primary desc on 0:1 ** 1 Storage Device(s) found 5890328 bytes read in 430 ms (13.1 MiB/s) 13397 bytes read in 1065 ms (11.7 KiB/s) 5890328 bytes read in 430 ms (13.1 MiB/s) 6270555 bytes read in 445 ms (13.4 MiB/s) ## Booting kernel from Legacy Image at 00800000 ... Image Name: Linux-6.12.6-kirkwood-tld-1 Created: 2025-02-11 20:17:11 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 5890264 Bytes = 5.6 MiB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK ## Loading init Ramdisk from Legacy Image at 01100000 ... Image Name: initramfs-6.12.6-kirkwood-tld-1 Created: 2025-02-11 20:17:45 UTC Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 6270491 Bytes = 6 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 01c00000 Booting using the fdt blob at 0x1c00000 Loading Kernel Image ... OK Loading Ramdisk to 0fa05000, end 0ffffe1b ... OK Loading Device Tree to 0f9fe000, end 0fa04454 ... OK Starting kernel ... [ 0.000000][ T0] Booting Linux on physical CPU 0x0 [ 0.000000][ T0] Linux version 6.12.6-kirkwood-tld-1 (root@tldDebian) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 PREEMPT Thu Dec 19 14:57:30 PST 2024 [ 0.000000][ T0] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f [ 0.000000][ T0] CPU: VIVT data cache, VIVT instruction cache [ 0.000000][ T0] OF: fdt: Machine model: Zyxel NSA320 ... trimmed from output ... Zyxel NSA320 Linux version 6.12.6-kirkwood-tld-1 (root@tldDebian) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 PREEMPT Thu Dec 19 14:57:30 PST 2024 Debian 12.9 Tue Feb 11 15:06:42 CST 2025 up 2 minutes root@nsa320:~#
arcNumber=3956 baudrate=115200 boot_sata1=mw 0x800000 0 1; setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10 $mtdparts; ide reset; ext2load ide 0:1 0x800000 /boot/uImage; ext2load ide 0:1 0x01100000 /boot/uInitrd; bootm 0x00800000 0x01100000 boot_sata2=mw 0x800000 0 1; setenv bootargs console=ttyS0,115200 root=/dev/sdb1 rootdelay=10 $mtdparts; ide reset; ext2load ide 1:1 0x800000 /boot/uImage; ext2load ide 1:1 0x01100000 /boot/uInitrd; bootm 0x00800000 0x01100000 bootcmd=dns time.apple.com 17.253.24.253; sntp; run bootcmd_usb; run boot_sata1; run boot_sata2; run bootcmd_usb; usb stop; run bootcmd_rescue; reset bootcmd_usb=run usb_init; run usb_load_uimage; run set_bootargs_usb; run usb_boot; bootdelay=4 console=ttyS0,115200 dnsip=10.10.10.1 dtb_file=/boot/dts/kirkwood-nsa320.dtb ethact=egiga0 ethaddr=c8:6c:87:aa:a0:82 fileaddr=1c00000 filesize=3455 gatewayip=10.10.10.1 if_netconsole=ping $serverip ipaddr=10.10.10.49 load_dtb=load usb $usb_device 0x1c00000 /boot/dts/kirkwood-nsa320.dtb load_initrd=load usb $usb_device 0x1100000 /boot/uInitrd load_uimage=load usb $usb_device 0x800000 /boot/uImage mainlineLinux=yes mtdids=nand0=orion_nand mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2) nc_ready=0 ncip=10.10.10.160 netmask=255.255.255.0 partition=nand0,2 preboot=run preboot_nc preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi serverip=10.10.10.160 set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version; stderr=serial stdin=serial stdout=serial usb_boot=run load_dtb; run load_uimage; if run load_initrd; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 - 0x1c00000; fi usb_device=0:0 usb_init=usb start usb_load_uimage=mw 0x800000 0 1; load usb $usb_device 0x800000 /boot/uImage usb_root=LABEL=rootfs usb_rootdelay=5 usb_rootfstype=ext3
root@nsa320:~# mdadm --add /dev/md1 /dev/sdd mdadm: added /dev/sdd root@nsa320:~# mdadm --detail /dev/md1 /dev/md1: Version : 1.0 Creation Time : Tue Feb 11 12:40:52 2025 Raid Level : raid1 Array Size : 117220736 (111.79 GiB 120.03 GB) Used Dev Size : 117220736 (111.79 GiB 120.03 GB) Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Tue Feb 11 15:21:40 2025 State : active, degraded, recovering Active Devices : 1 Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Consistency Policy : resync Rebuild Status : 5% complete Name : nsa320:1 (local to host nsa320) UUID : 3d168666:c6f484ab:07d9b864:50619c74 Events : 1703 Number Major Minor RaidDevice State 0 8 32 0 active sync /dev/sdc 2 8 48 1 spare rebuilding /dev/sdd
root@nsa320:~# mdadm --create --verbose /dev/md1 --level=1 --metadata=1.0 --consistency-policy=resync --raid-devices=2 /dev/sdd missing
root@nsa320:~# cat /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> LABEL=rootfs / ext3 noatime,errors=remount-ro 0 1 /dev/md1 / ext3 noatime,errors=remount-ro 0 1 tmpfs /tmp tmpfs defaults 0 0 /dev/md0 /ifs ext4 noatime,data=writeback 0 2 # a swapfile is not a swap partition, no line here # use dphys-swapfile swap[on|off] for that
Re: [tutorial] Making a RAID1 rootfs February 11, 2025 08:55PM |
Admin Registered: 14 years ago Posts: 19,422 |
Quote
not sure which entry in fstab is being used to mount, but I can't imagine having both hurts.
bootcmd=dns time.apple.com 17.253.24.253; sntp; run bootcmd_usb; run boot_sata1; run boot_sata2; run bootcmd_usb; usb stop; run bootcmd_rescue; reset bootcmd_usb=run usb_init; run usb_load_uimage; run set_bootargs_usb; run usb_boot; set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts usb_root=LABEL=rootfs
cat /proc/cmdline
Re: [tutorial] Making a RAID1 rootfs February 13, 2025 02:46AM |
Admin Registered: 14 years ago Posts: 19,422 |
Quote
RAID
Making a RAID1 rootfs - Tutorial 2