# How to Boot from NVMe SSD?

**URL:** https://forums.developer.nvidia.com/t/how-to-boot-from-nvme-ssd/65147
**Category:** Jetson AGX Xavier
**Tags:** nvme, boot
**Created:** [September 16, 2018, 12:57am UTC](https://forums.developer.nvidia.com/t/how-to-boot-from-nvme-ssd/65147 "2018-09-16T00:57:39Z")
**Posts on this page:** 1
**Showing post:** 22

<div class="post-metadata">

### Author: ![crazy\_yorick](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@crazy\_yorick](https://forums.developer.nvidia.com/u/crazy_yorick)
#### Post date: [May 17, 2020, 5:00pm UTC](https://forums.developer.nvidia.com/t/how-to-boot-from-nvme-ssd/65147/22 "2020-05-17T17:00:32Z")

</div>

After reflashing to JetPack 4.4 DP I had time to play with booting from SSD again and here are some remarks. Because forum fobids sharing archives with scripts, formated text will be included.

1. I added conditional start for service on /etc/setssdroot.conf (on mmcblk0p1) availability. To mount rootfs from eMMC, file /etc/setssdroot.conf on mmcblk0p1 should be deleted.  
setssdroot.service:

> [Unit]  
> Description=Change rootfs to SSD in M.2 key M slot (nvme0n1p1)  
> DefaultDependencies=no  
> Conflicts=shutdown.target  
> After=systemd-remount-fs.service  
> Before=local-fs-pre.target local-fs.target shutdown.target  
> Wants=local-fs-pre.target  
> ConditionPathExists=/dev/nvme0n1p1  
> ConditionPathExists=/etc/setssdroot.conf  
> ConditionVirtualization=!container  
> [Service]  
> Type=oneshot  
> RemainAfterExit=yes  
> ExecStart=/sbin/setssdroot.sh  
> [Install]  
> WantedBy=default.target

1. setssdroot.service and setssdroot.sh should be on both mmcblk0p1 and nvme0n1p1 else service report error to journal, still switching rootfs.

2. At JetPack 4.4 propoused to install new kernels and modules with deb packet. One should remember, that after installation, kernel, initrd and modules to rootfs switched to SSD would be placed on /boot/\* and /lib/modules/[kernel name]/ on SSD and should manualy be copied to same folders on mmcblk0p1. Because Image and initrd, located in mmcblk0p1 /boot folder, pointed by /boot/extlinux/extlinux.conf data in mmcblk0p1, is booting with CBoot. If modules version in initrd on mmcblk0p1 and /lib/modules/[kernel name]/ on SSD will be different, modules load will be tainted.

So, step by step guid will be the following:

- Flash Xavier with rootfs on eMMC (default with SDKManager)

- Install default software, that will be needed on main (SSD) and restoration (eMMC) systems.

- Copy rootfs to SSD.

> #!/bin/bash  
> sudo mount /dev/nvme0n1p1 /mnt  
> sudo rsync -aAXv / --exclude={“/dev/_“,”/proc/_”,“/sys/_“,”/tmp/_”,“/run/_“,”/mnt/_”,“/media/\*”,“/lost+found”} /mnt

- Install service (steps 3-5 from my previous post, setssdroot.service from top of this post).

- Copy service files to SSD

> sudo cp /etc/systemd/system/setssdroot.service /mnt/etc/systemd/system/setssdroot.service  
> sudo cp /sbin/setssdroot.sh /mnt/sbin/setssdroot.sh

- Install software for restoration rootfs (on eMMC). It is possible to reboot back in this rootfs if /etc/setssdroot.conf file is absent.

- Create file /etc/setssdroot.conf

> sudo touch /etc/setssdroot.conf

- Reboot system. You will boot in new rootfs located in SSD.  
Don’t forget to synchronize /boot/ /lib/modules/ folders with eMMC when moding kernels.

When rootfs on SSD is used, /dev/mmcblk0 is unmounted, so we can backup it with dd.  
Rootfs on SDD can be safely backed after loading back into rootfs on eMMC:

> sudo mount /dev/mmcblk0p1 /mnt  
> sudo rm /mnt/etc/setssdroot.conf  
> reboot

For backups I use SSD drive connected to M.2 key E throught M.2 key E to m.2 key M adapter from aliexpress.

---

_[View the full topic](https://forums.developer.nvidia.com/t/how-to-boot-from-nvme-ssd/65147)._
