How to restore image files after replacing SSDs of different sizes

Environment: 128GB SSD, I have already backed up the image in the “tools/backup_restore/images” directory, and 128GB is not fully utilized. Below is a list of less than 100GB.

Now that I have replaced the 100G SSD, how can I restore the image based on 128G SSD backup to the 100G SSD.

Hi zhj18115188906,

Are you using the devkit or custom board for Xavier NX?
Whats your Jetpack version in use?

Have you tried to run script with restore option (-b is used for backup, -r is used for restore) for the 100GiB SSD?

128G SSD 备份的镜像(-b),还原(-r)到128G的 ssd没有问题
128G SSD备份的镜像(-b),还原(-r)到100G的 ssd有问题。还原过程中会报No space left。
由于之前用的128G SSD, 采购 换货了,现在是100G的,怎样在不重新搞一遍备份还原流程的前提下,在100G的ssd上也能还原基于128G ssd备份的镜像。

你說的沒用滿128G是可用大小沒用滿
但是GPT (GUID partition table) 裡紀錄的整塊disk的大小就是128G不會變
要重新還原也只能比較大 不能比較小

比方說你的原始備份裡有資料可能是存在硬碟物理上第100G以後的地方
還原的時候寫回一樣的地方 但是現在硬碟沒有這個地方讓你寫 當然會失敗

I’m not sure I know what space is being lost or space is being added, but sometimes you can create a blank file of the right size, cover it with loopback, and then format it as ext4. Then use rsync to copy content into that new image. However, your backup is perhaps multiple partitions which must fit together, and this might be frustrating. For example, some partitions might require being at the same offset, and you might need to hand fit the pieces of other partitions in by using offsets. The partition which is for the rootfs is kind of a special case in that it is not binary data, so it has some flexibility, but you’d still want it to be a multiple of 1024 bytes (or better yet, due to some cases, a multiple of 4096 bytes). The fact that that partition is ext4 is why rsync can work on it when covered with loopback.

It is an entire lesson just to work with dd when mixing and matching binary partitions. Consider that if you can work with just the rootfs, then it is still a bit complicated, but it isn’t nearly as difficult. If the rootfs is not only its own separate partition, but a separate file from all of those other backed up partitions, then something like gparted will work on the loopback mounted rootfs if there is room. Making room and trimming room of loopback filesystems is the part where you need a lot of disk space and time and be willing to make mistakes.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.