xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/bfs.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun========================
4*4882a593SmuzhiyunBFS Filesystem for Linux
5*4882a593Smuzhiyun========================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe BFS filesystem is used by SCO UnixWare OS for the /stand slice, which
8*4882a593Smuzhiyunusually contains the kernel image and a few other files required for the
9*4882a593Smuzhiyunboot process.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunIn order to access /stand partition under Linux you obviously need to
12*4882a593Smuzhiyunknow the partition number and the kernel must support UnixWare disk slices
13*4882a593Smuzhiyun(CONFIG_UNIXWARE_DISKLABEL config option). However BFS support does not
14*4882a593Smuzhiyundepend on having UnixWare disklabel support because one can also mount
15*4882a593SmuzhiyunBFS filesystem via loopback::
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun    # losetup /dev/loop0 stand.img
18*4882a593Smuzhiyun    # mount -t bfs /dev/loop0 /mnt/stand
19*4882a593Smuzhiyun
20*4882a593Smuzhiyunwhere stand.img is a file containing the image of BFS filesystem.
21*4882a593SmuzhiyunWhen you have finished using it and umounted you need to also deallocate
22*4882a593Smuzhiyun/dev/loop0 device by::
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun    # losetup -d /dev/loop0
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunYou can simplify mounting by just typing::
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    # mount -t bfs -o loop stand.img /mnt/stand
29*4882a593Smuzhiyun
30*4882a593Smuzhiyunthis will allocate the first available loopback device (and load loop.o
31*4882a593Smuzhiyunkernel module if necessary) automatically. If the loopback driver is not
32*4882a593Smuzhiyunloaded automatically, make sure that you have compiled the module and
33*4882a593Smuzhiyunthat modprobe is functioning. Beware that umount will not deallocate
34*4882a593Smuzhiyun/dev/loopN device if /etc/mtab file on your system is a symbolic link to
35*4882a593Smuzhiyun/proc/mounts. You will need to do it manually using "-d" switch of
36*4882a593Smuzhiyunlosetup(8). Read losetup(8) manpage for more info.
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunTo create the BFS image under UnixWare you need to find out first which
39*4882a593Smuzhiyunslice contains it. The command prtvtoc(1M) is your friend::
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun    # prtvtoc /dev/rdsk/c0b0t0d0s0
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun(assuming your root disk is on target=0, lun=0, bus=0, controller=0). Then you
44*4882a593Smuzhiyunlook for the slice with tag "STAND", which is usually slice 10. With this
45*4882a593Smuzhiyuninformation you can use dd(1) to create the BFS image::
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun    # umount /stand
48*4882a593Smuzhiyun    # dd if=/dev/rdsk/c0b0t0d0sa of=stand.img bs=512
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunJust in case, you can verify that you have done the right thing by checking
51*4882a593Smuzhiyunthe magic number::
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun    # od -Ad -tx4 stand.img | more
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunThe first 4 bytes should be 0x1badface.
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunIf you have any patches, questions or suggestions regarding this BFS
58*4882a593Smuzhiyunimplementation please contact the author:
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunTigran Aivazian <aivazian.tigran@gmail.com>
61