Cloning TrueNAS boot SSD to new SSD, boot on new SSD.

Kasazn

Explorer
Joined
Apr 17, 2021
Messages
60
I was wondering what is the best software or ways to use to clone my existing boot pool (a M.2 SATA3 SSD) to a new one and boot it off the new one.

I have both Linux and Windows system ready for anything.

Reason for doing this is there's report of the SSD boot pool is degraded from last year already but I have been brushing it off. Too lazy to setup a new system from scratch. I plan to clone the SSD to a new one on the next opportunity when I shutdown my TrueNAS SCALE machine for dusting/cleaning/repasting and also if budgeting allows.
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Why would you waste your time with that? (and risk ending up with a mismatched ashift)

Install a fresh TrueNAS and restore your config on it.
 

Kasazn

Explorer
Joined
Apr 17, 2021
Messages
60
I have no knowledge on mismatched ashift. Thanks for the heads up. I'm just going to constantly backup my configurations to my secure storage and if one day it fails, I'll just stick one new m.2 SSD and reinstall from scratch.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I have no knowledge on mismatched ashift.
FYI, this is what it looks like:

Code:
  pool: freenas-boot
 state: ONLINE
status: One or more devices are configured to use a non-native block size.
    Expect reduced performance.
action: Replace affected devices with devices that support the
    configured block size, or migrate data to a properly configured
    pool.
  scan: scrub repaired 0B in 00:00:18 with 0 errors on Fri Feb 25 03:45:18 2022
config:

    NAME          STATE     READ WRITE CKSUM
    freenas-boot  ONLINE       0     0     0
      ada2p2      ONLINE       0     0     0  block size: 512B configured, 4096B native


You can create that situation by either mirroring an SSD together with a USB stick with a different ashift (native block size) and then removing the USB stick... or by using another direct disk copy like dd to transfer it over.

Building fresh to the new media and restoring the config avoids (and/or corrects) the problem.
 

rogal

Cadet
Joined
Nov 10, 2022
Messages
5
Did someone actually tried and succeed cloning a boot drive? I know how to restore a config on a fresh install, but it's not possible in my case, so plese don't call me an idiot or suggest fresh install and restore of config file.

I've made a TrueNAS Scale instance for my father (who lives abroad) on his old laptop, so I used an old 120GB HDD connected via USB port and use it as a boot drive. Yesterday my father said that it makes a clicking noise, so I suspect this HDD is faulty and will die anythime soon. The other drive with data is 2TB SSD, so it can't be this one and for those worring about redundancy: there's an rsync set to backup the most important data to my cloud, so I follow 3:2:1 backup rule here and that's more than enough to protect this data. Anyway, my father is not capable to assist me to install new instance on another drive, but he can disconnect that HDD and plug into his PC where I can establish an RDP connection and clone this drive into another (in fact my father has another, exactly the same HDD in USB enclosure). I just want to confirm if that's possible (and eventually some info if it's different to a standard HDD clonning process), so I don't waste my and my father's time.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
@rogal - Your use case is way beyond what TrueNAS was designed to do.

The simplest way is to have the replacement drive plugged into the laptop. Then partition it similar to the old drive, making sure that the boot-pool partition is exactly the same size as the old, or larger. Then Mirror the old drive to the new drive. When done, remove the old drive from the Mirror set and remove the drive.

That assumes the old drive has not yet failed. In theory, you can leave the old drive in place until it fails completely.

And their are gotchas, which might include swap space on the old boot drive, which would have to be migrated over. Or that the NAS laptop might not have a free USB port. Or enough power on the USB port for 2 external drives.

All that should be doable from the command line while SSHed into the NAS laptop.
 

rogal

Cadet
Joined
Nov 10, 2022
Messages
5
The simplest way is to have the replacement drive plugged into the laptop. Then partition it similar to the old drive, making sure that the boot-pool partition is exactly the same size as the old, or larger. Then Mirror the old drive to the new drive. When done, remove the old drive from the Mirror set and remove the drive.
@Arwen , do you mean to connect new HDD to that TrueNAS machine (the laptop) and make a mirror copy via TrueNAS interface? I didn't think of it, but that actually should work. Now I remember I saw that method somewhere in documentation.

@rogal - Your use case is way beyond what TrueNAS was designed to do.
I don't think this comment was relevant and necessary, but I knew someone is going to say that. The fact something was designed for a particular puprose doesn't mean it can't be used for something else or in a different way. TNT meant to be used as a yellow dye, Listerine was a floor cleaner and Coca-Cola was created as a way to counter morphine addiction! If internet was only being used for what it was designed for then you wouldn't be able to use a TrueNAS or even write that comment. Sorry for being harsh, but I noticed too many people on this forum acting like this and I saw too many other good forums turning down by such people. I miss old good days when we all knew what a NETIQUETTE is.

Thanks for response regardless.
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Did someone actually tried and succeed cloning a boot drive? I know how to restore a config on a fresh install, but it's not possible in my case, so plese don't call me an idiot or suggest fresh install and restore of config file.
Disclaimer: I have never done this with actual physical disks and only with VM disks and Zvols, but you can probably do
Code:
dd if=/dev/<your_source_drive> of=/dev/<your_destination_drive>


Note that this is a highly destructive command so make ABSOLUTELY sure that you got the right devices in if (source) and of (destination) arguments.
 

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
@Arwen , do you mean to connect new HDD to that TrueNAS machine (the laptop) and make a mirror copy via TrueNAS interface? I didn't think of it, but that actually should work. Now I remember I saw that method somewhere in documentation.
Yes, I meant to connect new HDD to that TrueNAS machine (the laptop) and make a mirror copy via TrueNAS interface.

Do you have access to the GUI?

As a remote device, I assumed you did not have access to the GUI and would have to use SSH. But, if you have the GUI, you can use it to mirror your boot-pool device.

I don't think this comment was relevant and necessary, but I knew someone is going to say that. The fact something was designed for a particular puprose doesn't mean it can't be used for something else or in a different way. TNT meant to be used as a yellow dye, Listerine was a floor cleaner and Coca-Cola was created as a way to counter morphine addiction! If internet was only being used for what it was designed for then you wouldn't be able to use a TrueNAS or even write that comment. Sorry for being harsh, but I noticed too many people on this forum acting like this and I saw too many other good forums turning down by such people. I miss old good days when we all knew what a NETIQUETTE is.
...
What I meant was that their could be lots of gotchas that I did not include.

Yes, you can run TrueNAS on many types of hardware that are not suitable. And it may run just fine. It's these failure modes that start to introduce the possibility of data loss. Most long time TrueNAS users are data loss adverse, and we want others to not experience data loss either.


The suggestion by @Whattteva may work, as long as the TrueNAS is shutdown gracefully. Meaning the boot-pool is not in use. You can NOT copy a live ZFS pool, it likely would have a tiny bit of corruption preventing its use. Also, the "dd" copy might still not work due to device serial number.
 

rogal

Cadet
Joined
Nov 10, 2022
Messages
5
Yes, I meant to connect new HDD to that TrueNAS machine (the laptop) and make a mirror copy via TrueNAS interface.

Do you have access to the GUI?

As a remote device, I assumed you did not have access to the GUI and would have to use SSH. But, if you have the GUI, you can use it to mirror your boot-pool device.
I don't have a remote access to GUI, but I'm able to connect via RDP to one of computers on the same LAN as TrueNAS in subject, so I can access TrueNAS' GUI that way.

What I meant was that their could be lots of gotchas that I did not include.

Yes, you can run TrueNAS on many types of hardware that are not suitable. And it may run just fine. It's these failure modes that start to introduce the possibility of data loss. Most long time TrueNAS users are data loss adverse, and we want others to not experience data loss either.
Thanks for care, but I don't like when someone, who doesn't know me, thinks upfront that I'm stupid or not capable to care for myself and even if I was there's not much you could do about it my friend. I've mentioned I follow a 3:2:1 backup rule (data on a local machine, 1 backup on TrueNAS and TrueNAS being backed up to remote location in a cloud), so I'm well prepared to lose that TrueNAS server if something goes wrong.
 

saebaryo

Dabbler
Joined
Jun 2, 2023
Messages
45
Hi everyone,

Maybe there is a way to shrink the ZFS boot drive to smaller size then clone to a smaller SSD?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
No, but you can just reinstall to a new boot device and upload the config.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Would that backup apps as well?
In the sense that your apps don't actually live on your boot-pool... but references to them from the system are part of the config that is backed-up, so if you restore the config and the data pool with the apps on it is still there, all is well in the land of apps.
 

saebaryo

Dabbler
Joined
Jun 2, 2023
Messages
45
In the sense that your apps don't actually live on your boot-pool... but references to them from the system are part of the config that is backed-up, so if you restore the config and the data pool with the apps on it is still there, all is well in the land of apps.
Awesome thanks a lot!!
 
Top