106 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3===========================================4Mounting root file system via SMB (cifs.ko)5===========================================6 7Written 2019 by Paulo Alcantara <palcantara@suse.de>8 9Written 2019 by Aurelien Aptel <aaptel@suse.com>10 11The CONFIG_CIFS_ROOT option enables experimental root file system12support over the SMB protocol via cifs.ko.13 14It introduces a new kernel command-line option called 'cifsroot='15which will tell the kernel to mount the root file system over the16network by utilizing SMB or CIFS protocol.17 18In order to mount, the network stack will also need to be set up by19using 'ip=' config option. For more details, see20Documentation/admin-guide/nfs/nfsroot.rst.21 22A CIFS root mount currently requires the use of SMB1+UNIX Extensions23which is only supported by the Samba server. SMB1 is the older24deprecated version of the protocol but it has been extended to support25POSIX features (See [1]). The equivalent extensions for the newer26recommended version of the protocol (SMB3) have not been fully27implemented yet which means SMB3 doesn't support some required POSIX28file system objects (e.g. block devices, pipes, sockets).29 30As a result, a CIFS root will default to SMB1 for now but the version31to use can nonetheless be changed via the 'vers=' mount option. This32default will change once the SMB3 POSIX extensions are fully33implemented.34 35Server configuration36====================37 38To enable SMB1+UNIX extensions you will need to set these global39settings in Samba smb.conf::40 41 [global]42 server min protocol = NT143 unix extension = yes # default44 45Kernel command line46===================47 48::49 50 root=/dev/cifs51 52This is just a virtual device that basically tells the kernel to mount53the root file system via SMB protocol.54 55::56 57 cifsroot=//<server-ip>/<share>[,options]58 59Enables the kernel to mount the root file system via SMB that are60located in the <server-ip> and <share> specified in this option.61 62The default mount options are set in fs/smb/client/cifsroot.c.63 64server-ip65 IPv4 address of the server.66 67share68 Path to SMB share (rootfs).69 70options71 Optional mount options. For more information, see mount.cifs(8).72 73Examples74========75 76Export root file system as a Samba share in smb.conf file::77 78 ...79 [linux]80 path = /path/to/rootfs81 read only = no82 guest ok = yes83 force user = root84 force group = root85 browseable = yes86 writeable = yes87 admin users = root88 public = yes89 create mask = 077790 directory mask = 077791 ...92 93Restart smb service::94 95 # systemctl restart smb96 97Test it under QEMU on a kernel built with CONFIG_CIFS_ROOT and98CONFIG_IP_PNP options enabled::99 100 # qemu-system-x86_64 -enable-kvm -cpu host -m 1024 \101 -kernel /path/to/linux/arch/x86/boot/bzImage -nographic \102 -append "root=/dev/cifs rw ip=dhcp cifsroot=//10.0.2.2/linux,username=foo,password=bar console=ttyS0 3"103 104 1051: https://wiki.samba.org/index.php/UNIX_Extensions106