NFS 서버로 원격접속하기
Unix
Helvetica, Arial, sans-serif; font-size: 0.9em; overflow-x: hidden; overflow-y: auto; margin: 0px !important; padding: 5px 20px 26px !important;padding: 20px;padding: 20px; color: rgb(0, 0, 0); font-size: 15px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', AppleSDGothicNeo-Medium, 'Segoe UI', 'Malgun Gothic', Verdana, Tahoma, sans-serif; background-color: rgb(255, 255, 255); -webkit-font-smoothing: antialiased; background-position: initial initial; background-repeat: initial initial;">

NFS - 파일이나 백업용 서버로 많이씀
mountd Daemon , NFS Server Daemon (NFSD) : 공유해주는 서버
file handle : server에 있는 파일이나 디렉토리 식별
/etc/dfs/dfstab : 공유내역 저장하는 파일

server 역할

vi /etc/dfs/dfstab

  • share -o ro /usr/share/man 이나
  • share -o rw /usr/share/man 이나
  • share -o root /usr/share/man 수정

/etc/init.d/nfs.server start - daemon 시작
share - 공유디렉토리 확인
dfshare - 공유되있는 디렉토리 리스트 확인
dfmounts - 공유되있는 사용자 리스트 확인

client 역할

mv /usr/share/man /usr/share/men -man을 men으로 이름변경
man ls -man있는지 확인
mkdir /usr/share/man -man디렉토리 생성
mount server104/usr/share/man /usr/share/man -server104의 /usr/share/man으로 mount
man ls -man확인
mount -마운트확인
dfmounts server104 -server104에 연결되어있는지 마운트 확인
umount /usr/share/man -마운트해제
dfmounts server104 -server104에 연결되어있는지 마운트 확인




문제풀기

  1. server2 에 100m 디스크 추가 후 /data로 마운트 하세요
  2. server2 의 /data를 읽기/쓰기가 가능하도록 공유하세요
  3. server1에서 server2의 /data를 /server1/backup으로 NFS연결하세요
  4. server1에서 /etc/ssh 디렉토리를 /server1/backup/ssh_backup.tar.zip으로 백업하세요

server2의 역할

touch reconfigure
init 6
100mb 디스크생성
format 파티션설정
100m 디스크추가


newfs dev/rdsk/c1d1s0 -포맷
mount dev/dsk/c1d1s0 -마운트
vi /etc/dfs/dfstab -/data를 읽기/쓰기 가능하도록 설정
share -o root=server104:server105 /data -공유 설정
/etc/init.d/nfs.server stop -server stop
/etc/init.d/nfs.server stop -server start

server1의 역할

mkdir -p /server1/backup -디렉토리생성
mount server104:/data /server1/backup -server1/backup을 server104의 data로 마운트
cd /server1/backup -경로이동
tar cvf /server1/backup/ssh_backup.tar.zip /etc/ssh/* -ssh_backup.tar.zip 으로 압축
cp ssh_backup.tar.zip /data1 -data1로 백업




과정 전문 server b

login as: root
root@172.16.5.110's password:
Last login: Mon Aug 18 17:44:38 2014 from 172.16.5.11
Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
#
#
#
#
#
# bash
bash-2.05# formatAug 18 17:45:03 server110 sendmail[227]: [ID 702911 mail.alert] unable to qualify my own domain name (server110) -- using short name
Aug 18 17:45:03 server110 sendmail[226]: [ID 702911 mail.alert] unable to qualify my own domain name (server110) -- using short name


Searching for disks...
done


AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 22189 alt 2 hd 15 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c2t0d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@0,0
Specify disk (enter its number): Specify disk (enter its number): Specify disk (enter its number): 1
selecting c2t0d0
[disk formatted]


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
bash-2.05# touch reconfigure
bash-2.05# reboot
login as: root
root@172.16.5.110's password:
Last login: Mon Aug 18 17:48:00 2014 from 172.16.5.11
Sun Microsystems Inc.   SunOS 5.9       Generic January 2003
#
#
#
# bash
bash-2.05#
bash-2.05#
bash-2.05#
bash-2.05# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 22189 alt 2 hd 15 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <DEFAULT cyl 2078 alt 2 hd 16 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
Specify disk (enter its number): 1
selecting c0d1
Controller working list found
[disk formatted, defect list found]


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> part
Please run fdisk first.
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.

 Please answer with "y" or "n": y
format> Aug 18 17:48:23 server110 sendmail[235]: [ID 702911 mail.alert] unable to qualify my own domain name (server110) -- using short name
Aug 18 17:48:23 server110 sendmail[234]: [ID 702911 mail.alert] unable to qualify my own domain name (server110) -- using short name

format> part


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> 0
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: $
partition> label
Ready to label disk, continue? y

partition> q


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
bash-2.05#
bash-2.05#
bash-2.05# mount /dev/dsk/c0d1s0 /data
mount: /dev/dsk/c0d1s0 is not this fstype.
bash-2.05# newfs /dev/rdsk/c0d1s0
newfs: construct a new file system /dev/rdsk/c0d1s0: (y/n)? y
/dev/rdsk/c0d1s0:       2093616 sectors in 2077 cylinders of 16 tracks, 63 sectors
        1022.3MB in 130 cyl groups (16 c/g, 7.88MB/g, 3776 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
 1935904, 1952096, 1968288, 1984480, 2000672, 2016864, 2033056, 2049248,
 2064416, 2080608,
bash-2.05#
bash-2.05#
bash-2.05#
bash-2.05# mount /dev/dsk/c0d1s0 /data
bash-2.05# vi /etc/dfs/dfstab
"/etc/dfs/dfstab" 13 lines, 433 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command '/etc/init.d/nfs.server start' to run the NFS
#       daemon processes and the share commands, after adding the very
#       first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
        share -o root=server117:server110 /data

~
~
~
~
~
~
~
~
~
~
"/etc/dfs/dfstab" 13 lines, 435 characters
bash-2.05# /etc/init.d/nfs.server stop
bash-2.05# /etc/init.d/nfs.server start
bash-2.05# share
-               /data   root=server117:server110   ""
bash-2.05#
bash-2.05#
bash-2.05# ls
TT_DB       data        home        net         sbin        xfn
bin         dev         kernel      opt         tmp
boot        devices     lib         p1          usr
cdrom       etc         lost+found  platform    var
core        export      mnt         proc        vol
bash-2.05# cd /data
bash-2.05# ls
lost+found          ssh_backup.tar.zip
bash-2.05#

serber a 과정전문

login as: root
root@172.16.5.117's password:
Last login: Mon Aug 18 17:25:10 2014 from 172.16.5.18
Sun Microsystems Inc.   SunOS 5.9       Generic January 2003

********************
* 여기는 server117 *
*    welcome ㅋㅋ  *
********************


You have new mail.
bash-2.05# mount server110:/usr/share/man /usr/share/man
nfs mount: server110:/usr/share/man: Permission denied
bash-2.05# vi /etc/dfs/dfstab








"/etc/dfs/dfstab" 12 lines, 428 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command '/etc/init.d/nfs.server start' to run the NFS
#       daemon processes and the share commands, after adding the very
#       first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
#       share -o root=server117 /usr/share/man
~
~
~
~
~
~
~
~
~
~
~
:q!
bash-2.05#
bash-2.05# mount server110:/usr/share/man /usr/share/man
bash-2.05# touch /usr/share/man/test
bash-2.05# dfmounts server110
RESOURCE     SERVER PATHNAME                  CLIENTS
  -       server110 /usr/share/man           server117
  -       server110 /usr/share/men2          server117
bash-2.05# umount /usr/share/man
bash-2.05# dfmounts server110
RESOURCE     SERVER PATHNAME                  CLIENTS
  -       server110 /usr/share/men2          server117
bash-2.05#
bash-2.05# vi /etc/dfs/dfstab
"/etc/dfs/dfstab" 12 lines, 428 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command '/etc/init.d/nfs.server start' to run the NFS
#       daemon processes and the share commands, after adding the very
#       first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
#       share -o ro /usr/share/man
#       share -o root=server110 /usr/share/man
~
~
~
~
~
~
~
~
~
~
"/etc/dfs/dfstab" 13 lines, 469 characters
bash-2.05# vi /etc/dfs/dfstab
"/etc/dfs/dfstab" 13 lines, 469 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command '/etc/init.d/nfs.server start' to run the NFS
#       daemon processes and the share commands, after adding the very
#       first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
#       share -o ro /usr/share/man
#       share -o root=server110 /usr/share/man
#       share -o root=server110 /data
~
~
~
~
~
~
~
~
~
"/etc/dfs/dfstab" 14 lines, 508 characters
bash-2.05# pwd
/
bash-2.05# ls
1           data        home        opt         sbin        vol
TT_DB       dev         kernel      p1          test        xfn
bin         devices     lib         p2          test.ls
boot        dir_test    lost+found  platform    tmp
cat         etc         mnt         proc        usr
cdrom       export      net         rhosts      var
bash-2.05# mkdir -p /server1/backup
bash-2.05# mount server110:/data /server1/backup
bash-2.05# rfmounts
bash: rfmounts: command not found
bash-2.05# dfmounts
nfs dfmounts: can't contact server: server117: RPC: Program not registered
bash-2.05# ls
1           data        home        opt         sbin        var
TT_DB       dev         kernel      p1          server1     vol
bin         devices     lib         p2          test        xfn
boot        dir_test    lost+found  platform    test.ls
cat         etc         mnt         proc        tmp
cdrom       export      net         rhosts      usr
bash-2.05# cd /server1/backup
bash-2.05# tar cvf /server1/backup/ssh_backup.tar.zip /etc/ssh/*
a /etc/ssh/ssh_config 1K
a /etc/ssh/ssh_host_dsa_key 1K
a /etc/ssh/ssh_host_dsa_key.pub 1K
a /etc/ssh/ssh_host_rsa_key 1K
a /etc/ssh/ssh_host_rsa_key.pub 1K
a /etc/ssh/sshd_config 5K
bash-2.05# ls
lost+found          ssh_backup.tar.zip
bash-2.05# cp ssh_backup.tar.zip /data
bash-2.05#

'Unix' 카테고리의 다른 글

unix crontab, runlevel,init 정의 및 사용법  (0) 2014.10.31
unix swap,top 정의 및 명령어  (0) 2014.10.31
UNIX,LINUX 사용자 관리 및 그룹관리  (0) 2014.10.31
서버보안 및 원격접속  (0) 2014.10.31
solaris10 설치 + Oracle 10g  (0) 2014.09.02
RSS FEED