New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Upgrade from RAID-enabled squeeze to stretch

Discuss development on Bubba
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

MouettE wrote: 25 Mar 2018, 15:02 Sorry this is a bug of the rescue install os which doesn't load the proper module for the mtd device. I will fix that but all you need to do is load the proper module first :

Code: Select all

[root@b3-install devices]# modprobe m25p80
Our posts must have crossed each other on the highway.
The modprobe did the trick!

Thx!
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

So after completing all the steps yesterday and checking if fw_printenv replied correctly. I rebooted B3 but it got stuck in the bootprocess (steady purple LED) for at least 45 mins before I rebooted into rescue system.

Hmm so what's wrong...

I have two ideas at the moment, but some of them will probably be countered immediately by the specialists amongst you guys.
1) I did not use sfdisk command from Mouette's Wiki

Code: Select all

root@b2:~# sfdisk -uM /dev/sdb << EOF
,50,fd
,10240,fd
,1024,fd
,,fd
EOF
to create the partitions. But fdisk (see previous posts). The reason is that -u flag is no longer supported and I'm more used to using fdisk. However now that I look at the command from Mouette, it creates a 50M, 10GiB, 1GiB, "rest of the disk" partition. Whereas I have a 300MiB, 10GiB, 512MiB, "rest of the disk" partition. Which is obviously not entirely the same. Secondly: the 300MiB partition which is mounted as /boot isn't in fact flagged as "bootable". To be honest: I don't see a way to flag it as bootable. No option available in fdisk, and in sfdisk partition needs to be created with the * option, but Mouette's commmand here above does not include the * option either... So I'm a bit confused here. Maybe it's another issue linked to the different version of sfdisk and the command above is not compatible with todays version (just like the -u flag)

2) the creation of the soft link in /boot:

Code: Select all

 ln -s . /mnt/bubba/boot/boot
In rescue mode the /boot does not exist so I created it.

Code: Select all

[root@b3-install etc] cd /
[root@b3-install /] mkdir boot
[root@b3-install /] cd boot
[root@b3-install boot] ln -s . /mnt/bubba/boot/boot
Soooo, it was only last night it popped into my mind that this was not such a good idea as in fact the /boot I created is rather volatile in rescue mode as it's in RAM-disk, correct? Brings me to my next question: How can I make this permanent? As per Mouette's Wiki I edited the fstab in the process. But I didn't execute

Code: Select all

mount -a
afterwards. If I'm not mistaking that should make a /boot available as where I can make the soft link. Is this the missing link?

I'm sorry for my long posts, as always, but I keep them as a 'note to self', and maybe they prove useful to somebody else too.
MouettE
Site admin
Posts: 341
Joined: 06 Oct 2011, 19:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by MouettE »

Can you show the output of fw_printenv ?
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

MouettE wrote: 26 Mar 2018, 10:46 Can you show the output of fw_printenv ?
There you go:

Code: Select all

[root@b3-install boot]# fw_printenv 
bootdelay=1
baudrate=115200
preboot=
loadaddr=0x800000
console=ttyS0
bootfile=uImage
flashfile=u-boot.kwb
installfile=install.itb
setdiskargs=setenv bootargs root=$diskdev console=$console,$baudrate serial=${serial#} key=$key button=$button
setbootargs=setenv bootargs root=$rootdev rw console=$console,$baudrate $othbootargs
usbbootroot=/dev/sda1
usbbootdev=usb 0:1
usbboot=usb start; setenv diskdev $usbbootroot; run setdiskargs; ext2load $usbbootdev $loadaddr /boot/$bootfile; bootm
usbflashdev=usb 0:1
usbflash=fatload $usbflashdev $loadaddr /install/$flashfile && sf probe 0:0 && sf erase 0 80000; sf write $loadaddr 0 $filesize
satadev=sata 0:1
sataboot=setenv diskdev $sataroot; run setdiskargs; ext2load $satadev $loadaddr /boot/$bootfile; bootm
usbinstallroot=/dev/ram0
usbinstalldev=usb 0:1
usbinstall=usb start; setenv diskdev $usbinstallroot; run setdiskargs; fatload $usbinstalldev $loadaddr /install/$installfile; bootm
bootalt1=run sataboot || reset
bootalt2=run usbinstall || run usbflash || run sataboot || reset
stdin=serial
stdout=serial
stderr=serial
button=0
bootcmd=run sataboot || reset
ethact=egiga0
ethaddr=00:22:02:00:1f:02
eth1addr=00:22:02:00:1f:03
serial#=***
key=****
sataroot=/dev/md1
The only thing I ever changed in u-boot was "sataroot".
see: http://forum.excito.com/viewtopic.php?f ... =15#p22244
MouettE
Site admin
Posts: 341
Joined: 06 Oct 2011, 19:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by MouettE »

It looks good. I'm going to have to test it on my b3 with a serial console to sort it out. I'll try to recreate your setup and see how it goes with your previously posted commands. I'll keep you updated in the next couple of days.
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

Thx for your effort MouettE (once more)

Meanwhile I'm going to start over and recreate the partitions so I get the sizes same as previously.

If I encounter anything different/bizar, I'll post it back here.
MouettE
Site admin
Posts: 341
Joined: 06 Oct 2011, 19:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by MouettE »

I've done a few tests and I got it to work on the stretch image of the b3.

The main issue preventing the system from booting is the type of the partition created. You must set it to 29 in order for the kernel to autodetect the arrays on boot :

Code: Select all

root@b3:~# fdisk -l /dev/sda
Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F06A2E88-F5E5-4C60-A2DB-33111D42B79F

Device        Start      End  Sectors  Size Type
/dev/sda1      2048 83888127 83886080   40G Linux RAID
/dev/sda2  83888128 84936703  1048576  512M Linux RAID
Also a few remarks on your setup :
  • You don't need to create a separate ext2 boot partition on the b3, it's only required on the bubba2. However if you put your root filesystem on md0 you need to change the sataroot variable of u-boot from /dev/md1 to /dev/md0. Your choice, I'd keep the separate boot partition to avoid u-boot changes though.
  • Unless you need it don't bother with the lvm stuff (pvcreate,...), or the separate home partition. The original RAID wiki page was made for use with the excito image, but the stretch is much more simple. You only need a root partition to get it to boot (the swap is not even mandatory, but recommended)
  • Only put physical or RAID partitions with regular filesystems in fstab. No need for swap, proc or usbfs, systemd handles that automatically.
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

Thx MouettE for the update!

I did everything all over as per your recommendations and got it working now (after a 2nd try, see below why).
- no /boot partition

Code: Select all

Device        Start        End    Sectors  Size Type
/dev/sdb1      2048   20973567   20971520   10G Linux RAID
/dev/sdb2  20973568   23070719    2097152    1G Linux swap
/dev/sdb3  23070720 3907029134 3883958415  1.8T Linux RAID
- no LVM
- fstab with very basic info

Code: Select all

[root@b3-install etc]# cat fstab
/dev/md0      /       ext3    noatime,defaults        0       1
/dev/md2      /home   ext3    defaults                0       2
- I did alter the u-boot variable, just to make it clean(er)

Note to self (and maybe others) DON'T use ext4 => it won't work (trust me ;-) )

Continuing to setup my OwnCloud service now (will start a new thread with that)
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: Upgrade from RAID-enabled squeeze to stretch

Post by Gordon »

Correct. The first partition on the disk (where `/boot/uImage` has to reside) has to be either FAT, ext2 or ext3 formatted. That doesn't mean you can't use ext4 for root though, it just means you need to move root to a different partition.

Might want to note that 10G is probably a bit tiny for modern Linux. I use 16G myself, with currently 9.3G allocated.
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

I see.... That would make sense.

so /boot in ext3
/ in ext4
/home in ext4

should do the trick also?

and increase / size to 20GiB...

I can still start over from scratch, I'm getting used to atm :-)
Just did some basic config and installed some additional packages as ddclient etc... nothing I can't do quickly over again.

I'm reading up on NextCloud and I might go for that option in favor of OwnCloud...
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: Upgrade from RAID-enabled squeeze to stretch

Post by Gordon »

Correct. Must note though that uImage needs to be in /boot of what will typically be /dev/sda1. This means that if you mount /dev/sda1 as /boot that uImage must be at /boot/boot/ in your filesystem.

Another thing is that the uBoot environment loads your kernel with a command line that sets root at /dev/sda1. You will need to change that by either:
  • changing the command line parameters within the uBoot environment itself (requires serial connection to your B3)
  • compiling a fixed command line inside the kernel itself
  • boot into another preboot environment where you can easily change the command line for the actual kernel to be loaded
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

Gordon wrote: 27 Mar 2018, 08:57 Another thing is that the uBoot environment loads your kernel with a command line that sets root at /dev/sda1. You will need to change that by either:
  • changing the command line parameters within the uBoot environment itself (requires serial connection to your B3)
  • compiling a fixed command line inside the kernel itself
  • boot into another preboot environment where you can easily change the command line for the actual kernel to be loaded
Well I always used the fw_setenv command (now available in rescue).
Mine points to my raid device:

Code: Select all

sataroot=/dev/md1
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

To finalize this thread, hereby a final resume:

First prepare your USB key properly => yes it needs a partition table, and yes it can be done with standard Windows tools too. See a few posts earlier: http://forum.excito.com/viewtopic.php?f=7&t=6139#p28511

Boot in rescue mode (usb key plugged in, power button pressed while plugging the power)

You'll get first a steady green led: you can release the button
Led starts blinking (white?) and gives and indication about the IP that has been leased. If you can 't determine the IP check your DHCP device and look for a networkcard with MAC starting with: 00:22:02

Connect over ssh and log in with root/excito

Partition disk (partitions have already been removed previously. If not: use "d" in fdisk to do so):

Code: Select all

[root@b3-install root]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ABC86EB6-AD19-4755-B237-7FA9A0005CB6

Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-3907029134, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-3907029134, default 3907029134): +300M

Created a new partition 1 of type 'Linux filesystem' and of size 300 MiB.

Command (m for help): n
Partition number (2-128, default 2):
First sector (616448-3907029134, default 616448):
Last sector, +sectors or +size{K,M,G,T,P} (616448-3907029134, default 3907029134): +25G

Created a new partition 2 of type 'Linux filesystem' and of size 25 GiB.

Command (m for help): n
Partition number (3-128, default 3):
First sector (53045248-3907029134, default 53045248):
Last sector, +sectors or +size{K,M,G,T,P} (53045248-3907029134, default 3907029134): +1G

Created a new partition 3 of type 'Linux filesystem' and of size 1 GiB.

Command (m for help): n
Partition number (4-128, default 4):
First sector (55142400-3907029134, default 55142400):
Last sector, +sectors or +size{K,M,G,T,P} (55142400-3907029134, default 3907029134):

Created a new partition 4 of type 'Linux filesystem' and of size 1.8 TiB.

Command (m for help): t
Partition number (1-4, default 4):
Hex code (type L to list all codes): 29

Changed type of partition 'Linux filesystem' to 'Linux RAID'.

Command (m for help): t
Partition number (1-4, default 4): 3
Hex code (type L to list all codes): 19

Changed type of partition 'Linux filesystem' to 'Linux swap'.

Command (m for help): t
Partition number (1-4, default 4): 2
Hex code (type L to list all codes): 29

Changed type of partition 'Linux filesystem' to 'Linux RAID'.

Command (m for help): t
Partition number (1-4, default 4): 1
Hex code (type L to list all codes): 29

Changed type of partition 'Linux filesystem' to 'Linux RAID'.

Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: ABC86EB6-AD19-4755-B237-7FA9A0005CB6

Device        Start        End    Sectors  Size Type
/dev/sdb1      2048     616447     614400  300M Linux RAID
/dev/sdb2    616448   53045247   52428800   25G Linux RAID
/dev/sdb3  53045248   55142399    2097152    1G Linux swap
/dev/sdb4  55142400 3907029134 3851886735  1.8T Linux RAID

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Create RAID array:

Code: Select all

[root@b3-install /]# mdadm --create --metadata=0.9 --level=1 --raid-devices=2 /dev/md0 /dev/sdb1 missing
mdadm: array /dev/md0 started.
[root@b3-install /]# mdadm --create --metadata=0.9 --level=1 --raid-devices=2 /dev/md1 /dev/sdb1 missing
mdadm: array /dev/md1 started.
[root@b3-install /]# mdadm --create --metadata=0.9 --level=1 --raid-devices=2 /dev/md2 /dev/sdb3 missing
mdadm: array /dev/md2 started.
[root@b3-install /]# mdadm --create --metadata=0.9 --level=1 --raid-devices=2 /dev/md3 /dev/sdb4 missing
mdadm: array /dev/md3 started.
Load missing modules for uboot (no longer needed in latest rescue disk)

Code: Select all

[root@b3-install ~]# modprobe m25p80
Format SWAP:

Code: Select all

[root@b3-install /]# mkswap /dev/md2
Setting up swapspace version 1, size = 1024 MiB (1073672192 bytes)
no label, UUID=9dd00830-616f-4284-8f52-61a34a12355e
Format and mount /:

Code: Select all

[root@b3-install ~]# mkfs.ext4 -q -L "B3 Root" /dev/md1
[root@b3-install ~]# tune2fs -c0 -i0 /dev/md1
tune2fs 1.43.4 (31-Jan-2017)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
[root@b3-install ~]# mkdir /mnt/b3
[root@b3-install ~]# mount /dev/md1 /mnt/b3
Format and mount /boot:

Code: Select all

[root@b3-install ~]# mkfs.ext3 -q -L "B3 Boot" /dev/md0
[root@b3-install ~]# tune2fs -c0 -i0 /dev/md0
tune2fs 1.43.4 (31-Jan-2017)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
[root@b3-install ~]# mkdir /mnt/b3/boot
[root@b3-install ~]# mount /dev/md0 /mnt/b3/boot
Format and mount /home

Code: Select all

[root@b3-install ~]# mkfs.ext4 -q -L "B3 Home" /dev/md3
[root@b3-install ~]# tune2fs -c0 -i0 /dev/md3
tune2fs 1.43.4 (31-Jan-2017)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
[root@b3-install ~]# mkdir /mnt/b3/home
[root@b3-install ~]# mount /dev/md3 /mnt/b3/home
Install OS:

Code: Select all

[root@b3-install ~]# cd /mnt/usb/install/stretch
[root@b3-install stretch]# tar -xf b3-stretch-1.0-20170703-2130.txz -C /mnt/b3
Edit fstab

Code: Select all

[root@b3-install stretch]# cd /mnt/b3/etc/
[root@b3-install etc]# cp fstab fstab_ORIG
[root@b3-install etc]# vi fstab
[root@b3-install etc]# cat fstab
/dev/md0        /boot   ext3    noatime,defaults        0       2
/dev/md1        /       ext4    noatime,defaults        0       1
/dev/md3        /home   ext4    defaults                0       2
Edit cosmetical error in fw_env.config

Code: Select all

[root@b3-install etc]# cp fw_env.config fw_env.config_ORIG
[root@b3-install etc]# vi fw_env.config
[root@b3-install etc]# cat fw_env.config
# MTD definition for Bubba|3
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
/dev/mtd1               0x000000        0x010000        0x010000
Create symlink

Code: Select all

[root@b3-install etc]# cd ../boot/
[root@b3-install boot]# ln -s . /mnt/b3/boot/boot
[root@b3-install boot]# ls -l
-rw-r--r--    1 root     root       1611632 Jul  3  2017 System.map-4.9.35-1
lrwxrwxrwx    1 root     root             1 Mar 27 05:06 boot -> .
-rw-r--r--    1 root     root        104279 Jul  3  2017 config-4.9.35-1
-rw-r--r--    1 root     root       3800474 Jul  3  2017 uImage
Set uBoot variable to point to correct /root Raid partition

Code: Select all

[root@b3-install boot]# fw_setenv sataroot /dev/md1
[root@b3-install boot]# fw_printenv sataroot
sataroot=/dev/md1
Big red WARNING: Don't mess up your uBoot, this is at your own risk!! If you get CRC Errors do not reboot before fixing it!! fw_printenv should give a detailed list about uBoot content, looking like this:

Code: Select all

[root@b3-install boot]# fw_printenv
bootdelay=1
baudrate=115200
preboot=
loadaddr=0x800000
console=ttyS0
bootfile=uImage
flashfile=u-boot.kwb
installfile=install.itb

**SNIP**

button=0
bootcmd=run sataboot || reset
ethact=egiga0
ethaddr=00:22:02:00:1f:02
eth1addr=00:22:02:00:1f:03
serial#=5067
key=RwvQ3pqpmUdIO/yssGQMeP8DulA=
sataroot=/dev/md1
If everything is ok, reboot:

Code: Select all

[root@b3-install boot]reboot
Login as excito/excito:

Code: Select all

login as: excito
excito@abc.def.uvw.xyz's password:
Linux b3 4.9.35-1 #1 Mon Jul 3 14:51:11 EDT 2017 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
excito@b3:~$
Thx to MouettE and Gordon for the support!

Hope this helps someone!
ahoff
Posts: 105
Joined: 01 Apr 2008, 20:50
Location: Swe

Re: Upgrade from RAID-enabled squeeze to stretch

Post by ahoff »

It would be nice to have that in the wiki
Åke Hoff
Örskogen
Sweden
pompopom
Posts: 50
Joined: 13 Dec 2012, 16:45

Re: Upgrade from RAID-enabled squeeze to stretch

Post by pompopom »

ahoff wrote: 28 Mar 2018, 16:20 It would be nice to have that in the wiki
That page was started few years ago due to this topic:
http://forum.excito.com/viewtopic.php?f ... =15#p22244
Don't know why it never made to the WiKi, I guess lack of time is one of them, but there's plenty of info to gather around the forum to do the trick. And personally I prefer up to date info here in the forum, then WiKi pages that get outdated.
by the way:
To finalize the setup you still need to partition the eSata disk and add it to the RAID.
Post Reply