FreeBSD 8.2 to 9.0 RELEASE + gmirror + custom kernel

I am busy working through your (helpful!) post and would appreciate some feedback or comments on the list of commands I will be running to test the upgrade of my system. I'll admit, I wasn't sure of a couple and have mentioned that below.

Heres what I have so far:
Code:
1) Boot with the 9.0 install CD.

2) Select Shell.

3 )Use glabel to label the two disks:

3a) glabel label MirrorDisk0 /dev/ad4

3b) glabel label MirrorDisk1 /dev/ad6

4) gmirror label -v RootMirror0 /dev/label/MirrorDisk0 /dev/label/MirrorDisk1

5)  gpart create -s mbr RootMirror0  (Create MBR)
    gpart set -a active -i 1 RootMirror0 (Make bootable/active)
    bsdlabel -e RootMirror0 (Create bsdlabel partition)

6) glabel label AlphaSwap /dev/ad4s1b

7) newfs /dev/mirror/RootMirror0

8) mount /dev/mirror/RootMirror0 /mnt/mirror

9) cd /mnt/mirror

10) restore -rf /mnt/usb/restore.dump

11) Add to /etc/fstab file: 

/dev/mirror/AlphaSwap               none            swap    sw              0       0
/dev/mirror/RootMirror0              /               ufs     rw              1       1

Am I even close? :)
 
5. Do not use bsdlabel(8). gpart(8) is a replacement for it.

6. Use the mirror device for swap, not one individual disk.

7. Use soft updates and filesystem labels on the filesystem.

11. Labels do not show up in /dev/mirror.
 
wblock@ said:
5. Do not use bsdlabel(8). gpart(8) is a replacement for it.

6. Use the mirror device for swap, not one individual disk.

7. Use soft updates and filesystem labels on the filesystem.

11. Labels do not show up in /dev/mirror.

Many thanks for the input. I have changed the above mentioned points as follows:

Code:
5)  gpart create -s mbr RootMirror0  (Create MBR)
    gpart set -a active -i 1 RootMirror0 (Make bootable/active)
    gpart create -s gpt RootMirror0 (Create partition on new mirror)

6) glabel label AlphaSwap /dev/label/RootMirror0

7) newfs -U /dev/label/RootMirror0

11) Add to /etc/fstab file: 


/dev/label/AlphaSwap               none            swap    sw              0       0
/dev/label/RootMirror0              /               ufs     rw              1       1

The one thing I have been wondering about is, where do I set the size of the swap and root mirror partition?
 
xy16644 said:
Many thanks for the input. I have changed the above mentioned points as follows:

Code:
5)  gpart create -s mbr RootMirror0  (Create MBR)
    gpart set -a active -i 1 RootMirror0 (Make bootable/active)
    gpart create -s gpt RootMirror0 (Create partition on new mirror)

No, the bsdlabel scheme is called BSD. And it should be created on a slice. So
Code:
gpart create -s BSD mirror/RootMirror0s1
Then the filesystems and swap partition must be created on that s1 slice.

Code:
6) glabel label AlphaSwap /dev/label/RootMirror0

Code:
glabel label romiswap /dev/mirror/RootMirror0s1b

Code:
7) newfs -U /dev/label/RootMirror0

Yes, but add a filesystem label:
Code:
newfs -U -L romirootfs /dev/mirror/RootMirror0
Note that RootMirror0 is the device name you gave to the mirror, it's not a label. Labels show up in various parts of /dev when a disk is attached. /dev/ufs/ for UFS filesystem labels, /dev/label/ for generic labels, and so on. See glabel(8).

Code:
11) Add to /etc/fstab file: 

/dev/label/AlphaSwap               none            swap    sw              0       0
/dev/label/RootMirror0              /               ufs     rw              1       1
Code:
/dev/label/romiswap               none            swap    sw              0       0
/dev/ufs/romirootfs               /               ufs     rw              1       1

The one thing I have been wondering about is, where do I set the size of the swap and root mirror partition?

That is done when you create those partitions, which is not shown above. This would be one gpart add to RootMirror0s1 for each partition.
 
Thanks for the reply wblock@! Let me just make sure I understand this 100%:

Step 5:
Code:
gpart create -s BSD mirror/RootMirror0s1  (Create slice)
gpart add -i 1 -s 70G -t mirror/RootMirror0s1a (Create / partition of 70GB)
gpart add -i 2 -s 3G -t mirror/RootMirror0s1b (Create swap partition of 3GB)

Step 6:
Code:
glabel label romiswap /dev/mirror/RootMirror0s1b (label swap...does this have to say romiswap?)

Step 7:
Code:
newfs -U -L romirootfs /dev/mirror/RootMirror0 
(Create file system, enable Soft Updates on mirror partition and label it...
does this label have to be romirootfs or can I change this to something else?)

Step 11:
/etc/fstab:
Code:
/dev/label/romiswap               none            swap    sw              0       0
/dev/ufs/romirootfs               /               ufs     rw              1       1

I must be getting close now :e
 
xy16644 said:
Step 6:
Code:
glabel label romiswap /dev/mirror/RootMirror0s1b (label swap...does this have to say romiswap?)

No, it's just the label; seriously, see glabel(8). It's lowercase because I only use lowercase in labels. "romi" is from your RootMirror, which is misleading because it doesn't have anything to do with a root filesystem or user.

Step 7:
Code:
newfs -U -L romirootfs /dev/mirror/RootMirror0 
(Create file system, enable Soft Updates on mirror partition and label it...
does this label have to be romirootfs or can I change this to something else?)

You can change it.
 
I have made it to step 5:

[CMD=""]gpart create -s BSD mirror/RootMirror0s1[/CMD]

but I am getting the following:

Code:
gpart: arg0 'mirror/RootMirror0s1': Invalid argument

I have tried reading the man file and this is what it says:

[CMD=""]gpart create -s scheme [-n entries] [-f flags] provider[/CMD]

I'm not sure why my provider is incorrect?
 
This seemed to have done the trick:
Code:
gpart add -i 1 -s 74G -t freebsd mirror/RootMirror0
gpart add -i 1 -s 70G -t freebsd-ufs mirror/RootMirror0s1
gpart add -i 2 -s 3G -t freebsd-swap mirror/RootMirror0s1
 
It's not necessary to use the -i option when adding partitions. If you leave out the size, it will use the rest of the available space.
 
wblock@ said:
It's not necessary to use the -i option when adding partitions. If you leave out the size, it will use the rest of the available space.

Thanks for that. I will try it shortly as I have started over again. Am battling with making the new mirror bootable!
 
I have finished upgrading my test machine to FreeBSD 9 RELEASE and from what I can tell so far there are 3 problems that I have encountered so far:

1) I can't get the SSH service to start and get the following error:
Code:
/etc/rc: WARNING: /usr/bin/ssh-keygen does not exist
/etc/rc: WARNING: failed precmd routine for sshd

2) Postfix can't deliver email anymore. When I send an email I get the following in the NDR error:
Code:
local configuration error. Command output: mailwrapper:  parse error in /etc/mail/mailer.conf
Action: failed
Status: 5.3.5
Diagnostic-Code: x-unix; mailwrapper: parse error in /etc/mail/mailer.conf

3) This is more a curiousity and for my own understanding but before the upgrade I was running my own customised kernel called ALPHA. Post upgrade I am now running the GENERIC kernel. I did recompile my kernel during the upgrade but this doesn't seemed to have worked. I don't need the customised kernel anymore, I just want to understand where I went wrong and why it started using the GENERIC one again.

Many thanks!
 
One of the steps after upgrading by source is to update /etc. Usually that is done with mergemaster(8). See http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html#CANONICAL-BUILD.

After updating major revisions, FreeBSD 8 to 9, for example, all ports have to be rebuilt. There's a procedure at the end of the portmaster(8) man page for that.

I would guess the Postfix problem will be fixed by the reinstall of mail/postfix, which (I think) has an option or instructions to update /etc/mail/mailer.conf.

The kernel depends on how you upgraded. Binary, I think GENERIC is the only choice. For source, if you don't include KERNCONF=MYKERNELCONFIG on the command line when building the kernel, you'll get GENERIC instead.
 
Maybe I should take a step back. In the past when I upgraded from 7.2 to 8.0 and then to 8.2 I ran the following commands in this order:

[CMD="*"]freebsd-update upgrade -r 8.2-RELEASE[/CMD]
[CMD="*"]cd /usr/src[/CMD]
[CMD="*"]make KERNCONF=ALPHA kernel[/CMD]
[CMD="*"]freebsd-update install[/CMD]
[CMD="*"]shutdown -r now[/CMD]
[CMD="*"]freebsd-update install[/CMD]
[CMD="*"]shutdown -r now[/CMD]

This would *normally* upgrade the machine to the new version of FreeBSD and if I ran a [CMD=""]uname -a[/CMD] it would show that the customised kernel was in use.

Having had a look through the link you included in your last post, the steps are quite different:

[CMD="*"]cd /usr/src[/CMD]
[CMD="*"]make buildworld[/CMD]
[CMD="*"]make buildkernel[/CMD]
[CMD="*"]make installkernel[/CMD]
[CMD="*"]shutdown -r now[/CMD]
Boot into single user mode:
[CMD="*"]mount -u /[/CMD]
[CMD="*"]mount -a -t ufs[/CMD]
[CMD="*"]adjkerntz -i[/CMD]
[CMD="*"]mergemaster -p[/CMD]
[CMD="*"]cd /usr/src[/CMD]
[CMD="*"]make installworld[/CMD]
[CMD="*"]mergemaster[/CMD]
[CMD="*"]reboot[/CMD]

I should mention that I don't mind going back to the GENERIC kernel (the changes I made in my customised kernel were never used in the end).

I did end up rebuilding ALL my ports as follows:
[CMD="*"]portmaster -a -f -D -R[/CMD]

This seemed to fix my Postfix problem (I can send email again) but I have since discovered that I can't connect via Thunderbird to the test server for email. I noticed that saslauthd service was no longer installed! I tried to reinstall the port but it kept ending with a fatal error during the make install. I ended up having to install the package but I still can't connect with Thunderbird.

/var/log/auth.log says:
Code:
sasldblistusers2: unable to dlopen /usr/local/lib/sasl2/libgs2.so.2: Undefined symbol "GSS_C_MA_ITOK_FRAMED"
saslpasswd2: unable to dlopen /usr/local/lib/sasl2/libgs2.so.2: Undefined symbol "GSS_C_MA_ITOK_FRAMED"

After rebuilding all the ports I still can't get the SSH service to start and still get:
Code:
/etc/rc: WARNING: /usr/bin/ssh-keygen does not exist
/etc/rc: WARNING: failed precmd routine for sshd

If I had to start with a fresh restore, would it be better to follow your steps to upgrade from 8.2 to 9.0 (with a generic kernel)? Then rebuild all the ports again? I feel like somethings gone wrong with all these errors I am getting?

BTW, the new mirrors working great! Labels are a nice feature, thanks for introducing me to them!
 
The two methods you show are binary (freebsd-update(8)) and source. I've never used the binary method, but it is covered in both the Handbook and the man page. Read those, seriously. They are links, klicken Sie auf den Link.

The upgrade procedure in portmaster(8) helps to avoid problems. If you do rebuild all your ports, do it that way.

The saslauthd problem is because the package is looking for an older library. Rebuild it from the port; if there are build problems, something else may be broken.

The ssh-keygen problem, no idea, I've never seen that before. I would just rebuild from source, rather than restoring again. And I would do that before attempting to install or rebuild any ports.
 
I'm not understanding something when I am in single user mode. From what I have read, when you are using single user mode, the root file system is in read only mode. How does one put it into write mode?

I have tried:

[CMD=""]fsck -p[/CMD]

But I get:
Code:
/dev/ufs/MirrorRootFS: NO WRITE ACCESS
/dev/ufs/MirrorRootFS: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

Running:
[CMD=""]mount -a[/CMD]

doesn't help either.

I also tried:
[CMD=""]fsck -f[/CMD]

The results from running
[CMD=""]mount[/CMD]
are:
Code:
/dev/ufs/MirrorRootFS on / (ufs, local, soft-updates)

What's the correct way to make root writable? (keeping in mind I have a mirror with gmirror).

Thank you.
 
That it's a mirror makes no difference, that happens on a level below the filesystem. As far as the filesystem is concerned, it's just a disk.

To remount the root filesystem in rw mode,
# mount -u /
 
Is there a command you can run to check what file systems are in read or write mode?

I have run:
[CMD=""]mount -u /[/CMD]

but how can I see what's in read mode? And write mode?

If I run [CMD=""]fsck -p[/CMD] again it still says NO WRITE ACCESS.
 
wblock@ said:
mount(8) does, I think.

fsck(8) only works on unmounted or readonly filesystems. Why are you trying to run it?

Yes, you're right, mount does do it. If I reboot straight into single user mode and do:
[CMD=""]mount[/CMD]

it returns:

Code:
/dev/ufs/MirrorRootFS on / (ufs, local, [B]read-only[/B])

I then do a:
[CMD=""]mount -u /[/CMD]

and get:

Code:
/dev/ufs/MirrorRootFS on / (ufs, local, [B]soft-updates[/B])

I'll tell you where the question comes from. When I was trying to do my dump restore onto the new mirror from a USB drive (while booted off the FreeBSD 9 DVD into the shell), it kept complaining that there wasn't any writable space in /tmp and the restore failed/stopped. As a workaround I unmounted /tmp and remounted it onto a spare USB drive I had lying around and that got things going. It made me think, did I go about this correctly? Just curious, that's all!
 
Use mfsBSD instead of the install CD shell. It has many things done more usefully. Just today, I encountered that problem with the install CD shell. It mounts /tmp on a very small md(4) device. On the other hand, there's no easily downloadable USB image of mfsBSD, just ISOs for CDs.

Update: looking again, there are now mfsBSD USB images for download!
 
Thanks for confirming that, that's the exact same thing I experienced when doing my restore!

I shall have a look at mfsBSD then. Thanks!
 
Back
Top