Install FreeBSD in external USB HDD disk with Auto-ZFS

Hello,

I'm using a laptop with a single M2 ssd disk with FreeBSD installed (auto-zfs).
Soon I will send my laptop to warranty and I'm thinking do a installation on a external USB HDD drive and import my home so I can connect to other laptop without toutching its internal disk.
Today I've boot FreeBSD in a USB pen and choosed "Auto-ZFS" but it points to my internal SSD.
Is there a way to work around this or clone internal disk to external one?

Other think, in the future I will use external disk as archive and backup using regular snapshots.

Thanks,

Nuno Teixeira
 
Yes, there is a way, it's as if you were going to make a backup of the partition. but don't rely on the external disk, to have your system fully functional. problems can appear

 
clone internal disk to external one
One method to clone the laptop disk on the USB disk is to send and receive a ZFS data stream.

For the procedure, from the laptop system, on the USB drive
  • gpart(8) create partition table, add partitions efi and/or freebsd-boot, freebsd-swap, freebsd-zfs
  • for BIOS gpart(8) bootcode
  • for UEFI newfs_msdos(8) efi partition, mount_msdosfs(8) efi partition, create directories for the efi loader, copy efi loader
  • zpool-create(8) new-pool and altroot to a temporary mount point the USB freebsd-zfs partition
  • zfs-snapshot(8) -r laptop-pool, zfs-send(8) -R laptop-pool-snapshot | zfs-receive(8) -F new-pool
  • zpool-set(8) bootfs to new-pool/dataset
  • boot USB disk system
  • zpool set cachefile=/boot/zfs/zpool.cache new-pool
  • In case the USB disk is booted from the laptop and zfs-list(8) shows both pools datasets overlayed (mounted) on the same mount points, drop to single user mode, execute zpool-export(8) -f laptop-pool.
If you have difficulties at some of the steps, please ask.

If the laptop disk and the USB disk are the same size try Argentum's mirror method.

To make the partitioning of the USB disk simple, clone it: gpart backup laptop-disk | gpart restore -F usb-disk
 
zpool set cachefile=/boot/zfs/zpool.cache new-pool

Please, is that required for anything?



For import to be automated at boot time, a value need not be set.

Code:
% lsblk da1
DEVICE         MAJ:MIN SIZE TYPE                                          LABEL MOUNT
da1              0:177 466G GPT                                               - -
  <FREE>         -:-   1.0M -                                                 - -
  da1p1          0:178 466G freebsd-zfs                           gpt/Transcend <ZFS>
% zpool get cachefile Transcend august
NAME       PROPERTY   VALUE      SOURCE
Transcend  cachefile  -          default
august     cachefile  -          default
%
 
… external USB HDD drive … boot FreeBSD in a USB pen and choosed "Auto-ZFS" but it points to my internal SSD. …

When you choose to stripe: the installer should offer a choice of devices that includes the external USB HDD.

For example, with multiple virtual devices:

stripe.png one of two devices.png

(It's misleading; the result of choosing to stripe is not a stripe.)
 
Please, is that required for anything?
It's not a requirement but to tidy up the system.

The system on the USB disk may complain about failed cache file import of the original pool because the new pool is a exact clone and in the zpool.cache is still the pool configuration information of the original pool stored. It's not harmful but the system tries to import the original pool, recreating the zpool.cache file will silence the dmesg(8) notice:
Code:
cannot import 'zroot': no such pool or dataset
        Destroy and re-create the pool from
        a backup source.
cachefile import failed, retrying
 
When you choose to stripe: the installer should offer a choice of devices that includes the external USB HDD.

For example, with multiple virtual devices:

View attachment 14207 View attachment 14208

(It's misleading; the result of choosing to stripe is not a stripe.)
Ok, nice. I will try and see if USB HDD shows up listed and try instalation.
I will show results soon.
Thanks all for helping
 
When you choose to stripe: the installer should offer a choice of devices that includes the external USB HDD.

For example, with multiple virtual devices:

View attachment 14207 View attachment 14208

(It's misleading; the result of choosing to stripe is not a stripe.)
Ok, i did it and external disk showed up as da0 and I checked it up.
After a while a warning shows up:
---
There are multiple "FreeBSD" EFI boot entries, would you like to remove them all and add a new one? (I've started smoking hard/very nervous)
<YES> <NO>
---

This is very dangerous step for me since I'm testing in my only laptop I have, but do you know what happens when choosing yes or no ? :)
 
… do you know what happens when choosing yes or no ? …

I don't know, sorry, but here's the relevant commit:


At a glance: there is, at least, use of efibootmgr(8).

Without installing, you can run efibootmgr -v to begin getting an idea of how things are.

If, during installation, you opt to not remove entries, then you can use efibootmgr later to tidy things.



Side note: are you installing STABLE or CURRENT? Just curious.
 
I don't know, sorry, but here's the relevant commit:


At a glance: there is, at least, use of efibootmgr(8).

Without installing, you can run efibootmgr -v to begin getting an idea of how things are.

If, during installation, you opt to not remove entries, then you can use efibootmgr later to tidy things.



Side note: are you installing STABLE or CURRENT? Just curious.
CURRENT as I use at my laptop
 
I have got a similar scenario but the FreeBSD itself is on external SSD with zfs filesystem. 13.2 RELEASE

I have a laptop with two SSDs. One is nvme 500GB dedicated for multiboot linux systems with grub. The other one is 2.5 inch Samsung 4TB ntfs for my datas.
I decided to install freebsd but because no more space and i did not want destroy my current filesystems I was installing freebsd with auto zfs on my external SSD. This is a brand new Samsung 2.5 inch 500GB SSD. I am using a Seagate external dock with usb 3.0. The installation went well. First bootup also no issue. Everything was fine until....
I left the latop for a while like 6-7 mins and when i come back the system has got freeze. No keyboard or mouse respond. Only hard reset could help. This is because I/O failure of my pool. "pool has encountered an uncorrectable I/O failure and has been suspended" As the SSD goes to sleep or idle. i dont really know exactly whats going on.
I was trying to disable standby with the camcontrol da0 -t 0 but does not help. usbconfig -d power_on on the dedicated usb also not fixing my issue.

Here is my hardware info (NL51RU custom build laptop)

IDE 61A is the problematic SSD.
 

Attachments

  • pic1.jpg
    pic1.jpg
    1.2 MB · Views: 60
  • pic2.jpg
    pic2.jpg
    1.2 MB · Views: 65
  • pic3.jpg
    pic3.jpg
    1.1 MB · Views: 70
I have got a similar scenario but the FreeBSD itself is on external SSD with zfs filesystem. 13.2 RELEASE

I have a laptop with two SSDs. One is nvme 500GB dedicated for multiboot linux systems with grub. The other one is 2.5 inch Samsung 4TB ntfs for my datas.
I decided to install freebsd but because no more space and i did not want destroy my current filesystems I was installing freebsd with auto zfs on my external SSD. This is a brand new Samsung 2.5 inch 500GB SSD. I am using a Seagate external dock with usb 3.0. The installation went well. First bootup also no issue. Everything was fine until....
I left the latop for a while like 6-7 mins and when i come back the system has got freeze. No keyboard or mouse respond. Only hard reset could help. This is because I/O failure of my pool. "pool has encountered an uncorrectable I/O failure and has been suspended" As the SSD goes to sleep or idle. i dont really know exactly whats going on.
I was trying to disable standby with the camcontrol da0 -t 0 but does not help. usbconfig -d power_on on the dedicated usb also not fixing my issue.

Here is my hardware info (NL51RU custom build laptop)

IDE 61A is the problematic SSD.
Im using FreeBSD 13.2 STABLE and i have the very same issue. It seems that if i dont keep something going to actually read/write to the drive, it happens. I thought, well I’ll play some music or a video, but i return after about 5 minutes and sure enough the system has crashed. At this point I’m very close to tossing the whole thing out the window.
 
Im using FreeBSD 13.2 STABLE and i have the very same issue. It seems that if i dont keep something going to actually read/write to the drive, it happens. I thought, well I’ll play some music or a video, but i return after about 5 minutes and sure enough the system has crashed. At this point I’m very close to tossing the whole thing out the window.
I hope the new release will fix this.... 13.3 i mean
 
I hope the new release will fix this.... 13.3 i mean
I made the move and purchased a second ssd drive for my system. I reinstalled and i no longer have this problem. Only occurs when runnin from an external drive. Now ive made the complete transition to FreeBSD and am working on moving things around on my external drives to reformat them ZFS and set up a back up and external storage.
 
I made the move and purchased a second ssd drive for my system. I reinstalled and i no longer have this problem. Only occurs when runnin from an external drive. Now ive made the complete transition to FreeBSD and am working on moving things around on my external drives to reformat them ZFS and set up a back up and external storage.
I have fixed it with KDE desktop environment. On KDE in power management i just did turn off suspend session on battery. It does work. You can set time limit if you want but for me turning off is fine. But without desktop environment still no clue how to fix...
 
Back
Top