xen guest // install netbsd on ffs2 from gnu/linux

malabar-ffs | guest-netbsd-ffs

tested as xen guest, not yet on bare-metal nor kvm

requirements

first grab the source and build the tools on GNU/Linux

ls -lF /var/tmp/usr/tools/bin/nbmakefs

–or– eventually extract the tools you’ve prepared on another machine

wget https://lab.nethence.com/nunux/tools.tar.gz
mkdir /var/tmp/usr/
tar xzf tools.tar.gz -C /var/tmp/usr/
ls -lF /var/tmp/usr/tools/bin/nbmakefs
rm -f tools.tar.gz

build the image

warning: we had to use --numeric-owner within the script only read UID/GID from the archive and NOT the owner and group names that would match with the system we’re on

second, also make binaries available into /data/kernels/

scripted install

cd /data/guests/

define where you want the initial image to be deployed

# https://pub.nethence.com/bin/bsd/installffs.conf
vi installffs.conf

(tune options)

this assumes you have read-write access to UFS in your Linux kernel

# https://pub.nethence.com/bin/bsd/installffs.bash
./installffs.bash

expand the image

guest=nbffs

mkdir -p /data/guests/$guest/lala/
cd /data/guests/$guest/

proceed with the expansion by booting it once (will eventually reboot by itself)

cat > $guest <<EOF
type = "pvh"
kernel = "/data/kernels/netbsd100.pfaltq"
root = "xbd0a"
memory = 1024
name = "$guest"
vcpus = 3
#disk = ['tap:tapdisk:aio:/data_local/guests/$guest/$guest.ffs,xvda,w']
disk = ['phy:/dev/drbd/by-res/$guest/0,xvda,w']
vif = [ 'bridge=guestbr0,vifname=$guest.0',
    'bridge=guestbr0,vifname=$guest.1' ]
EOF
    xl create $guest -c

this will eventually make it reboot by itself. get back to it and proceed

xl console $guest

space available?

df -h

disable resize_root

vi /etc/rc.conf

first shot indexing and template ready

/usr/libexec/locate.updatedb
sync

^]

xl shu $guest

troubleshooting

when trying larger volume 3g, 4g, 5g i.e

/var/tmp/usr/tools/bin/nbmakefs -t ffs -o v=2,o=time -s 5g slime.ffs2 tree/

gives

Calculated size of `slime.ffs2': 5368709120 bytes, 21246 inodes
Extent size set to 8192
slime.ffs2: 5120.0MB (10485760 sectors) block size 8192, fragment size 1024
    using 93 cylinder groups of 55.19MB, 7064 blks, 256 inodes.
super-block backups (for fsck -b #) at:
       32,   113056,   226080,   339104,   452128,   565152,   678176,
   791200,   904224,  1017248,  1130272,  1243296,  1356320,  1469344,
  1582368,  1695392,  1808416,  1921440,  2034464,  2147488,  2260512,
  2373536,  2486560,  2599584,  2712608,  2825632,  2938656,  3051680,
  3164704,  3277728,  3390752,  3503776,  3616800,  3729824,  3842848,
  3955872,  4068896,  4181920,nbmakefs: ffs_wtfs: seek error for sector 4294944: Invalid argument

when trying to mount it with 5.8.1 and UFS built-into the kernel

# mount -t ufs -o ro,ufstype=ufs2 netbsd.ffs2 lala/
mount: /data2/guests/netbsd/lala: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Sep 27 22:10:51 pro5s2 kernel: [326485.863237] ufs: ufs_fill_super(): bad magic number

this happens with ffsv2

# mount -t ufs -o ro,ufstype=44bsd netbsd.ffs2 lala/
mount: /data2/guests/netbsd/lala: mount(2) system call failed: Stale file handle.

first boot shows

random_seed: /var/db/entropy-file: Not present

while tuning the system read-write on UFS

kernel: ufs filesystem being mounted at /root/lala supports timestamps until 2038 (0x7fffffff)
kernel: ufs: error (device drbd1027): ufs_new_inode: cylinder group 0 corrupted - error in inode bitmap
kernel: ufs: ufs_fill_super(): fs is bad

==> happens on mkdir and file write – prepare folders before-hand and try avoid write during sysprep from the host

resources

https://netbsd.gw.com/cgi-bin/man-cgi?makefs

make it an image sparse

https://wiki.archlinux.org/index.php/sparse_file

netbsd growfs

http://mail-index.netbsd.org/tech-toolchain/2020/08/09/msg003831.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun