← Documents Documentation/filesystems/smb/cifsroot.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems / SMB

Mounting root file system via SMB (cifs.ko)

CIFS 네트워크 루트의 제약, Samba 설정과 커널 명령줄을 다루는 전문 번역입니다.

Source pathDocumentation/filesystems/smb/cifsroot.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

cifsroot.rst:1-105

`CONFIG_CIFS_ROOT`는 `cifs.ko`로 SMB share를 Linux 루트 파일 시스템에 올리는 네트워크 부팅 기능이다. `ip=`, `root=/dev/cifs`, `cifsroot=//server/share[,options]`를 함께 사용하며 현재 POSIX 객체 요구 때문에 SMB1+UNIX Extensions가 기본이다.

CIFS root 핵심
`ip=` 네트워크`root=/dev/cifs` 가상 root`cifsroot=` 서버·share·옵션Samba export`cifs.ko` root mount

부팅에 필요한 세 입력을 결합한다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

SMB로 루트 파일 시스템 마운트

1-34

`CONFIG_CIFS_ROOT`는 `cifs.ko`를 통해 SMB 프로토콜 위에 루트 파일 시스템을 올리는 실험적 기능을 활성화한다. 새 커널 명령줄 옵션 `cifsroot=`가 SMB 또는 CIFS 네트워크 위치를 루트로 마운트하도록 지시하며, 네트워크 스택은 `ip=` 옵션으로 함께 설정해야 한다. 자세한 네트워크 부팅 형식은 `Documentation/admin-guide/nfs/nfsroot.rst`를 참조한다.

현재 CIFS 루트는 Samba 서버가 제공하는 SMB1+UNIX Extensions를 요구한다. SMB1은 폐기 예정인 오래된 dialect지만 block device, pipe, socket 같은 POSIX 객체를 지원하도록 확장되었다. 권장되는 SMB3의 동등한 POSIX 확장은 이 문서 시점에 완전히 구현되지 않아 필요한 객체 일부를 표현하지 못한다.

그 결과 CIFS 루트는 당분간 SMB1을 기본값으로 사용한다. 다만 `vers=` mount 옵션으로 dialect를 바꿀 수 있으며, SMB3 POSIX 확장이 완성되면 기본값도 바뀔 예정이다.

CIFS 루트 부팅 경로
`CONFIG_CIFS_ROOT`와 `CONFIG_IP_PNP` 활성화`ip=`로 부팅 중 네트워크 구성`root=/dev/cifs`로 가상 root 장치 선택`cifsroot=//server/share[,options]` 해석`cifs.ko`가 SMB share를 루트 파일 시스템으로 마운트

커널 명령줄에서 네트워크 설정과 SMB root 위치를 함께 넘긴다.

.. SPDX-License-Identifier: GPL-2.0

===========================================
Mounting root file system via SMB (cifs.ko)
===========================================

Written 2019 by Paulo Alcantara <[email protected]>

Written 2019 by Aurelien Aptel <[email protected]>

The CONFIG_CIFS_ROOT option enables experimental root file system
support over the SMB protocol via cifs.ko.

It introduces a new kernel command-line option called 'cifsroot='
which will tell the kernel to mount the root file system over the
network by utilizing SMB or CIFS protocol.

In order to mount, the network stack will also need to be set up by
using 'ip=' config option. For more details, see
Documentation/admin-guide/nfs/nfsroot.rst.

A CIFS root mount currently requires the use of SMB1+UNIX Extensions
which is only supported by the Samba server. SMB1 is the older
deprecated version of the protocol but it has been extended to support
POSIX features (See [1]). The equivalent extensions for the newer
recommended version of the protocol (SMB3) have not been fully
implemented yet which means SMB3 doesn't support some required POSIX
file system objects (e.g. block devices, pipes, sockets).

As a result, a CIFS root will default to SMB1 for now but the version
to use can nonetheless be changed via the 'vers=' mount option.  This
default will change once the SMB3 POSIX extensions are fully
implemented.

Samba와 커널 명령줄 구성

35-72

Samba에서 SMB1+UNIX Extensions를 허용하려면 `smb.conf`의 `[global]`에 `server min protocol = NT1`과 `unix extension = yes`를 둔다. 후자는 기본값이다.

커널 명령줄의 `root=/dev/cifs`는 실제 block device가 아니라 SMB로 루트를 마운트하라는 가상 장치 표식이다. `cifsroot=//<server-ip>/<share>[,options]`는 서버 IPv4 주소와 rootfs share 경로, 선택적 mount 옵션을 전달한다.

기본 mount 옵션은 `fs/smb/client/cifsroot.c`에 정의되어 있다. 추가 옵션의 의미는 `mount.cifs(8)`을 따른다.

`cifsroot=` 매개변수
필드의미
`server-ip`SMB 서버의 IPv4 주소
`share`루트 파일 시스템으로 사용할 SMB share 경로
`options``mount.cifs(8)` 형식의 선택 mount 옵션
기본 옵션`fs/smb/client/cifsroot.c`에 정의

네트워크 루트 위치와 선택 옵션을 구성하는 필드다.

Server configuration
====================

To enable SMB1+UNIX extensions you will need to set these global
settings in Samba smb.conf::

    [global]
    server min protocol = NT1
    unix extension = yes        # default

Kernel command line
===================

::

    root=/dev/cifs

This is just a virtual device that basically tells the kernel to mount
the root file system via SMB protocol.

::

    cifsroot=//<server-ip>/<share>[,options]

Enables the kernel to mount the root file system via SMB that are
located in the <server-ip> and <share> specified in this option.

The default mount options are set in fs/smb/client/cifsroot.c.

server-ip
        IPv4 address of the server.

share
        Path to SMB share (rootfs).

options
        Optional mount options. For more information, see mount.cifs(8).

Samba export와 QEMU 부팅 예제

73-105

예제 `smb.conf`는 `[linux]` share가 `/path/to/rootfs`를 가리키게 하고, guest 접근과 root 강제 사용자·그룹, 쓰기, 공개 browse, `0777` 생성·디렉터리 mask를 설정한다. 이는 테스트용으로 매우 개방적인 설정이므로 실제 운영 환경에서는 인증과 권한을 별도로 제한해야 한다.

설정 뒤 `systemctl restart smb`로 서비스를 다시 시작한다. `CONFIG_CIFS_ROOT`와 `CONFIG_IP_PNP`를 켠 커널은 QEMU에서 `root=/dev/cifs rw ip=dhcp`와 `cifsroot=//10.0.2.2/linux,username=foo,password=bar`를 전달해 시험할 수 있다.

마지막 참고 링크는 Samba의 UNIX Extensions 설명을 가리킨다.

QEMU CIFS root 테스트 요소
인자역할
`-kernel .../bzImage`시험할 커널 이미지
`root=/dev/cifs rw`SMB 루트를 읽기·쓰기로 선택
`ip=dhcp`부팅 중 DHCP 네트워크 구성
`cifsroot=//10.0.2.2/linux,...`share와 자격 증명
`console=ttyS0 3`직렬 콘솔과 runlevel

예제 명령의 핵심 인자를 역할별로 나눈다.

Examples
========

Export root file system as a Samba share in smb.conf file::

    ...
    [linux]
            path = /path/to/rootfs
            read only = no
            guest ok = yes
            force user = root
            force group = root
            browseable = yes
            writeable = yes
            admin users = root
            public = yes
            create mask = 0777
            directory mask = 0777
    ...

Restart smb service::

    # systemctl restart smb

Test it under QEMU on a kernel built with CONFIG_CIFS_ROOT and
CONFIG_IP_PNP options enabled::

    # qemu-system-x86_64 -enable-kvm -cpu host -m 1024 \
    -kernel /path/to/linux/arch/x86/boot/bzImage -nographic \
    -append "root=/dev/cifs rw ip=dhcp cifsroot=//10.0.2.2/linux,username=foo,password=bar console=ttyS0 3"


1: https://wiki.samba.org/index.php/UNIX_Extensions