728x90
반응형
  • 리눅스환경 에서 날짜를 변경하는 방법에 대해 설명 합니다. 
  • Rocky Linux 환경에서는 Centos 에서 지원하는 rdate 를 더이상 지원하지 않는다 
  • Rokcy Lunux 에서 시간을 변경하는 방법으로 timedatectl  명령을 사용하여 시간을 변경할수 있다 
  • timedatectl 명령을 통해 현재 서버의 날짜와 시간을 변경하는 방법에 대해 알아보겠습니다. 

timedatectl  설명

  • 현재시간을 확인하고 임으로 날짜 및 변경하는 방법은 아래 작성한 내용과 같다. 
  • 단  임으로 시간 병경후 NTP  동기화 설정시 바로 현재 시간으로 동기화 되지 않는 이유는 
  • NTP 가 시간이 일정 간격으로 서서히 조정되도록 설계 되어 있어 바로 현재 시간이 적용 되지 않는다고 한다. 
  • 바로 현재 시간으로 동기화를 하기 위해서는 chrony 나 ntpd(Rocky Linux 에서는 지원하지 않음) 를 이용해서 현재 시간으로 업데이트 할수 있다 . 

timedatectl  기능 

#현재 시간 확인 하기
timedatectl


#시간대 설정방법 (ex: 서울):
timedatectl set-timezone Asia/Seoul


#직접 날짜와 시간 설정  하기
#timedatectl set-time 'YYYY-MM-DD HH:MM:SS'
timedatectl set-time '2024-11-10 15:30:00'

#NTP(Network Time Protocol) 동기화 활성화
timedatectl set-ntp true
#timedatectl set-ntp false

 

chrony 사용법 

  • 설치 및 서비스 시작 방법
#설치
dnf install chrony

#서비스 시작
systemctl enable --now chronyd

#서버시간 즉시 시간 동기화 
chronyc -a makestep

 

 

시간 변경 방법

  • ntp 동기화 설정이 되어있다면 임으로 시간 변경을 할수 없다 .
    • Failed to set time: Automatic time synchronization is enabled 발생
  • timedatectl set-ntp false 를 통해  ntp 동기화 설정을 꺼두고 시간 변경이 완료 된후 현재 시간으로 
  • 시간으로 동기화 하고 싶다면 timedatectl set-ntp true 이후 chronyc 서비스를 활성화 시키면 된다. 
[root@rocky9.4:/root]$ date
Tue Nov 12 13:43:48 KST 2024
[root@rocky9.4:/root]$ timedatectl set-time '2023-11-10 15:30:00'
Failed to set time: Automatic time synchronization is enabled
[root@rocky9.4:/root]$  timedatectl set-ntp false
[root@rocky9.4:/root]$ timedatectl set-time '2023-11-10 15:30:00'
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:01 KST 2023
[root@rocky9.4:/root]$ timedatectl set-ntp true
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:06 KST 2023
[root@rocky9.4:/root]$ chronyc -a makestep
200 OK
[root@rocky9.4:/root]$ date
Fri Nov 10 15:30:10 KST 2023
[root@rocky9.4:/root]$ systemctl enable --now chronyd
[root@rocky9.4:/root]$ date
Tue Nov 12 13:44:20 KST 2024
[root@rocky9.4:/root]$ 

 

 

 

728x90
반응형
728x90
반응형

Rocky  리눅스 호스트 네임 변경 방법 

현재 Hostname 정보를 확인 합니다.

hostnamectl

 

[root@localhost.localdomain:/root]$ hostnamectl
   Static hostname: (unset)                           
Transient hostname: localhost
         Icon name: computer-desktop
           Chassis: desktop 🖥️
        Machine ID: 3e35814fabc440c3b52a0d066c4cb597
           Boot ID: 3cbdfef1a6dc4dbfb22d2356fd23fce8
  Operating System: Rocky Linux 9.4 (Blue Onyx)       
       CPE OS Name: cpe:/o:rocky:rocky:9::baseos
            Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
      Architecture: x86-64
   Hardware Vendor: Gigabyte Technology Co., Ltd.
    Hardware Model: B360M-D3H
  Firmware Version: F11
[root@localhost.localdomain:/root]$ 

 

변경할 Hostname 을 설정 합니다. 

 

# hostname [변경할 hostname]
hostname rocky9

 

Hostname 영구적으로 변경 

# hostnamectl set-hostname [new-hostname]
hostnamectl set-hostname rocky9.4

 

/etc/hostname 변경 

[root@rocky9.4:/root]$ vi /etc/hostname
rocky9.4

 

Rocky  리눅스 방화벽 해제 

#방화벽 중지 
systemctl stop firewalld.service 

#방화벽 영구 비활성화
systemctl disable firewalld.service 

#방화벽 상태 확인 
status firewalld

#방화벽 활성화
#systemctl start firewalld.service

 

[root@rocky9.4:/root]$ systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:firewalld(1)

Nov 05 09:33:36 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 05 09:33:36 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 06 19:27:56 rocky9.4 systemd[1]: firewalld.service: Deactivated successfully.
Nov 06 19:27:56 rocky9.4 systemd[1]: Stopped firewalld - dynamic firewall daemon.

 

SSH Root 로그인하는 접속허용방법

  • Rocky 리눅스에서는 ssh 접속시  기본적으로 ROOT 접속을 허용 하지 않는다.
  • root 로 ssh 접속하기 위해서는 아래의 수정 사항이 필요하다.
  • /etc/ssh/sshd_config 파일을 수정 하여 PermitRootLogin yes 를 추가한다. 
  • 이후 ssh 를 재시작 한다. 
#vi /etc/ssh/sshd_config
# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes

#ssh 데몬 재시작
systemctl restart sshd

 

728x90
반응형

'06.OS > Linux' 카테고리의 다른 글

[Linux]Rocky 9.4 시간 변경  (0) 2024.11.13
[Rocky]Linux FileSystem Mount 정보 확인하기  (0) 2024.11.09
[문자열 검색] 문자열 찾기 방법  (0) 2024.11.08
[Linux]Curl 사용 방법  (1) 2024.09.26
[Rocky] Rocky Linux 웹 콘솔  (0) 2024.06.07
728x90
반응형
  • 리눅스에 추가된 디스크가  Mount 되었는지 확인하는 방법에 대해 설명 합니다. 
  • mount -l 명령을 통해 확인을 해볼수 있지만 확인하는게 불편하고 가독성도 떨어집니다. 
  • findmnt 는 mount 명령보다 사용자가 보기쉽게 마운트된 디스크 정보를 가독성 있게 출력 해줍니다. 

findmnt 사용 방법 

  • findmnt 명령은  mount, /etc/fstab, /proc/mounts  정보를 트리 형태로 한번에 제공하는 명령입니다. 
  • 아랯 추가된 디스크 정보에 대해 현재 Mount 된 디스크 정보를 확인하는 방법에 대해 설명 합니다. 
fdisk -l
lsblk
mount -l 
df -Th

 

 

기본 사용법

#마운트된 모든 파일 시스템이 트리 구조로 표시 함.
findmnt

 

특정 파일 시스템 조회

findmnt -t ext2,xfs

마운트된 디렉토리 디스크 정보 조회

findmnt /home
findmnt /data

디스크 마운트 정보 확인 

findmnt /dev/nvme0n1 

findmnt /dev/sdc1

출력 헤더 지정 

findmnt -o TARGET,SOURCE,FSTYPE

 

추가 ) 마운트 안된 디스크 마운트 하기 

#디스크 포멧
mkfs.ext2 /dev/sda    
mkfs.ext2 /dev/sdb    

#마운트할 디렉토리 생성 
mkdir /ssd
mkdir /hdd

#mount 
mount -t ext2 /dev/sda /ssd
mount -t ext2 /dev/sdb /hdd

#/etc/fstab 적용 (디스크 마운트 영구 적용) 
/dev/sda              /ssd                  ext2    defaults        0 0
/dev/sdb              /hdd                  ext2    defaults        0 0

 

추가 증설한 Disk 에대해 파티셔닝 하는 방법은 아래 글을 확인 하세요 

https://growupcoding.tistory.com/84

 

[Linux] 하드 디스크 추가(mount) 하기

리눅스 하드 디스크 추가 방법 리눅스에 새로운 하드디스크 추가시 마운트 하는 방법에 대해 알아 보겠습니다. umount umount /dev/sda1 하드디스크 마운트 정보 확인 (fdisk -l ) [root@centos7:/root]$ fdisk -l D

growupcoding.tistory.com

 

728x90
반응형
728x90
반응형
  • 문자열을 찾는 방법에 대해 작성 합니다. 

Grep 을 사용한 문자열 찾기 

  • 아래 테스트 로그를 이용해 문자열을 찾는 방법을 알아본다 .
  • test.log 파일 내용
--- 0 Error in 17 cases - ._130_line_3729_case
--- 0 Warning in 18 cases - ._143_line_7455_case
--- 0 Error in 19 cases - ._147_line_7455_case
--- 0 fails in 17 cases - ._130_line_3729_case
--- 0 Warning in 18 cases - ._143_line_7455_case
--- 0 Info in 19 cases - ._147_line_7455_case
--- 0 Info in 19 cases - ._148_line_7455_case
--- 0 Info in 19 cases - ._149_line_7459_case
--- 0 Info in 19 cases - ._150_line_7459_case
--- 0 Info in 19 cases - ._151_line_7459_case
--- 0 Info in 19 cases - ._152_line_7459_case

 

대소문자 구분없이 문자열 라인 찾기

# test.log 파일 에서 Error 또는 Warning 문자를 포함한 라인을 출력 하는 예제이다.
grep -in -E "Error|Warning" test.log

 

 위 예제에서 사용한 옵션은 아래와 같다. 

  • -i: 대소문자 구분 없이 검색
  • -n: 라인 번호 출력
  • -E: 확장된 정규 표현식 사용 
  • "Error|Warning": Error 또는 Warning 을 의미하는 정규 표현식 (둘 중 하나가 포함된 라인을 찾음)
  • test.log: 검색할 파일명

찾은 문자열을 분리해서 특정 숫만 출력 하기 

  • 정규식 과 sed 사용 
grep -o 'line_[0-9]\+_case' test.log | sed 's/[^0-9]*\([0-9]\+\)[^0-9]*/\1/g'
$ grep -o 'line_[0-9]\+_case' test.log | sed 's/[^0-9]*\([0-9]\+\)[^0-9]*/\1/g'
3729
7455
7455
3729
7455
7455
7455
7459
7459
7459
7459

 

찾은 문자열을 중복 제거하고 정렬 하기 

  • 정규식 과 sed 사용 + sort (정렬) + uniq(중복 제거) 
grep -o 'line_[0-9]\+_case'  test.log  | sed 's/[^0-9]*\([0-9]\+\)[^0-9]*/\1/g' | sort -n | uniq
$ grep -o 'line_[0-9]\+_case'  test.log  | sed 's/[^0-9]*\([0-9]\+\)[^0-9]*/\1/g' | sort -n | uniq
3729
7455
7459

 

 

 

728x90
반응형
728x90
반응형

Curl (client url) 이란?

curl은 Linux, Unix, Windows 등 다양한 운영 체제에서 사용 가능한 명령줄 도구로, URL을 통해 데이터를 전송하거나 다운로드하는 데 사용됩니다. HTTP, HTTPS, FTP, FTPS, SCP, SFTP, LDAP, POP3, IMAP, SMTP 등 다양한 프로토콜을 지원 한다. 

 

 

Crul 주요 기능 

  • 웹 요청 및 응답 처리: 웹 서버에 요청을 보내고 응답 테스트를 진행 할때 사용 한다.
  • 파일 다운로드 및 업로드: curl을 사용해 원격 서버에서 파일을 다운로드하거나, 서버로 파일을 Upload 시킬수 있다.
  • API 테스트: REST API 또는 기타 HTTP 기반 API를 테스트를 할수 있다. 

Crul 설치

# Ubuntu
sudo apt update
sudo apt install curl

# Rocky Linux
dnf install curl 

#CentOS
yum install curl

curl 정보 확인 

#버전 정보 확인 
crul -v 

# 테스트사용 방법 확인 
crul --manaul

#사용 옵션 확인 
crul -help

 

curl 기본 사용 방법

  • curl [옵션] [URL]

리모트 서버 포트 통신 확인 (방화벽 상태 확인)

  • ssh 22번 포트 정상 접속 확인
 curl -v telnet 192.168.116.210:22

  • 방화벽에 포트가 막혀 있거나 접속이 불가 할경우 아래 처럼 연결이 거부 된다.

 

웹 페이지  호출

curl http://google.com

파일 다운로드

  • -O 옵션은 URL에서 파일을 다운로드하고, 원래 파일 이름으로 저장
curl -O https://example.com/file.txt

 

파일 업로드 (POST 요청)

  • -X는 HTTP 메서드를 지정하며, -F는 파일을 전송하는 옵션 이다.
curl -X POST -F "file=@/path/to/file" https://example.com/upload

 

 

주요 옵션들

  • -o [파일명]: 출력 내용을 지정한 파일로 저장.
  • -O: URL에서 추출한 이름으로 파일을 저장.
  • -I: 헤더 정보만 출력.
  • -X: HTTP 메서드를 지정 (GET, POST, PUT, DELETE 등).
  • -d: 데이터를 전송 (POST 요청).
  • -H: 헤더 정보 추가.
  • -F: 파일 전송에 사용.
  • -u: 사용자 이름과 비밀번호로 인증.
  • --proxy: 프록시 서버를 통해 요청.
  • -k: SSL 인증서 오류 무시.

 

728x90
반응형
728x90
반응형

리눅스 웹 콘솔 

  • 웹 콘솔 기능은 Red Hat Enterprise Linux (RHEL) 웹 콘솔은 RHEL 8부터 기본 기능으로 포함되었습니다. 이 웹 콘솔은 Cockpit 프로젝트에 기반을 두고 있으며, 이를 통해 웹 기반의 시스템 관리 인터페이스를 제공하고 있습니다.

접근 방법 및 설치 

dnf install cockpit
systemctl enable --now cockpit.socket

firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload

 

 

WebConsole Root 접속 방법 

vi /etc/cockpit/disallowed-users 파일 편집 -> root 주석 

[root@my-rocky9 ~]# vi /etc/cockpit/disallowed-users
# List of users which are not allowed to login to Cockpit
#root

 

WebConsole  기능 확인 

  • https://<서버의 IP 주소 또는 호스트 이름>:9090 접속 

 

녹화_2024_02_01_16_31_00_690.mp4
4.04MB

 

 

  • 포트 변경 필요시 vi /etc/systemd/system/sockets.target.wants/cockpit.socket  파일을 열어 ListenStream 포트를 변경 합니다. 
vi /etc/systemd/system/sockets.target.wants/cockpit.socket

 

728x90
반응형
728x90
반응형

리눅스 SELinux 변경 이후  리눅스 재부팅시 에러 해결 방법 

  • 부팅시 Failed to load SELinux policy, freezing. 에러 발생 

 

/etc/selinux/config   파일을 수정이후 부팅이 실패 할 경우 

[root@centos7:/root]$ cat  /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
[root@centos7:/root]$

 

  • 부팅 화면에서 키보드 e 를 누르고 

  • selinux=0 추가 후 재부팅
  • Ctrl + x  를 누르면 다시 부팅이 된다. 

 

 

SELinux 란? 

SELinux(보안 강화 리눅스)는 리눅스 운영 체제의 보안 기능 중 하나로, 프로세스, 파일 및 네트워크에 대한 접근을 제어하는 매커니즘입니다. SELinux는 NSA(미국 국가 안보국)와 레드햇이 공동으로 개발한 프로젝트로, 리눅스 커널에 포함되어 있습니다.

 

  • /etc/selinux/config 파라미터 설명 
    • enforcing 모드: 모든 SELinux 정책이 적용되고 보안 위반이 감지되면 해당 작업이 차단됩니다.
    • permissive 모드: SELinux는 로그를 기록하지만 작업을 차단하지는 않습니다.
    • disabled 모드: SELinux가 완전히 비활성화됩니다.
728x90
반응형
728x90
반응형

 

  • cannot create temp file for here-document: 장치에 남은 공간이 없음 에러가 발생할 경우 
  • 리눅스 용량 부족시 디스크 추가하는 방법에 대해 정리합니다. 

 => cannot create temp file for here-document: 장치에 남은 공간이 없음

현재 디스크 사용량 확인 

  • df -Th 명령을 통해 현재 사용중인 디스크 사용량을 확인합니다. 
[root@mysvr:/root]$ df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs                   tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs                   tmpfs     1.9G   13M  1.9G   1% /run
tmpfs                   tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs       6.0G  6.0G  3.5M 100% /
/dev/sda1               xfs      1014M  185M  830M  19% /boot
/dev/mapper/centos-home ext2       25G  8.9G   15G  38% /home
tmpfs                   tmpfs     378M  8.0K  378M   1% /run/user/42
tmpfs                   tmpfs     378M     0  378M   0% /run/user/0

 

  • lvdisplay 확인 
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                cwMNqw-gJSs-7nDO-GrRU-bgxE-FLB5-7acfhK
  LV Write Access        read/write
  LV Creation host, time localhost, 2023-03-09 07:40:48 +0900
  LV Status              available
  # open                 2
  LV Size                8.00 GiB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                kRPPw7-Ffr2-Bf20-CsE9-UDkt-aCdO-Y4DvFo
  LV Write Access        read/write
  LV Creation host, time localhost, 2023-03-09 07:40:48 +0900
  LV Status              available
  # open                 1
  LV Size                <6.00 GiB
  Current LE             1535
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

 

디스크 추가 

  • fdisk -l 을 통해 추가한 disk 정보를 확인 합니다. 
  • 용량 증설을 위해 hdd 를 20G 추가 했습니다. 

 

  • 추가한 디스크에 대해 파티션을 생성 합니다. 
  • fdisk /dev/sdb
[root@mysvr:/root]$ fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x8135267e.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048): =>엔터
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): =>엔터
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

 

  • 파티셔닝한 디스크 /dev/sdb1 를 Physical Volume 생성 한다.
  • pvscan 이나 pvdisplay 명령을 통해 pysical volume 정보를 확인 한다. 
pvcreate  /dev/sdb1
pvscan
pvdisplay

 

  • vgextend 명령을 통해 centos 볼륨 그룹에 새로 추가한 pysical volume 를 확장 한다.
vgextend centos /dev/sdb1

 

  • lvextend 명령을 통해 부족했던 lvm 을 확장 합니다. 
lvextend /dev/mapper/centos-root -l +100%FREE

 

  • pvscan 명령을 통해 centos 으로 pv 가 추가 되었는지 확인 한다.

 

  • xfs_growfs 명령을 통해 논리 볼륨을 resizing 한다. 
    • ext4  포멧일 경울 resize2fs /dev/mapper/centos-root 수행 합니다. 
    • xfs type 에 대해  resize2fs 명령을 수행 하면 아래 처럼 에러가 발생함.

[root@mysvr:/root]$ resize2fs /dev/mapper/centos-root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.
[root@mysvr:/root]$ blkid /dev/mapper/centos-root
/dev/mapper/centos-root: UUID="f4704f6c-5120-4c0f-b46b-7a0c31f390e5" TYPE="xfs" 

 

  • xfs_growfs 를 수행 하지 않으면 용량 증설이 되지 않는다.
xfs_growfs /dev/mapper/centos-root

 

  • df -Th 명령을 통해 용량이 증설 되었는지 확인 
  • 6G 에서 20G 로 용량이 증설 된것을 확인 할수 있다.

 

 

728x90
반응형
728x90
반응형

리눅스 하드 디스크 추가 방법

리눅스에 새로운 하드디스크 추가시 마운트 하는 방법에 대해 알아 보겠습니다. 

 

umount 

umount /dev/sda1

 

하드디스크 마운트 정보 확인 (fdisk -l )

[root@centos7:/root]$ fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       60801   488279610   8e  Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121601   976760001   83  Linux

파티션 분리

[root@centos7:/]$ fdisk /dev/sdb

The number of cylinders for this disk is set to 121601.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): h
h: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

Command (m for help): d
No partition is defined yet!

Command (m for help): d
No partition is defined yet!

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n 
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1 <-- 첫번째 파티션
First cylinder (1-121601, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601): +500g <-- 첫번째 파티션 500g

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2 <-- 두번째 파티션
First cylinder (60790-121601, default 60790):
Using default value 60790
Last cylinder or +size or +sizeM or +sizeK (60790-121601, default 121601): <-- 나머지 파티션
Using default value 121601

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Mount 디렉토리 생성 및 포멧

#마운트할 디렉 토리 생성
mkdir data1
mkdir data2

#ext3 포멧으로 하드디스크 포멧
mkfs.ext3 /dev/sda1

생성 디렉토리에 하드 디스크 마운트

mount -t ext3 /dev/sdb1 /data1
mount -t ext3 /dev/sdb2 /data2

Mount 디렉토리 부팅 설정

  • /etc/fstab 파일 수정
/dev/sdb1               /data1                  ext3    defaults        0 0
/dev/sdb2               /data2                  ext3    defaults        0 0

 

[root@centos7:/]$ vi /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/sdb1               /data1                  ext3    defaults        0 0
/dev/sdb2               /data2                  ext3    defaults        0 0

추가된 하드디스크 마운트 확인 (df -h)

[root@centos7:/root]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      448G  343G   82G  81% /
/dev/sda1              99M   26M   68M  28% /boot
tmpfs                 2.9G     0  2.9G   0% /dev/shm
/dev/sdb1             917G  200M  871G   1% /data
728x90
반응형
728x90
반응형

리눅스 ftp 로 put 명령 실행시 에러 발생시 해결 방법

  • 에러 발생 현상 
ftp>  put test.txt
local: test.txt remote: test.txt
227 Entering Passive Mode (192,168,37,122,216,217).
553 Could not create file.
  • 해결방법
setsebool -P allow_ftpd_full_access on
setsebool -P ftp_home_dir on

 

728x90
반응형

+ Recent posts