CARAMBAR Y'EN A MARRE
warning: UFS2 vs FFSv2 has NOT been thoroughly tested – rather use the malabar (ext2fs) guide
pkg install -y pdksh grub2 ksh set -o emacs alias ll='ls -alkF' #mkdir tmp/ #mount -t tmpfs -o rw,mode=777 none tmp/ cd /tmp source=http://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-8.0/amd64/ #source=http://ftp.fr.netbsd.org/pub/NetBSD-daily/HEAD/201903121030Z/amd64/ for set in kern-GENERIC modules base comp debug etc man misc tests text; do echo -n $source/binary/sets/$set.tgz... wget -q $source/binary/sets/$set.tgz && echo done #wget -q $source/binary/sets/$set.tar.xz && echo done done; unset set wget $source/binary/kernel/netbsd-INSTALL.gz
start clean
dmesg | grep ^ada mount | grep ada dd if=/dev/zero of=/dev/ada0 bs=1024k count=1 ls -lkF /dev/ada0*
eventually clean up the backup area of previous attempts
gpart destroy -F ada0
create a clean GPT table
gpart create -s GPT ada0
create a BIOS boot partition for GRUB (this is NOT Hybrid MBR)
#gpart set -a active -i 1 ada0 # for MBR only gpart add -t bios-boot -s 2m -l bios-boot ada0
and a netbsd partition
gpart add -t netbsd-ffs ada0
look at the sizes in bytes
gpart list ada0 | grep Mediasize Mediasize: 2097152 (2.0M) Mediasize: 1000202743808 (932G) Mediasize: 1000204886016 (932G)
check for 4K boundaries as for modern HDDs (not sure this is relevant for SSDs) in sectors
gpart show ada0 => 40 1953525088 ada0 GPT (932G) 40 4096 1 bios-boot (2.0M) 4136 1953520984 2 netbsd-ffs (932G) 1953525120 8 - free - (4.0K) 40*512/4096 = 5 4136*512/4096 = 517
also check the DOS table for Protective MBR
fdisk ada0 sysid 238 (0xee),(EFI GPT) start 1, size 1953525167 (953869 Meg), flag 0
DO NOT FORMAT PARTITION #1
ls -lkF /dev/ada0* newfs -O2 /dev/ada0p2 # GPT netbsd-ffs #-Uj / -J mount /dev/ada0p2 /mnt
cd /tmp for set in kern-GENERIC modules base comp debug etc man misc tests text; do echo -n $set... tar xzpf $set.tgz --chroot -C /mnt && echo done #tar xJpf $set.tar.xz --chroot -C /mnt && echo done done; unset set cp netbsd-INSTALL.gz /mnt/ ls -alF /mnt/ /mnt/dev/
Note. tar -h
rather refers to -H
on FreeBSD, which does conflict with -x
.
cat > /mnt/etc/fstab <<-EOF # no dump /dev/dk1 / ffs rw 0 1 EOF cat /mnt/etc/fstab mv -i /mnt/etc/rc.conf /mnt/etc/rc.conf.dist cat > /mnt/etc/rc.conf <<-EOF . /etc/defaults/rc.conf rc_configured=yes rc_silent=no # /var/run/rc.log no_swap=yes savecore=no EOF cat /mnt/etc/rc.conf
grub-install --version # 2.00 grub-install --no-floppy --boot-directory=/mnt /dev/ada0 find /mnt/bios-boot/grub/i386-pc/ | grep gpt find /mnt/bios-boot/grub/i386-pc/ | grep ufs2 vi /mnt/grub/grub.cfg set default=0 set timeout=3 menuentry "netbsd -v" { insmod ufs2 set root=(hd0,gpt2) knetbsd /netbsd -v } menuentry "netbsd -v -s" { insmod ufs2 set root=(hd0,gpt2) knetbsd /netbsd -v -s } menuentry "netbsd -v -a" { insmod ufs2 set root=(hd0,gpt2) knetbsd /netbsd -v -a } menuentry "netbsd-INSTALL.gz -v" { insmod ufs2 set root=(hd0,gpt2) knetbsd /netbsd-INSTALL.gz -v }
--root=/dev/dk1
ls -alF /mnt/ /dev/ /mnt/grub/ sync umount /mnt
and switch to normal mode
trying to install grub on ada0
you get
/usr/local/sbin/grub-bios-setup: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
==> create a dedicated bios-boot
partition for GRUB
you fucked-up fstab
and when trying to change the mount options to read-write you get
mount_ffs: /dev/dk2 on /: specified device does not match mounted device
==> mount -u -w /dev/dk1 /
GPT fdisk / parttypes.cc https://sourceforge.net/p/gptfdisk/code/ci/master/tree/parttypes.cc