0fa1a2c36a4053ea53e881ac2df2e18825b72f53
[linux-2.6-microblaze.git] / Documentation / filesystems / cifs / cifsroot.txt
1 Mounting root file system via SMB (cifs.ko)
2 ===========================================
3
4 Written 2019 by Paulo Alcantara <palcantara@suse.de>
5 Written 2019 by Aurelien Aptel <aaptel@suse.com>
6
7 The CONFIG_CIFS_ROOT option enables experimental root file system
8 support over the SMB protocol via cifs.ko.
9
10 It introduces a new kernel command-line option called 'cifsroot='
11 which will tell the kernel to mount the root file system over the
12 network by utilizing SMB or CIFS protocol.
13
14 In order to mount, the network stack will also need to be set up by
15 using 'ip=' config option. For more details, see
16 Documentation/filesystems/nfs/nfsroot.txt.
17
18 A CIFS root mount currently requires the use of SMB1+UNIX Extensions
19 which is only supported by the Samba server. SMB1 is the older
20 deprecated version of the protocol but it has been extended to support
21 POSIX features (See [1]). The equivalent extensions for the newer
22 recommended version of the protocol (SMB3) have not been fully
23 implemented yet which means SMB3 doesn't support some required POSIX
24 file system objects (e.g. block devices, pipes, sockets).
25
26 As a result, a CIFS root will default to SMB1 for now but the version
27 to use can nonetheless be changed via the 'vers=' mount option.  This
28 default will change once the SMB3 POSIX extensions are fully
29 implemented.
30
31 Server configuration
32 ====================
33
34 To enable SMB1+UNIX extensions you will need to set these global
35 settings in Samba smb.conf:
36
37     [global]
38     server min protocol = NT1
39     unix extension = yes        # default
40
41 Kernel command line
42 ===================
43
44 root=/dev/cifs
45
46 This is just a virtual device that basically tells the kernel to mount
47 the root file system via SMB protocol.
48
49 cifsroot=//<server-ip>/<share>[,options]
50
51 Enables the kernel to mount the root file system via SMB that are
52 located in the <server-ip> and <share> specified in this option.
53
54 The default mount options are set in fs/cifs/cifsroot.c.
55
56 server-ip
57         IPv4 address of the server.
58
59 share
60         Path to SMB share (rootfs).
61
62 options
63         Optional mount options. For more information, see mount.cifs(8).
64
65 Examples
66 ========
67
68 Export root file system as a Samba share in smb.conf file.
69
70 ...
71 [linux]
72         path = /path/to/rootfs
73         read only = no
74         guest ok = yes
75         force user = root
76         force group = root
77         browseable = yes
78         writeable = yes
79         admin users = root
80         public = yes
81         create mask = 0777
82         directory mask = 0777
83 ...
84
85 Restart smb service.
86
87 # systemctl restart smb
88
89 Test it under QEMU on a kernel built with CONFIG_CIFS_ROOT and
90 CONFIG_IP_PNP options enabled.
91
92 # qemu-system-x86_64 -enable-kvm -cpu host -m 1024 \
93   -kernel /path/to/linux/arch/x86/boot/bzImage -nographic \
94   -append "root=/dev/cifs rw ip=dhcp cifsroot=//10.0.2.2/linux,username=foo,password=bar console=ttyS0 3"
95
96
97 1: https://wiki.samba.org/index.php/UNIX_Extensions