I decided to prove or disprove this theory using my VMWare ESXi server.
Firstly, I created a FreeBSD 5.5 VM, and then a FreeBSD 9.0 VM. I decided to do it this way instead of using the actual NAS4Free distro as I know the NAS4Free distro is based upon FreeBSD9, so the end result should be the same!
I add two small extra disks to the 5.5 box and then go ahead and configure a RAID1 mirror:
$ su
Password:
bsd55# uname -a
FreeBSD bsd55 5.5-RELEASE FreeBSD 5.5-RELEASE #0: Tue May 23 14:58:27 UTC 2006 root@perseus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
bsd55# kldload /boot/kernel/geom_mirror.ko
bsd55# gmirror label gm055 da1 da2
bsd55# gmirror status
Name Status Components
mirror/gm055 COMPLETE da1
da2
bsd55# newfs /dev/mirror/gm055
/dev/mirror/gm055: 512.0MB (1048572 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 128.00MB, 8192 blks, 16384 inodes.
super-block backups (for fsck -b #) at:
160, 262304, 524448, 786592
bsd55# mount /dev/mirror/gm055 /mnt
bsd55# echo 'proof of conecpt' >/mnt/poc
bsd55# ls -l /mnt
total 4
drwxrwxr-x 2 root operator 512 Aug 21 22:43 .snap
-rw-r--r-- 1 root wheel 17 Aug 21 22:49 poc
bsd55# cat /mnt/poc
proof of conecpt
bsd55# shutdown now
Shutdown NOW!
shutdown: [pid 574]
bsd55#
*** FINAL System shutdown message from nf@bsd55 ***
System going down IMMEDIATELY
System shutdown time has arrived
Next I turn the power off on the 5.5 VM and then edit the settings for the 9.0 VM using vSphere client. What I am doing here is attaching the 5.5 mirrored disks to the 9.0 box:
Now I proceed to power on the 9.0 box and ssh into it to see what the new kernel makes of the old disks:
$ su Password: You have mail. root@hg:/usr/home/nf # uname -a FreeBSD hg 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 root@hg:/usr/home/nf # kldload /boot/kernel/geom_mirror.ko root@hg:/usr/home/nf # dmesg GEOM_MIRROR: Upgrading metadata on da2 (v3->v4). GEOM_MIRROR: Device mirror/gm055 launched (2/2). GEOM_MIRROR: Upgrading metadata on da1 (v3->v4). root@hg:/usr/home/nf # fsck -t ufs /dev/mirror/gm055 ** /dev/mirror/gm055 ** Last Mounted on /mnt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 3 files, 3 used, 247891 free (27 frags, 30983 blocks, 0.0% fragmentation) ***** FILE SYSTEM MARKED CLEAN ***** root@hg:/usr/home/nf # mount /dev/mirror/gm055 /mnt root@hg:/usr/home/nf # ls -l /mnt total 4 drwxrwxr-x 2 root operator 512 Aug 22 00:51 .snap -rw-r--r-- 1 root wheel 17 Aug 22 00:51 poc root@hg:/usr/home/nf # cat /mnt/poc proof of conecpt
As can be seen above, the kernel recognised the legacy geom mirrored disks and performed a metadata upgrade from v3 to v4. To further this I prove that the original data can be read back.
So if anyone is thinking of moving GEOM based disks from an old BSD box to a newer distribution, fear not - as usual BSD is rock steady and can be relied upon!
No comments:
Post a Comment