NAS (Network Attached Storage)  Server에 마운트 (Mount)


작업 환경 

OS : Centos 6 이상

작업 내용 

- 서버에 NAS를 마운트(mount)시켜 일반 스토리지(Storage) 처럼 사용하기 위한 작업 입니다.

또한 시스템 재부팅 시에도 자동으로 마운트 작업 되도록 설정합니다.



작업 절차 


- yum 을 이용해 nas 를 마운트 하기위해 필요한 nfs-utils 페키지 설치

yum install nfs-utils


- rpcbind 서비스 시작

/etc/rc.d/init.d/rpcbind start


- rpcbind를 시작 프로그램 등록해 재부팅시 실행 될 수 있게한다.

chkconfig rpcbind on


- 마운트(mount) 할 디렉토리를 생성한다.

mkdir [디렉토리]

ex) mkdir /data


- nas를 mount 한다.

mount [NAS mount 정보] [mount 포인트 디렉토리]

ex) mount -t nfs 10.101.0.0:/n130000_nas /data


- mount 결과를 확인한다.

df -h


- /etc/fstab파일을 연다.(/etc/fstab 서버의 파일 시스템 정보(스토리지)를 저장하는 파일이다.)

vi /etc/fstab


- 최하단에 아래 형식의 내용 추가

[파일시스템장치명] [마운트포인트] [파일시스템종류] [옵션] [dump관련설정] [파일점검옵션]

ex)

10.101.0.0:/n130000_nas              /data1                  nfs    defaults        1 2


*참고

[Device] : fdisk -l 명령어를 통해 확인할 수 있다.

[디렉토리] : mount 포인트 지정

[파일 시스템 형식] : 파일 시스템 형식

[파일 시스템 고유 옵션] : 파일 시스템 고유 옵션

[dump 작동 여부] : dump 명령어를 사용 할 때 [0]이면 실행 안함, [1] 실행한다는 의미를 가진다.

[무결성체크여부] : fsck 명령어로 무결성의 체크 여부를 지정 [0]일 경우 체크 안함,[1]이상의 정수를 쓰면 작은 순서로 체크한다.


**참고

- NAS 연결 끊기(언마운트 작업)

umount [mount 경로]

ex) umount /data



이상 입니다.ㅎㅎ

그럼 오늘도 행복한 하루 되세요.

'서버 셋팅 > storage' 카테고리의 다른 글

서버에 스토리지(storage) 연결(Mount)하기  (1) 2019.01.28

 일반 STORAGE mount

  • 디스크 파티션

    • 스토리지 상태 확인 및 추가 : fdisk 로 검사
        명령어 :  fdisk -l
      
        출력 내용
              Disk /dev/xvda: 53.7 GB, 53687091200 bytes
              255 heads, 63 sectors/track, 6527 cylinders
              Units = cylinders of 16065 * 512 = 8225280 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disk identifier: 0x0004f47d
      
                  Device Boot      Start         End      Blocks   Id  System
              /dev/xvda1   *           1        6528    52427776   83  Linux
      
              Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
              255 heads, 63 sectors/track, 26108 cylinders
              Units = cylinders of 16065 * 512 = 8225280 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disk identifier: 0x00000000
      
        *설명 :  Disk identifier: 0x00000000 로 출력된 디스크를 찾으면 mount 할
                디스크의 경로를 찾을 수 있다.
                위 출력 내용에서는 /dev/xvdb 의 경로로 연결된 디스크가 아직
                mount 되지 않은 것을 알 수 있다.
      

    • 디스크 파티션
      명령어 : fdisk [mount할 디스크 경로]
          ex) fdisk /dev/xvdb
      
      출력 내용
            Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
            Building a new DOS disklabel with disk identifier 0x5fc5b993.
            Changes will remain in memory only, until you decide to write them.
            After that, of course, the previous content won't be recoverable.
      
            Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
      
            WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
                     switch off the mode (command 'c') and change display units to
                     sectors (command 'u').
      
            Command (m for help):
      
      입력 : n
      
      출력 내용
            Command action
               e   extended
               p   primary partition (1-4)
      
      입력 : p
      
      출력 내용      
            Partition number (1-4):
      
      입력 : 1
      
      출력 내용     
            First cylinder (1-26108, default 1):
      
      입력 : [Enter]
      
      출력 내용
            Last cylinder, +cylinders or +size{K,M,G} (1-26108, default 26108):
      
      입력 : [Enter]
      
      출력 내용
            Using default value 26108
      
            Command (m for help):
      
      입력 : w
      
      출력 내용
            The partition table has been altered!
      
            Calling ioctl() to re-read partition table.
            Syncing disks.   
      

  • 스토리지 포맷

    • 디스크 파티션 확인

        명령어 : fdisk -l
      
        출력 내용
              Disk /dev/xvda: 53.7 GB, 53687091200 bytes
              255 heads, 63 sectors/track, 6527 cylinders
              Units = cylinders of 16065 * 512 = 8225280 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disk identifier: 0x0004f47d
      
                  Device Boot      Start         End      Blocks   Id  System
              /dev/xvda1   *           1        6528    52427776   83  Linux
      
              Disk /dev/xvdb: 214.7 GB, 214748364800 bytes
              255 heads, 63 sectors/track, 26108 cylinders
              Units = cylinders of 16065 * 512 = 8225280 bytes
              Sector size (logical/physical): 512 bytes / 512 bytes
              I/O size (minimum/optimal): 512 bytes / 512 bytes
              Disk identifier: 0x5fc5b993
      
                  Device Boot      Start         End      Blocks   Id  System
              /dev/xvdb1               1       26108   209712478+  83  Linux
      

    • 포멧하기

        명령어 :  mkfs.[파일 시스템 형식] [디스크 경로]
            ex) mkfs.ext4 /dev/xvdb1
      
        참고 : OS별 명령어
              - CentOS 5.x: mkfs.ext3 [디스크 경로]
              - CentOS 7.x: mkfs.xfs [디스크 경로]
              - Ubuntu Server / Desktop: mkfs.ext4 [디스크 경로]
      
        출력 내용
              mke2fs 1.41.12 (17-May-2010)
              Filesystem label=
              OS type: Linux
              Block size=4096 (log=2)
              Fragment size=4096 (log=2)
              Stride=0 blocks, Stripe width=0 blocks
              13107200 inodes, 52428119 blocks
              2621405 blocks (5.00%) reserved for the super user
              First data block=0
              Maximum filesystem blocks=4294967296
              1600 block groups
              32768 blocks per group, 32768 fragments per group
              8192 inodes per group
              Superblock backups stored on blocks:
                      32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
                      4096000, 7962624, 11239424, 20480000, 23887872
      
              Writing inode tables: 1139/1600
              Writing inode tables: done
              Creating journal (32768 blocks): done
              Writing superblocks and filesystem accounting information:
              done
              This filesystem will be automatically checked every 23 mounts or
              180 days, whichever comes first.  Use tune2fs -c or -i to override.
      

  • 스토리지 마운트

    • 스토리지를 마운트할 디렉토리 생성

        명령어 : mkdir [디렉로리]
            ex) mkdir /data1
      

    • 스토리지를 마운트할 디렉토리 생성

        명령어 : mount [스토리지 경로] [마운트할 디렉토리 경로]
            ex) mount /dev/xvdb1 /data1
      

    • 결과 확인

        명령어 : df -h
      

    • /etc/fstab에 등록하여 서버 부팅 후에도 마운트 정보를 유지

        명령어 : vi /etc/fstab
      
        최하단에 아래 형식의 내용 추가
        ex)
        /dev/xvdb1              /data1                  ext4    defaults        1 2
      
        *참고
          [Device] : fdisk -l 명령어를 통해 확인할 수 있다.
          [디렉토리] : mount 포인트 지정
          [파일 시스템 형식] : 파일 시스템 형식
          [파일 시스템 고유 옵션] : 파일 시스템 고유 옵션
          [dump 작동 여부] : dump 명령어를 사용 할 때 [0]이면 실행 안함, [1] 실행한다는 의미를 가진다.
          [무결성체크여부] : fsck 명령어로 무결성의 체크 여부를 지정 [0]일 경우 체크 안함,[1]이상의 정수를 쓰면 작은 순서로 체크한다.


'서버 셋팅 > storage' 카테고리의 다른 글

NAS (Network Attached Storage) Server에 마운트 (Mount)  (0) 2019.02.05

+ Recent posts