Operating System
OpenRD console access on FreeBSD.
This morning, I received the Open-RD I bought a few days ago and started playing with my new device. One of the first thing I wanted to access was (of course) the system console. While the default setup provides a SSH daemon and even GDM and a full desktop, my goal is to have FreeBSD on this device and move the services I run at home from my personal computer to this low-consumption computer (and I don't intend to switch to GNU/Linux).
Since the console is usually available on the serial port, I looked for some cable to connect the OpenRD to my computer. Unfortunately, I didn't have the required cable. I then spent about two hour with various serial cables, cables looking like serial cables but which where not serial cables, parallel SUB-D25 connectors, a serial SUB-D25 cross-over cable and a soldering iron to build a null-modem SUB-D9 serial cable. Unfortunately, when I connected my computer to the OpenRD, I was still not able to access the console using cu(1).
After reading a bit of documentation, I realised I missed the fact that the console was available on USB and not via the serial port. However, FreeBSD did not recognised the chip the OpenRD uses to provide serial over USB support.
Using usbconfig(8), I could get the vendor ID and product ID the uftdi(4) driver was lacking. I patches the source code and a few minutes later could enjoy a set of new devices when I plug the OpenRD on my computer:
% ls /dev/cuaU* /dev/cuaU0 /dev/cuaU0.init /dev/cuaU0.lock /dev/cuaU1 /dev/cuaU1.init /dev/cuaU1.lock
I can now access the OpenRD console using cu(1):
% cu -l /dev/cuaU1 -s 115200
\o/ I can boot a FreeBSD 8.0-STABLE arm kernel!
I filled-in the usb/140951 problem report in the FreeBSD GNATS with the patch. If you own an OpenRD and want to have access to the console, the patch is just waiting for you.
- Romain Tartière's blog
- Login to post comments
Updating FreeBSD 7 (i386) to 8 (amd64)
Goal
Update to the latest FreeBSD version, switch to 64 bit, and switch to full ZFS. In short, use the best I can have (or what is supposed to be the best I can have) on my computer.
Install an amd64 system
While cross compiling an amd64 system from i386 should be possible, I wanted to get sure that the nouveau video driver actually worked on amd64. I have so decided to install a fresh FreeBSD 8 on my system and perform a few tests before updating.
At that time, FreeBSD 8-BETA2 was just available, so I downloaded and installed it on a fresh partition created in place of the mysterious free space at the end of my hard disk:
# mkdir goinfre/FreeBSD # cd goinfre/FreeBSD # mkdir base kernels manpages # ftp -a ftp.freebsd.org ftp> cd /pub/FreeBSD/releases/amd64/8.0-BETA2/base ftp> lcd base ftp> mget * ftp> cd ../kernels ftp> lcd ../kernels ftp> mget * ftp> cd ../manpages ftp> lcd ../manpages ftp> mget * ftp> bye # ( cd base && DESTDIR=/goinfre sh install.sh ) # ( cd kernels && DESTDIR=/goinfre sh install.sh generic ) # mv /goinfre/boot/GENERIC /goinfre/boot/kernel # ( cd manpages && DESTDIR=/goinfre sh install.sh ) # bsdlabel -w -B -b /goinfre/boot/boot /dev/ad10s3
Since my hardware BIOS sucks when it is supposed to give up control of USB to the kernel, USB is disabled in my BIOS and I have no keyboard to choose from which slice to boot when the system starts. I have so to instruct the boot manager to boot on the third slice on next boot:
# boot0cfg -s 3 ad10
I then rebooted and setup FreeBSD 8-BETA2 networking, patched the kernel sources, checked that the nouveau video driver worked as expected, installed packages, and so on.
Setting up the disks
I basically followed instructions from the blog post Setting up a zfs-only system by Ulf Lilleengen (nanolulf), adjusting settings according to my system (4 GB swap, all available space for the ZFS partition):
# gpart delete -i 1 ad12
# gpart destroy ad12
# gpart create -s GPT ad12
# gpart add -b 34 -s 128 -t freebsd-boot ad12
# echo "4 * 1024*1024*1024 / 512" | bc
8388608
# gpart add -b 162 -s 8388608 -t freebsd-swap ad12
# gpart show ad12
=> 34 625142381 ad12 GPT (298G)
34 128 1 freebsd-boot (64K)
162 8388608 2 freebsd-swap (4.0G)
8388770 616753645 - free - (294G)
# gpart add -b 8388770 -s 616753645 -t freebsd-zfs ad12
# gpart bootcode -b /boot/pmbr ad12
# gpart bootcode -p /boot/gptzfsboot -i 1 ad12
Then I created the various ZFS filesystems and extracted FreeBSD 8 stable (well, still named 8.0-RC1 actually)
# zpool create data /dev/ad12p3 # zfs create data/tmp # zfs create data/usr # zfs create data/var
Installing FreeBSD 8 from sources
Since I had the right branch of the FreeBSD subversion repository checked in into the temporary FreeBSD 8 system — with local patches — I copied it to the ZFS filesystem and updated it.
# cp -R /usr/src /data/usr # cd /data/usr/src # svn up # make buildworld buildkernel # make DESTDIR=/data installworld # make DESTDIR=/data installkernel # make DESTDIR=/data distribution
I then customezed /boot/loader.conf:
cat << EOT > /data/boot/loader.conf nouveau_load=yes zfs_load=yes vfs.root.mountfrom="zfs:data" EOT
Configured the swap device:
cat << EOT > /data/etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/ad12p2 none swap sw 0 0 EOT
Customised new /etc/make.conf:
cat << EOT > /data/etc/make.conf LOADER_ZFS_SUPPORT=YES EOT
Setup the network in /etc/rc.conf:
cat << EOT > /data/etc/rc.conf # This file now contains just the overrides from /etc/defaults/rc.conf. # Please make all changes to this file, not to /etc/defaults/rc.conf. # Enable network daemons for user convenience. ifconfig_rl0="inet 192.168.63.42 netmask 255.255.255.0" defaultrouter="192.168.63.1" hostname="marvin.blogreen.org" named_enable="YES" # asterisk_enable="YES" # dbus_enable="YES" # hald_enable="YES" # gdm_enable="YES" # gdm_lang="fr_FR.UTF-8" EOT
I finally finished the ZFS setup:
# zfs export data && zfs import data # cp /boot/zfs/zpool.cache /data/boot/zfs # zfs set mountpoint=legacy data # zfs set mountpoint=/usr data/usr # zfs set mountpoint=/var data/var # zpool set bootfs=data data
I then booted the fresh install from ZFS and finished the system configuration:
# passwd # tzsetup # adduser
Mirroring data
Since I have two identical disks on my system and wanted to have some kind of redundancy for a while, I set-up the second disk as a mirror of the first one.
First, I prepared the old disk so it has the same structure as the new with the ZFS filesystem:
# gpart show ad10
=> 63 625142385 ad10 MBR (298G)
63 104856192 1 freebsd (50G)
104856255 419425020 2 freebsd (200G)
524281275 100856070 3 freebsd (48G)
625137345 5103 - free - (2.5M)
# gpart delete -i 1 ad10
# gpart delete -i 2 ad10
# gpart delete -i 3 ad10
# gpart destroy ad10
# gpart create -s GPT ad10
# gpart add -b 34 -s 128 -t freebsd-boot ad10
# gpart add -b 162 -s 8388608 -t freebsd-swap ad10
# gpart show ad10
=> 34 625142381 ad10 GPT (298G)
34 128 1 freebsd-boot (64K)
162 8388608 2 freebsd-swap (4.0G)
8388770 616753645 - free - (294G)
# gpart add -b 8388770 -s 616753645 -t freebsd-zfs ad10
# gpart bootcode -b /boot/pmbr ad10
# gpart bootcode -p /boot/gptzfsboot -i 1 ad10
I added my new 4 Gib swap to /etc/fstab and enabled it:
# echo "/dev/ad10p2 none swap sw 0 0" >> /etc/fstab # swapon /dev/ad10p2
I could then tell ZFS to mirror ad10p3 and ad12p3:
# zpool attach data ad12p3 ad10p3 # zpool status pool: data state: ONLINE status: One or more devices is currently being resilvered. The pool will continue to function, possibly in a degraded state. action: Wait for the resilver to complete. scrub: resilver in progress for 0h2m, 0.35% done, 13h33m to go config: NAME STATE READ WRITE CKSUM data ONLINE 0 0 0 mirror ONLINE 0 0 0 ad12p3 ONLINE 0 0 0 44.6M resilvered ad10p3 ONLINE 0 0 0 754M resilvered errors: No known data errors
The nice part is of course that you can continue to use the system while you are doing all this!
- Romain Tartière's blog
- Login to post comments
You! Yes you! Help saving BSD Magazine!
I have been a subscriber for BSD Magazine since the first issue.
While the targeted audience is definitively not the *BSD kernel hacker, and despite the fact that each issue (so far) is spotted on a BSD flavor; the diversity of the articles featured in the magazine will make any Free Software enthusiast find useful information.
I never wrote a review about the magazine before, mainly because a lack of time, and now might be a bit too late. At the time of writing, BSD Magazine is likely to be discontinued because of lower benefits than expected
.
However, BSD Magazine is not dead yet and can still be saved! How? Many ways:
- Buy one copy of BSD Magazine. If you can't find it, visit the BSD Magazine website and tell them. You can also order the latest issue from FreeBSD Mall with a discount;
- Subscribe to the print or electronic subscription;
- Spread the word. Speak about it on your website, blog, etc. Microblog about it (using the #savebsdmag hashtag).
- Advertise in BSD Magazine if you have something related to *BSD or FreeSoftware to sell.
Why you should not use old-style PGP encrypted / signed messages
Just received another mail signed in the the old-style way:
-----BEGIN PGP SIGNED MESSAGE-----Hash: SHA1
Hello, [...] Cordialement - --
[...] Membre de l'April - « promouvoir et défendre le logiciel libre » - [...] -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org sDJOSYR9U4W6YR8d794Y5f0296J0Fg9847ED904h780592347dJ5F924e3UoiY58 reptup34eo8t9568gdfg8spf2dgj3Fdf =iDPk -----END PGP SIGNATURE-----
First, it is really painful since a lot a junk prevent the mail from being read easily:
- There are separators for different parts of the PGP signed message
,
and
; - The first line of the
message
is not part of the message
; - Lines starting with a dash have
prepended to them. As a consequence, the signature is not a signature anymore-
; - The message ends with data that is definitively intended to be read by a program
.
- Romain Tartière's blog
- Login to post comments
- Read more
Raid-1 using gmirror(8)
When configuring Astase development server, I set up software mirroring using FreeBSD gmirror. This is much more a memo than a technical note, but I decided to blog about it anyway.
In this post, the disk where FreeBSD was installed is ad4 and will be referred as the first disk, while the disk that we will configure for mirroring is ad6 and will be referred as the second disk. FreeBSD is installed on the second slice of the disk using the default partition scheme.
Both disks have been sliced the same way when installing using sysinstall(8). It would of course have been possible to use fdisk(8) to do this. If both disks are identical, the quick way of doing this is to copy the slice table:
# fdisk -p ad4 > /tmp/slices # fdisk -f /tmp/slices ad6
Fedora 8 test-drive
Last WeekEnd, I was on a [computing] trip and borrowed a laptop from ${workplace} for the ocasion. Since I used it for a personal purpose, I chose to drop anything it has on the hard disk and start with a fresh install. I don't really have particular criterias, but as a FreeBSD user, I am used to have recent software, and am particulary disapointed by the obsolescence of certain Linux distros. Since I was not going to hav enouth time to compile, I wanted a binary packages based Linux distribution.
I already used Ubuntu but cannot really say I enjoyed it: for me it is not much more than a partialy-up-to-date version of Debian. As a consequence, I decided to give Fedora GNU/Linux a try since I had good echos about it during the preceeding week.
- Romain Tartière's blog
- Login to post comments
- Read more
Learning GEOM: Tasting
I have been quite busy these last days and didn't got as much time as expected to have fun with geom(4) — the FreeBSD modular disk transformation framework. Since documentation is quite sparse compared to the rocket science inside GEOM, I spend a lot of time in man pages and reading existing GEOM classes source code... However, as recently said on the freebsd-geom mailing list:
Ahh you're believing the code comment :( (Rule #1: Never believe the code comments).
Well, this doesn't make things easy, but I can cope with that (or at least I hope so). I have already located interesting classes to study for the purpose of geom_lvm2:
- geom/geom_bsd.c
- This class looks relatively simple and is well commented. It seems to be a good starting point for learning how GEOM works (687 SLOC);
- geom/concat/g_concat.c
- This class seems a little more complex. Concatenation will have to be handled when a logical volume has physical extends on different physical volumes. Maybe will it be possible to rely directly on this class for this purpose (876 SLOC);
- geom/vinum/*
- Gvinum is a really complex^Wcool piece of code. Since it internally relies on various representation of disk chunks to provide services such as RAID, it can be a good source of inspiration for geom_lvm2's internals (7637 SLOC).
- Romain Tartière's blog
- Login to post comments
- Read more
Dumping LVM2 logical volumes under FreeBSD
At work, I generally use the Debian GNU/Linux operating system: as all our servers run Debian, it avoids loads of clashes when we put in production our work. But I am frequently complaining about how Debian works and globally can't bear it's frustrating package management system (which becomes even worth than ever when you run a advanced-user / developer / desktop machine
). Anyway, there are many situations I could do my job with another operating system that fits much more my needs, let's say FreeBSD... The problem is that as a paranoid sysadmin, my current /home directory is a LVM2 logical volume on top of software RAID controlled by mdadm.
FreeBSD features a cool abstraction layer in the kernel called GEOM and documented as a modular disk I/O request transformation framework
. Basically, it fits between your devices as represented by files in /dev and the physical disks, providing on the fly mirroring / stripping / whatever, without the need of any external tool (it's a bit more complex in fact, but keep it simple
).
Unfortunately, all this is uterly not compatible with either MD or LVM2.