HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:04AM |
Registered: 3 years ago Posts: 8 |
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:11AM |
Registered: 3 years ago Posts: 8 |
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:13AM |
Registered: 3 years ago Posts: 8 |
Marvell>> mtdparts ... #: name size offset mask_flags 0: u-boot 0x000000180000 0x000000000000 0 1: u-boot-env 0x000000020000 0x000000180000 0 2: uImage 0x000000600000 0x000000200000 0 3: minirootfs 0x000000400000 0x000000800000 0 4: ubifs 0x000007400000 0x000000c00000 0
#: name size 0: u-boot 1.5 MiB 1: u-boot-env 128 KiB 2: uImage 6.0 MiB 3: minirootfs 4.0 MiB 4: ubifs 116 MiB
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:15AM |
Registered: 3 years ago Posts: 8 |
$ unzip ReadyNASOS-6.10.5-arm.zip Archive: ReadyNASOS-6.10.5-arm.zip inflating: ReadyNASOS-6.10.5-arm.img inflating: ReadyNASOS-6.10.5_Release_Notes.html
info::name=ReadyNASOS,version=6.10.5,time=1619067981,size=77307904,md5sum=0297d035d37792977d2f6b36dd53f31f,arch=arm,descr=ReadyNASOS
$ dd if=ReadyNASOS-6.10.5-arm.img of=ReadyNASOS-6.10.5-arm.tar bs=1024 skip=16 75480+0 records in 75480+0 records out 77291520 bytes (77 MB, 74 MiB) copied, 0.152685 s, 506 MB/s
$ mkdir ReadyNASOS $ tar -C ReadyNASOS -xvf ReadyNASOS-6.10.5-arm.tar csums.md5 initrd.gz kernel kernel.alpine kernel.arm root.tlz u-boot-rn102-2.0.img u-boot-rn104-2.0.img u-boot-rn202-1.2.img u-boot-rn204-1.2.img u-boot-rn2120-2.0.img u-boot-rn25-2.0.img
$ ls -ahilp ReadyNASOS total 78M 502 drwxr-xr-x 2 XXX XXX 280 Jul 24 10:36 ./ 1 drwxrwxrwt 18 root root 520 Jul 24 10:36 ../ 503 -rw-r--r-- 1 XXX XXX 551 Apr 22 07:16 csums.md5 504 -rw-r--r-- 1 XXX XXX 3.3M Apr 22 07:16 initrd.gz 505 -rw-r--r-- 2 XXX XXX 3.4M Apr 22 07:16 kernel 506 -rw-r--r-- 1 XXX XXX 3.3M Apr 22 07:16 kernel.alpine 505 -rw-r--r-- 2 XXX XXX 3.4M Apr 22 07:16 kernel.arm 507 -rw-r--r-- 1 XXX XXX 59M Apr 22 07:16 root.tlz 508 -rw-r--r-- 1 XXX XXX 872K Apr 22 07:16 u-boot-rn102-2.0.img 509 -rw-r--r-- 1 XXX XXX 874K Apr 22 07:16 u-boot-rn104-2.0.img 510 -rw-r--r-- 1 XXX XXX 1.1M Apr 22 07:16 u-boot-rn202-1.2.img 511 -rw-r--r-- 1 XXX XXX 1.1M Apr 22 07:16 u-boot-rn204-1.2.img 512 -rw-r--r-- 1 XXX XXX 972K Apr 22 07:16 u-boot-rn2120-2.0.img 513 -rw-r--r-- 1 XXX XXX 872K Apr 22 07:16 u-boot-rn25-2.0.img
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:21AM |
Registered: 3 years ago Posts: 8 |
$ cp -v ReadyNASOS/kernel ReadyNASOS/initrd.gz /media/sdb1/ 'ReadyNASOS/kernel' -> '/media/sdb1/kernel' 'ReadyNASOS/initrd.gz' -> '/media/sdb1/initrd.gz'
Marvell>> usb start (Re)start USB... USB: Active port: 0 Register 10011 NbrPorts 1 USB EHCI 1.00 scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... 1 Storage Device(s) found Marvell>> usb tree Device Tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 100mA) USB Flash Memory 0611132321190 Marvell>> fatls usb 0:1 3479896 kernel 3427623 initrd.gz 2 file(s), 0 dir(s)
Marvell>> mtdparts device nand0 <armada-nand>, # parts = 5 #: name size offset mask_flags 0: u-boot 0x000000180000 0x000000000000 0 1: u-boot-env 0x000000020000 0x000000180000 0 2: uImage 0x000000600000 0x000000200000 0 3: minirootfs 0x000000400000 0x000000800000 0 4: ubifs 0x000007400000 0x000000c00000 0 active partition: nand0,0 - (u-boot) 0x000000180000 @ 0x000000000000 defaults: mtdids : none mtdparts: none Marvell>> nand erase uImage 0x000000600000 NAND erase: device 0 offset 0x200000, size 0x600000 Erasing at 0x7e0000 -- 100% complete. OK Marvell>> nand erase minirootfs 0x000000400000 NAND erase: device 0 offset 0x800000, size 0x400000 Erasing at 0xbe0000 -- 100% complete. OK
Marvell>> mw.b 0x2000000 0xff 0x000000600000
Marvell>> fatload usb 0:1 0x2000000 kernel reading kernel 3479896 bytes read
Marvell>> nand write.trimffs 0x2000000 uImage 0x000000600000 NAND write: device 0 offset 0x200000, size 0x600000 6291456 bytes written: OK
Marvell>> nand read 0x3000000 uImage 0x000000600000 NAND read: device 0 offset 0x200000, size 0x600000 6291456 bytes read: OK
Marvell>> cmp.b 0x2000000 0x3000000 0x000000600000 Total of 6291456 bytes were the same
Marvell>> mw.b 0x2000000 0xff 0x000000400000
Marvell>> fatload usb 0:1 0x2000000 initrd.gz reading initrd.gz 3427623 bytes read
Marvell>> nand write.trimffs 0x2000000 minirootfs 0x000000400000 NAND write: device 0 offset 0x800000, size 0x400000 4194304 bytes written: OK
Marvell>> nand read 0x3000000 minirootfs 0x000000400000 NAND read: device 0 offset 0x800000, size 0x400000 4194304 bytes read: OK
Marvell>> cmp.b 0x2000000 0x3000000 0x000000400000 Total of 4194304 bytes were the same
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:33AM |
Registered: 3 years ago Posts: 8 |
Quote
UBI (Unsorted Block Images) is an erase block management layer for flash memory devices. UBI serves two purposes, tracking NAND flash bad blocks and providing wear leveling.
Marvell>> nand erase ubifs 0x000007400000 NAND erase: device 0 offset 0xc00000, size 0x7400000 Skipping bad block at 0x07f00000 Skipping bad block at 0x07f20000 Skipping bad block at 0x07f40000 Skipping bad block at 0x07f60000 Skipping bad block at 0x07f80000 Skipping bad block at 0x07fa0000 Skipping bad block at 0x07fc0000 Skipping bad block at 0x07fe0000 OK
Marvell>> ubi part ubifs Creating 1 MTD partitions on "nand0": 0x000000c00000-0x000008000000 : "mtd=4" UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size: 126976 bytes <--- UBI: smallest flash I/O unit: 2048 <--- UBI: VID header offset: 2048 (aligned 2048) UBI: data offset: 4096 UBI: empty MTD device detected UBI: create volume table (copy #1) UBI: create volume table (copy #2) UBI: attached mtd1 to ubi0 UBI: MTD device name: "mtd=4" UBI: MTD device size: 116 MiB UBI: number of good PEBs: 920 UBI: number of bad PEBs: 8 UBI: max. allowed volumes: 128 UBI: wear-leveling threshold: 4096 UBI: number of internal volumes: 1 UBI: number of user volumes: 0 UBI: available PEBs: 907 <--- UBI: total number of reserved PEBs: 13 UBI: number of PEBs reserved for bad PEB handling: 9 UBI: max/mean erase counter: 1/0
Marvell>> ubi createvol rootfs No size specified -> Using max size (115167232) Creating dynamic volume rootfs of size 115167232 Marvell>> ubi info l UBI: volume information dump: UBI: vol_id 0 UBI: reserved_pebs 907 UBI: alignment 1 UBI: data_pad 0 UBI: vol_type 3 UBI: name_len 6 UBI: usable_leb_size 126976 UBI: used_ebs 907 UBI: used_bytes 115167232 UBI: last_eb_bytes 126976 UBI: corrupted 0 UBI: upd_marker 0 UBI: name rootfs UBI: volume information dump: UBI: vol_id 2147479551 UBI: reserved_pebs 2 UBI: alignment 1 UBI: data_pad 0 UBI: vol_type 3 UBI: name_len 13 UBI: usable_leb_size 126976 UBI: used_ebs 2 UBI: used_bytes 253952 UBI: last_eb_bytes 2 UBI: corrupted 0 UBI: upd_marker 0 UBI: name layout volume
$ /usr/sbin/mkfs.ubifs --leb-size=126976 --min-io-size=2048 --max-leb-cnt=907 --verbose --space-fixup --squash-uids --root=ReadyNASOS --output=ReadyNASOS.ubifs mkfs.ubifs root: ReadyNASOS/ min_io_size: 2048 leb_size: 126976 max_leb_cnt: 907 output: ReadyNASOS.ubifs jrn_size: 8388608 reserved: 0 compr: lzo keyhash: r5 fanout: 8 orph_lebs: 1 space_fixup: 1 selinux file: (null) super lebs: 1 master lebs: 2 log_lebs: 5 lpt_lebs: 2 orph_lebs: 1 main_lebs: 611 gc lebs: 1 index lebs: 5 leb_cnt: 622 UUID: 0B7371B4-F33E-42F8-BB9B-EDD7BAA8B874 Success!
$ ubidump -l ReadyNASOS.ubifs ==> ReadyNASOS.ubifs <== -rw-r--r-- 1 0 0 3427623 2021-04-22 05:16:56 initrd.gz -rw-r--r-- 1 0 0 3448616 2021-04-22 05:16:56 kernel.alpine -rw-r--r-- 1 0 0 1147028 2021-04-22 05:16:56 u-boot-rn202-1.2.img -rw-r--r-- 2 0 0 3479896 2021-04-22 05:16:56 kernel -rw-r--r-- 1 0 0 60950986 2021-04-22 05:16:48 root.tlz -rw-r--r-- 2 0 0 3479896 2021-04-22 05:16:56 kernel.arm -rw-r--r-- 1 0 0 551 2021-04-22 05:16:56 csums.md5 -rw-r--r-- 1 0 0 995112 2021-04-22 05:16:56 u-boot-rn2120-2.0.img -rw-r--r-- 1 0 0 894280 2021-04-22 05:16:56 u-boot-rn104-2.0.img -rw-r--r-- 1 0 0 892032 2021-04-22 05:16:56 u-boot-rn25-2.0.img -rw-r--r-- 1 0 0 1146748 2021-04-22 05:16:56 u-boot-rn204-1.2.img -rw-r--r-- 1 0 0 892696 2021-04-22 05:16:56 u-boot-rn102-2.0.img
$ printf "0x%x\n" $(stat -c "%s" ReadyNASOS.ubifs) 0x4b52000
Marvell>> usb start (Re)start USB... USB: Active port: 0 Register 10011 NbrPorts 1 USB EHCI 1.00 scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... 1 Storage Device(s) found Marvell>> usb tree Device Tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 100mA) USB Flash Memory 0611132321190 Marvell>> fatls usb 0:1 3479896 kernel 3427623 initrd.gz 78979072 readynasos.ubifs 3 file(s), 0 dir(s)
Marvell>> fatload usb 0:1 0x2000000 readynasos.ubifs reading readynasos.ubifs 78979072 bytes read
Marvell>> ubi writevol 0x2000000 rootfs 0x4B52000 78979072 bytes written to volume rootfs
Marvell>> ubifsmount rootfs UBIFS: mounted UBI device 0, volume 0, name "rootfs" UBIFS: mounted read-only UBIFS: file system size: 113770496 bytes (111104 KiB, 108 MiB, 896 LEBs) UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: LZO UBIFS: reserved for root: 0 bytes (0 KiB) Marvell>> ubifsls 3427623 Thu Apr 22 05:16:56 2021 initrd.gz 3448616 Thu Apr 22 05:16:56 2021 kernel.alpine 1147028 Thu Apr 22 05:16:56 2021 u-boot-rn202-1.2.img 3479896 Thu Apr 22 05:16:56 2021 kernel 60950986 Thu Apr 22 05:16:48 2021 root.tlz 3479896 Thu Apr 22 05:16:56 2021 kernel.arm 551 Thu Apr 22 05:16:56 2021 csums.md5 995112 Thu Apr 22 05:16:56 2021 u-boot-rn2120-2.0.img 894280 Thu Apr 22 05:16:56 2021 u-boot-rn104-2.0.img 892032 Thu Apr 22 05:16:56 2021 u-boot-rn25-2.0.img 1146748 Thu Apr 22 05:16:56 2021 u-boot-rn204-1.2.img 892696 Thu Apr 22 05:16:56 2021 u-boot-rn102-2.0.img
Marvell>> ubifsumount Unmounting UBIFS volume rootfs!
Marvell>> printenv bootargs bootargs=console=ttyS0,115200 Marvell>> printenv bootcmd bootcmd=nand read 0x2000000 0x200000 0x600000; nand read 0x3000000 0x800000 0x400000; bootm 0x2000000 0x3000000 0x1000000 Marvell>> printenv mtdparts mtdparts=mtdparts=armada-nand:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),0x600000@0x200000(uImage),0x400000@0x800000(minirootfs),-(ubifs)
Marvell>> reset resetting ...
Starting the boot process... Detected system type: RN102 Loading kernel modules...done Boot mode: Normal UBI device number 0, total 920 LEBs (116817920 bytes, 111.4 MiB), available 9 LEBs (1142784 bytes, 1.1 MiB), LEB size 126976 bytes (124.0 KiB)
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 26, 2021 07:34AM |
Registered: 3 years ago Posts: 8 |
Re: HOWTO: Restore a ReadyNAS 102/104 to original state July 29, 2021 04:44AM |
Admin Registered: 13 years ago Posts: 18,997 |