Other Using bhyve and CentOS to run LTFS for HP LTO5+ tape devices

A small Christmas gift to community... ;)

This issue was pissing me off since forever, had HP Ultrium 3000 LTO5 drive in FreeBSD server and wasn't able to run LTFS as HP guys only helped author add support for HP tape devices to Linux code and no one took care of FreeBSD. Probably shouldnt be hard to copy scsi commands from linux implementation to FreeBSD but I have lost enough time on ltfs already.

I have pci passtrough whole HBA, if someone figures out how to only passtrough one port it would be very helpful.

Most commands must be executed as root on FreeBSD and CentOS:

Requirements:
VT-d capable CPU ( `acpidump -t | grep DMAR`, if nothing is displayed it is either turned off in BIOS or CPU doesn't support it)
PCI-Express SAS HBA, if you are using some other HBA, it should probably work but you will have to adapt a bit when masking pci from FreeBSD and attaching it to bhyve os

Probably not a necessary step and you can skip it, but since LTOs are typically behind "support-walls" and the devices are getting old, it isnt a bad idea to do while it is still hosted - updating firmware to the latest:
Code:
# download  https://downloads.hpe.com/pub/softlib2/software1/sc-windows/p368283668/v124587/cp031432.exe
unzip cp031432.exe
# check fwimage/firmware.cfg, find firmware for your drive. In same directory are firmwares with .E extension. Use correct one.
pkg install sg3_utils
sg_write_buffer -b 4k -I <firmware>.E -m 4 /dev/sa0
sg_write_buffer -m 5 /dev/sa0
# shutdown and power-off (!!! dont just reboot it) the computer to clean SCSI reservation on tape device or you will suffer later.

Follow first part of pci_passtrough (to, excluding, 5.) to hide your HBA from FreeBSD at boot time:
(!!!) necessary to add vmm_enable="YES" to /boot/loader.conf , dont skip it or... you will suffer later
(!!!) note "Additional notes" (thank you author for making it so obvious =/ ) that are saying:
Code:
The "-S" option must be passed to both bhyveload(8) and bhyve(8) to wire guest memory.

Reboot your computer.

Not using CBSD
Create a bhyve vm, you are on your own here if you dont use cbsd, then follow the the pci_passtrough manual from 5. to the end. Dont forget about "Additional Notes", you need to turn on option -S

CBSD:
Run cbsd bconstruct-tui and fill in settings for your vm:
Code:
vm_os_type=linux
vm_os_profile= cloud-CentOS-stream-8-x86_64 for
cloud_init_options, set ci_user_pw_user for centos user login later
bhyve_options and [x] the option saying: bhyve_wire_memory, it is a must(!!!)
bhyve_vnc_options set up vnc, for password avoid non alphanumeric characters, some like $ and # might not be accepted later when you try to login

After you create vm, follow this:

When you run command `cbsd bhyve-ppt mode=list`, you must see a section "Configured PCI Passthru devices" in output and your should see your masked PCI there.

If it is not there, re-read pci_passtrough manual. You missed something. For instance rebooting the system.

If you see it, attach it to the centos vm (`cbsd bhyve-ppt mode=attach jname=<vm name>` ppt=<x/x/x>) and launch it using `cbsd blaunch <vm name>`

Connect to centos using tigervnc (it MUST be tigervnc!!!), login using user: centos and password you have set into ci_user_pw_user.

Update the system, set up network if not working,...

Check if you see your tape device using `cat /proc/scsi/scsi`, your tape should be visible.

Code:
#please correct me here if I have missed or added a devel version too many
dnf install automake autoconf libtool fuse fuse-devel uuid libuuid-devel libxml2-devel net-snmp-devel libicu-devel icu make git

git clone https://github.com/LinearTapeFileSystem/ltfs`
cd ltfs

./autogen.sh
./configure # you might need --disable-dependency-tracking and/or --enable-buggy-ifs
make
make install

export PATH=$PATH:/usr/local/bin

This should work, for usage, consult ltfs manual here: https://github.com/LinearTapeFileSystem/ltfs

Now it is up to you if you share your ltfs over samba/nfs to freebsd, sftp,... to use it outside CentOS. Have fun.
 
Back
Top