Restoring riscv64 machine using a full backup

I have a cluster of riscv machines (LicheePI 4A) whom I want to back up in case something goes terribly wrong and I need to restore them up from scratch but keeping changes made. I am using a hard drive connected to one of the machines (let’s call this machine backup_machine).

Since we are porting some libraries and applications to riscv, we are making changes kernel modules and so this one and everything it calls must be backed up as well.

Referring to Arch docs ( since I didn’t manage to find better ways of doing so) I am using rsync to back up all non-boot-generated directories. Clonzilla is not an option since I would have to back up the files from an x86 machine and for now I don’t want to do so.

Arch’s docs:

rsync -aAXHSv --exclude='/dev/*' --exclude='/proc/*' --exclude='/sys/*' --exclude='/tmp/*' --exclude='/run/*' --exclude='/mnt/*' --exclude='/media/*' --exclude='/lost+found/' / /path/to/backup

Mine (as a difference I am using incremental backup and ssh to back up files through the network):

rsync -aAXHvv -e ssh 
        --rsync-path="sudo rsync" 
            --link-dest='${latest_link_path}' 
            --exclude='/dev/*' 
        --exclude='/media/*' 
        --exclude='/run/*' 
        --exclude='/mnt/*' 
            --exclude='/proc/*' 
            --exclude='/sys/*' 
            --exclude='/tmp/*' 
            --exclude='/lost+found/' 
            sipeed@${node}:$dir_to_back_up 
            $backup_node_dir

Backups are working correctly at the scheduled time (using cronjob).

What I want:Now I want to be able to restore a machine in case it completely dies using these backups. That is, building a new bootable image that I can flash into the board.

SIMPLE SOLUTION: flashing the board with an ubuntu and then rsync the backup files and directories. but I’d prefer having the bootable image.

PD: I provide the links to the scripts I made below

To build this image I need u-boot.bin, OpenSBI firmware (build using u-boot.bin), the Kernel Image (I have to use the one in the backup since it has custom modifications), and an ext4 filesystem (using the backup files).

I am testing this setup on qemu before getting my hands dirty on the board. This is what I do:

  1. I create an ext4 filesystem using the script (linked to my github). Since the firmware, kernel and bootloader are provided to qemu, they don’t have to be on a boot partition in the disk image. When flashing the board, I’ll build a complete disk image with 2 partitions (boot, containing kernel, bootloader and firmware and rootfs).

  2. I launch qemu using the following command:

qemu-system-riscv64 -M virt -m 2G -nographic 
                -bios ~/restore/fw_jump.bin 
            -kernel ~/restore/Image 
            -drive file=rootfs.ext4,format=raw,id=hd0 
            -device virtio-blk-device,drive=hd0 
            -append "root=/dev/vda rw console=ttyS0"

Here comes the issue. After this, the system boots up, it correctly jumpts to the address 0x080200000 and loads the kernel. The kernel starts running processes (some of them fail to start up) until I get the message:

root account is locked

and here I can only go through the whole boot process again, no input option is given.

What I think is going on: rsync doesn’t have the necessary privileges to copy essential files needed by the kernel and root (because -A copies access lists and H copies hard links, so that should be aight). I’ve been looking into various full backup options but most already use rsync, and dd is out of the equation.

More information: I didn’t test it on the board yet, since on qemu is still not working. When using qemu, I build u-boot and OpenSBI firmware following qemu’s documentation. When building for the board I’ll build using the board’s documentation.

BACKUP SCRIPT: https://github.com/guillemsenabre/ScriptsSh/blob/main/Snapshots/incr_backup.sh

EXT4 CREATION SCRIPT: https://github.com/guillemsenabre/ScriptsSh/blob/main/filesystem/create_ext4.sh

Thanks in advance! Any help, criticism or advice is suuper welcomed!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật