NVMe clone

Jetpack4.6.1 has been stored in a 128gb SSD. How to back up and restore to a 120gb SSD? Thank you very much!
请教一个问题,Jetpack4.6.1的系统刷到了128G固态硬盘中,如何备份和还原到120G固态硬盘中,非常感谢!

Can you put the NVMe on a Linux desktop PC? If so, then that is the easiest way to do this. For the example I will pretend the PC’s NVMe is “/dev/nvme1”, and that your local PC’s filesystem has lots of spare disk space (significantly more than the size of the NVMe). In that case backup could be:
sudo dd if=/dev/nvme1 of=backup.img bs=1MiB
(the bs=1MiB is not needed, it just speeds up the backup)

If later on you have a new NVMe on the PC, and if the new NVMe is /dev/nvme1, then restore would be:
sudo dd if=backup.img of=/dev/nvme1 bs=1MiB

In all cases make sure no partitions are mounted before any backup or restore. The operating system will probably automount some partition, which you want to avoid.

Backing up from a running system is more complicated since files may change in the middle of backup.

You could back up just the rootfs in many cases, and it wouldn’t be unusual for the NVMe to have just a rootfs partition. In that case you’d name the rootfs/APP partition instead of the disk as a whole. For example, the rootfs might be “/dev/nvme1p1” instead of “/dev/nvme1”.

Thank you very much for your reply! By the way, can a system from a large SSD be restored to a smaller SSD?

---- 回复的原邮件 ----

发件人 linuxdev via NVIDIA Developer Forumsnvidia@discoursemail.com
日期 2022年04月24日 22:28
收件人 chen173022@163.comchen173022@163.com
抄送至
主题 Re: [NVIDIA Developer Forums] [Jetson & Embedded Systems/Jetson Xavier NX] NVMe clone
linuxdev Top Contributor
April 24

Can you put the NVMe on a Linux desktop PC? If so, then that is the easiest way to do this. For the example I will pretend the PC’s NVMe is “/dev/nvme1”, and that your local PC’s filesystem has lots of spare disk space (significantly more than the size of the NVMe). In that case backup could be:
sudo dd if=/dev/nvme1 of=backup.img bs=1MiB
(the bs=1MiB is not needed, it just speeds up the backup)

If later on you have a new NVMe on the PC, and if the new NVMe is /dev/nvme1, then restore would be:
sudo dd if=backup.img of=/dev/nvme1 bs=1MiB

In all cases make sure no partitions are mounted before any backup or restore. The operating system will probably automount some partition, which you want to avoid.

Backing up from a running system is more complicated since files may change in the middle of backup.

You could back up just the rootfs in many cases, and it wouldn’t be unusual for the NVMe to have just a rootfs partition. In that case you’d name the rootfs/APP partition instead of the disk as a whole. For example, the rootfs might be “/dev/nvme1p1” instead of “/dev/nvme1”.

A dd image can be loopback mounted, and then rsync used to copy to a smaller partition. The loopback device makes the binary image work just like a disk drive. Then rsync correctly copies files (including device special files, pipes, so on) correctly (cp tends to not always do this correctly).

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