Archive for the ‘FreeBSD’ Category

Total access to *BSD ufs partition on linux

That’s worked on ArchLinux with FreeBSD, but I thinks it’s worked for all Linux and BSD (ufs).

You can damage your system, please if you don’t understand something are if you are not sure about the result, don’t do anything. I’m not responsable of the damages.

Since few times, I’m interested by a compatibility of the 2 systems. The last week I try to compiling my kernel on Arch Linux to enable UFS write support but I never compiling a kernel and I had some problems.

So today I try again and it’s run, the problems I had it’s with depmod, the name of System.map, vmlinuz26 and the configuration of grub…

By default The Linux Kernel can’t read on UFS partition, but not write. You should change the default configuration for enable the write support.

Create a directory for the building
mkdir ~/kernel

cd ~/kernel

I download the Latest Stable Kernel here => http://www.kernel.org/
In the kernel directory decompress the kernel archive (in my case the version was 2.6.32.7).
The following commands not required to be root.
tar -jxvf linux-2.6.32.7.tar.bz2

cd linux-2.6.32.7
Cleaning the directory.
make mrproper

And if you want save the old configuration of the kernel.
zcat /proc/config.gz > .config

make oldconfig

Now you can launch menuconfig for enable the UFS writing support.
make menuconfig

Select the file sytem section.

Select miscellaneous filesystems.

And finally enable the UFS writing support.

You can compile the Kernel.
make
Please remember the last line with DEPMOD, get the name of your personnal kernel (the word after DEPMOD) it’s important for the end.
For example in my case it was  something like this:

DEPMOD              2.6.32.7-ARCH-perso

Now you have to be root for the followings operations.
su

make modules_install

cp -v arch/x86/boot/bzImage /boot/vmlinuz26-perso

cp -v System.map /boot/System.map26-perso

mkinitcpio -k 2.6.32.7-ARCH-perso -g /boot/kernel26-perso.img
Where 2.6.32.7-ARCH-perso is the DEPMOD argument.

The details for kernel compilation are found here => http://wiki.archlinux.org/index.php/Kernel_Compilation_From_Source

Now we need to add the entry in /boot/grub/menu.lst for booting on the new kernel.
With your favorite text editor edit the file and add something like this :
You have juste to copy and past the part of the existant line for the old kernel. (don’t remove the old if the kernel-perso don’t want to boot it’s usefull),
and modify the number of entry, name, path to kernel.img and vmlinuz.

# (4) Arch Linux Perso
title Arch Linux Perso
root (hd0,4)
kernel /vmlinuz26-perso root=/dev/disk/by-uuid/658d9411-a8ac-4398-a852-efb21af45dba ro vga=794 quiet
initrd /kernel26-perso.img

Reboot on the new kernel…

Now I want reconstitute the arborescence of FreeBSD system something like that :
/
swap
/var
/tmp
/usr
/home

su

mkdir /mnt/freebsd

Now execute this command for know the bsd partition disposition.
dmesg | grep bsd

sda3: <bsd: sda10 sda11 sda12 sda13 sda14 sda15 >

In my case sda3 is the “/” partition, so I mount it first.
mount -t ufs -o ufstype=ufs2 /dev/sda3 /mnt/freebsd/

sda10 and sda3 are the same partition.
Change /dev/sda3/ by your / FreeBSD partition.
I don’t want to mount the swap and it’s not a ufs partition so sda11 is forget.
In order :
I mount sda12 in /mnt/freebsd/var
mount -t ufs -o ufstype=ufs2 /dev/sda12 /mnt/freebsd/var/
I mount sda13 in /mnt/freebsd/tmp
mount -t ufs -o ufstype=ufs2 /dev/sda13 /mnt/freebsd/tmp/
I mount sda14 in /mnt/freebsd/usr
mount -t ufs -o ufstype=ufs2 /dev/sda14 /mnt/freebsd/usr/
I mount sda15 in /mnt/freebsd/home
mount -t ufs -o ufstype=ufs2 /dev/sda15 /mnt/freebsd/home/

If all is good and if you can create file or editing an existing file, etc…you can edit the fstab for automounting the partition at boot.
In my case the fstab look like that :

#
# FreeBSD Partitions
#
/dev/sda3 /mnt/freebsd ufs ufstype=ufs2 0 0
/dev/sda12 /mnt/freebsd/var ufs ufstype=ufs2 0 0
/dev/sda13 /mnt/freebsd/tmp ufs ufstype=ufs2 0 0
/dev/sda14 /mnt/freebsd/usr ufs ufstype=ufs2 0 0
/dev/sda15 /mnt/freebsd/home ufs ufstype=ufs2 0 0

I change the permission of the /mnt/freebsd/home/MY_USER
chown -R LOGIN /mnt/freebsd/home/MY_USER

Not a good idea, that’s modify the bsd partition and I couldn’t start x…

Everything it’s ok.
Bye