Debian Upgrade Stretch Recovery

Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.

  --- Logical volume ---
  LV Path                /dev/root/root
  LV Name                root
  VG Name                root
  LV UUID                nkXZRD-8UvY-UKTl-2vWM-PFFw-5rV6-YB8oYj
  LV Write Access        read/write
  LV Creation host, time storage, 2014-09-06 19:25:55 -0300
  LV Status              available
  # open                 1
  LV Size                19.99 GiB
  Current LE             5118
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0
  --- Logical volume ---
  LV Path                /dev/56caed24_vg/lv45fbc66a
  LV Name                lv45fbc66a
  VG Name                56caed24_vg
  LV UUID                RWdbRM-93i4-Ru3A-Tkg7-JtNp-wfWT-dqKo8g
  LV Write Access        read/write
  LV Creation host, time , 
  LV Status              NOT available
  LV Size                2.71 TiB
  Current LE             710274
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto

cat /etc/fstab
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/root-root /               ext4    errors=remount-ro,noatime 0       1
/dev/mapper/56caed24_vg-lv45fbc66a /srv xfs defaults,noatime    1       1
#/srv/swapfile        swap            swap    defaults        0 0
/srv/swapfile    none    swap    sw    0   0

cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] 
md1 : active raid1 sdb2[2]
      2909285488 blocks super 1.0 [2/1] [_U]
md2 : active raid1 sdb1[2]
      20964416 blocks super 1.2 [2/1] [_U]
unused devices: <none>

vgscan --mknodes -v
    Wiping cache of LVM-capable devices
    Wiping internal VG cache
  Reading volume groups from cache.
  Found volume group "root" using metadata type lvm2
  Found volume group "56caed24_vg" using metadata type lvm2

vgchange -a y 56caed24_vg
  1 logical volume(s) in volume group "56caed24_vg" now active
root@storage:~# [ 1572.313581] XFS (dm-1): Mounting V4 Filesystem
[ 1572.494146] XFS (dm-1): Ending clean mount

ls /dev/mapper

ls /dev/dm-*

Filesystem                          1K-blocks       Used  Available Use% Mounted on
udev                                    10240          0      10240   0% /dev
tmpfs                                   50324        852      49472   2% /run
/dev/dm-0                            20503164   10793116    8645500  56% /
tmpfs                                  125800          0     125800   0% /dev/shm
tmpfs                                    5120          0       5120   0% /run/lock
tmpfs                                  125800          0     125800   0% /sys/fs/cgroup
/dev/mapper/56caed24_vg-lv45fbc66a 2909151232 1456469152 1452682080  51% /srv

cat /etc/initramfs-tools/modules
# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
# Syntax:  module_name [args ...]
# You must run update-initramfs(8) to effect this change.
# Examples:


uname -r

mv /boot/zImage+dtb-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/
mv /boot/uImage+dtb-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/
mv /boot/initrd.img-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/
mv /boot/uInitrd-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/
mv /boot/config-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/
mv /boot/ /boot/old/
mv /boot/vmlinuz-4.8.7-kirkwood-iomega-ix2-200-arvati1 /boot/old/

apt install linux-image-kirkwood
update-initramfs: Generating /boot/initrd.img-4.9.0-3-marvell
# should not be necessary =>>>> INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -t -k "4.9.0-3-marvell" "-b /boot"

cat "/boot/vmlinuz-4.9.0-3-marvell" "/usr/lib/linux-image-4.9.0-3-marvell/kirkwood-iomega_ix2_200.dtb" > "/boot/zImage+dtb-4.9.0-3-marvell"

mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux+dtb-4.9.0-3-marvell -d "/boot/zImage+dtb-4.9.0-3-marvell" "/boot/uImage+dtb-4.9.0-3-marvell"

mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d "/boot/initrd.img-4.9.0-3-marvell" "/boot/uInitrd-4.9.0-3-marvell"

rm -f "/boot/uInitrd.old" "/boot/uImage+dtb.old"
mv "/boot/uInitrd" "/boot/uInitrd.old"
mv "/boot/uImage+dtb" "/boot/uImage+dtb.old"
ln -s "/boot/uInitrd-4.9.0-3-marvell" "/boot/uInitrd"
ln -s "/boot/uImage+dtb-4.9.0-3-marvell" "/boot/uImage+dtb"

scp root@*-4.9.0-3-marvell /var/lib/tftpboot/ 
scp root@ /var/lib/tftpboot/kirkwood-iomega_ix2_200.dtb.original-4.9.0-3-marvell

screen /dev/ttyUSB0 115200

setenv bootargs_console 'console=ttyS0,115200n8 mtdparts=orion_nand:0x100000@0x000000(uboot)ro,0x20000@0xA0000(env)ro,0x300000@0x100000(uImage),0x1C00000@0x400000(rootfs) root=/dev/mapper/root-root'
setenv bootargs $(bootargs_console) 
setenv serverip 
setenv ipaddr 
tftpboot 0x01100000 uInitrd-4.9.0-3-marvell
tftpboot 0x00800000 uImage+dtb-4.9.0-3-marvell
bootm 0x00800000 0x01100000

cat /proc/mtd | grep uImage
mtd2: 00300000 00004000 "uImage"

flash_eraseall /dev/mtd2
nandwrite -p /dev/mtd2 "/boot/uImage+dtb-4.9.0-3-marvell"

cat /proc/mtd | grep rootfs
mtd3: 01c00000 00004000 "rootfs"

flash_eraseall /dev/mtd3
nandwrite -p /dev/mtd3 "/boot/uInitrd-4.9.0-3-marvell"

setenv mtdids 'nand0=orion_nand' 
setenv mtdparts 'mtdparts=orion_nand:0x100000@0x000000(uboot)ro,0x20000@0xA0000(env)ro,0x300000@0x100000(uImage),0x1C00000@0x400000(rootfs)' 
setenv bootargs_console 'console=ttyS0,115200n8 $(mtdparts) root=/dev/mapper/root-root'
setenv bootcmd 'setenv bootargs $(bootargs_console); nand read 0x800000 uImage; nand read 0x1100000 rootfs; bootm 0x00800000 0x01100000' 

apt install cloud-initramfs-rescuevol
This package adds functionality to an initramfs built by initramfs-tools. When installed the initramfs will check to see if any partitions with a label of 'RESCUE_VOL' are attached. If such a volume is attached, it will boot off that volume rather than the root volume

service ssh start