seltz
Dabbler
- Joined
- Dec 15, 2015
- Messages
- 28
Out of curiosity, I'm trying to see if it's possible to copy of my freenas boot partition (currently on an ssd) onto a smaller usb drive then boot off it but ran into issues when booting (see results below) - any idea? I realize this isn't a normal use case and the general recommendation is to do mirroring.
Here's my process :
#usb drive - wipe contents
gpart destroy -F /dev/da0
#usb drive - setup gpt partitioning scheme
gpart create -s gpt da0
#usb drive - setup boot partition
gpart add -b 40 -s 512k -t freebsd-boot da1
#usb drive - add boot partition
gpart add -t freebsd-zfs -l root da0
# usb drive: embed bootstrap code in partion scheme metadata
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
#so now da0p1 has the bootcode, da0p2 has open space for root
# First attempt to just to do a mirror, you quickly
# realize you can’t do it with a small usb drive
# zpool attach freenas-boot /dev/ada0p2 /dev/da0p2
# > cannot attach /dev/da0p2 to /dev/ada0p2: device is too small
# So let’s try sending a snapshot
#usb drive: create zpool
zpool create freenas-boot2 /dev/da0p2
#current boot drive: create snapshot
zfs snapshot freenas-boot/ROOT@migrate
#current boot drive -> usb drive:
zfs send -R freenas-boot@migrate | zfs recv -Fdu freenas-boot2
zpool list #notice the other drive has copied contents now
Attempt to reboot, and boot off the flash drive instead.
I have tried rebooting (back on the regular ssd) and observing that the usb drive seems to be having some space occupied:
freenas-boot 95.5G 1.01G 94.5G - - 0% 1% 1.00x ONLINE -
freenas-boot2 7G 1.27G 5.73G - - 0% 18% 1.00x ONLINE -
Though after trying to mount (not sure I should be doing this) the filesystem it's empty. Did I mess up in sending the snapshot? I'm Assuming snapshots can be sent while the source volume is mounted.
Here's my process :
#usb drive - wipe contents
gpart destroy -F /dev/da0
#usb drive - setup gpt partitioning scheme
gpart create -s gpt da0
#usb drive - setup boot partition
gpart add -b 40 -s 512k -t freebsd-boot da1
#usb drive - add boot partition
gpart add -t freebsd-zfs -l root da0
# usb drive: embed bootstrap code in partion scheme metadata
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
#so now da0p1 has the bootcode, da0p2 has open space for root
# First attempt to just to do a mirror, you quickly
# realize you can’t do it with a small usb drive
# zpool attach freenas-boot /dev/ada0p2 /dev/da0p2
# > cannot attach /dev/da0p2 to /dev/ada0p2: device is too small
# So let’s try sending a snapshot
#usb drive: create zpool
zpool create freenas-boot2 /dev/da0p2
#current boot drive: create snapshot
zfs snapshot freenas-boot/ROOT@migrate
#current boot drive -> usb drive:
zfs send -R freenas-boot@migrate | zfs recv -Fdu freenas-boot2
zpool list #notice the other drive has copied contents now
Attempt to reboot, and boot off the flash drive instead.
I have tried rebooting (back on the regular ssd) and observing that the usb drive seems to be having some space occupied:
freenas-boot 95.5G 1.01G 94.5G - - 0% 1% 1.00x ONLINE -
freenas-boot2 7G 1.27G 5.73G - - 0% 18% 1.00x ONLINE -
Though after trying to mount (not sure I should be doing this) the filesystem it's empty. Did I mess up in sending the snapshot? I'm Assuming snapshots can be sent while the source volume is mounted.