728x90
728x90
1. 저장 공간 Disk 생성 / 추가
[root@document ~]# fdisk -l
Disk /dev/xvda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5cf662b2
Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 2048 2099199 2097152 1G 83 Linux
/dev/xvda2 2099200 8390655 6291456 3G 82 Linux swap / Solaris
/dev/xvda3 8390656 62914559 54523904 26G 83 Linux
Disk /dev/xvdb: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@document ~]# fdisk /dev/xvdb
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-1048575999, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1048575999, default 1048575999):
Created a new partition 1 of type 'Linux' and of size 500 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@document ~]# fdisk -l
Disk /dev/xvda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5cf662b2
Device Boot Start End Sectors Size Id Type
/dev/xvda1 * 2048 2099199 2097152 1G 83 Linux
/dev/xvda2 2099200 8390655 6291456 3G 82 Linux swap / Solaris
/dev/xvda3 8390656 62914559 54523904 26G 83 Linux
Disk /dev/xvdb: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xff15473e
Device Boot Start End Sectors Size Id Type
/dev/xvdb1 2048 1048575999 1048573952 500G 83 Linux
[root@document ~]# mkfs.ext4 /dev/xvdb1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 131071744 4k blocks and 32768000 inodes
Filesystem UUID: 99478000-d87f-4397-b4e3-0c2a5394f81c
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
2. 마운트
[root@document ~]# mkdir /document
[root@document ~]# mount /dev/xvdb1 /document/
[root@document ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 8.5M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/xvda3 26G 2.2G 24G 9% /
/dev/xvda1 1014M 337M 678M 34% /boot
tmpfs 767M 0 767M 0% /run/user/0
/dev/xvdb1 492G 28K 467G 1% /document
3. fstab 추가
[root@document ~]# vi /etc/fstab
/dev/xvdb1 /document ext4 defaults 0 0
4. fstab 확인
[root@document ~]# umount /document
[root@document ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda3 26G 2.2G 24G 9% /
/dev/xvda1 1014M 337M 678M 34% /boot
tmpfs 767M 0 767M 0% /run/user/0
[root@document ~]# mount -a
[root@document ~]# df -h
/dev/xvdb1 492G 28K 467G 1% /document
5. 업데이트
[root@document ~]#yum update
6. samba 설치
[root@document ~]# dnf install samba
7. 공유 디렉토리 권한 수정
[root@document /]# ll
drwxr-xr-x. 3 root root 4096 Apr 2 16:57 document
drwxr-xr-x. 80 root root 8192 Apr 2 17:05 etc
drwxr-xr-x. 3 root root 20 Sep 20 2023 home
[root@document /]# chmod 777 document/
[root@document /]# ll
drwxrwxrwx. 3 root root 4096 Apr 2 16:57 document
drwxr-xr-x. 80 root root 8192 Apr 2 17:05 etc
drwxr-xr-x. 3 root root 20 Sep 20 2023 home
8. user 생성
[root@document /]# useradd doc_admin
[root@document /]# smbpasswd -a doc_admin
New SMB password:
Retype new SMB password:
Added user doc_admin.
9. smb.conf 설정
[root@document /]# cd /etc/samba
[root@document samba]# ls
lmhosts smb.conf smb.conf.example
[root@document samba]# cp smb.conf smb.conf.bak
[root@document samba]# ls
lmhosts smb.conf smb.conf.bak smb.conf.example
[root@document samba]#
[root@document samba]# vi smb.conf
-----------추가---------------------
[document]
comment = doc share
path = /document
read only = no
writable = yes
guest ok = no
create mask = 0777
directory mask = 0777
-------------------------------------
10. 방화벽 해제 / 서비스 자동 시작
[root@document samba]# systemctl stop firewalld
[root@document samba]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@document samba]#
[root@document samba]# systemctl status smb.service
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendo>
Active: inactive (dead)
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
[root@document samba]# systemctl start smb.service
[root@document samba]# systemctl status smb.service
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendo>
Active: active (running) since Tue 2024-04-02 17:13:47 KST; 1s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 23118 (smbd)
Status: "smbd: ready to serve connections..."
Tasks: 3 (limit: 48814)
Memory: 10.9M
CGroup: /system.slice/smb.service
├─23118 /usr/sbin/smbd --foreground --no-process-group
├─23120 /usr/sbin/smbd --foreground --no-process-group
└─23121 /usr/sbin/smbd --foreground --no-process-group
Apr 02 17:13:47 document systemd[1]: Starting Samba SMB Daemon...
Apr 02 17:13:47 document smbd[23118]: [2024/04/02 17:13:47.813423, 0] >
Apr 02 17:13:47 document smbd[23118]: smbd version 4.18.6 started.
Apr 02 17:13:47 document smbd[23118]: Copyright Andrew Tridgell and t>
Apr 02 17:13:47 document systemd[1]: Started Samba SMB Daemon.
[root@document ~]# systemctl enable smb
Created symlink /etc/systemd/system/multi-user.target.wants/smb.service → /usr/lib/systemd/system/smb.service.
11. 접속 확인 / 파일 생성 확인
728x90
'IT > LINUX' 카테고리의 다른 글
rocky8 ntp 서버 만들기 (0) | 2024.05.16 |
---|---|
Rocky 에서 3TB 이상 디스크 추가 하기 (0) | 2024.04.16 |
linux magaraid gui 설치 방법 (0) | 2023.11.09 |
rocky8 Glusterfs 구성 (0) | 2023.11.07 |
Centos7 LVM root 용량 증설 하는 방법 (0) | 2023.05.10 |