[1] 네트워크 드라이브 연결
vi /etc/vfstab
host:/data3 - /m_portal/portalFiles nfs - yes soft,intr,bg
host:/data4 - /m_portal/masp/images nfs - yes soft,intr,bg
예.....
host1:/usr/share/man - /local nfs - yes soft,bg
1. host1의 /usr/share/man 을 마운트 하라
3. /local : 현 장비의 마운트포인트
4. nfs : 네트워크 파일 시스템
6. boot시 여부.
[2] Filesystem mount / umount
INDEX
________________________
1. Mount Verification
2. Mount CMD
3. Umount CMD
4. Troubleshooting
________________________
장치를 사용하기 위해서는 반드시 마운트 과정을 거쳐야 사용이 가
능하다. 그리고 다 사용한 자원은 언마우트하면 된다. 마운트 되어진 장치를 누군가 사
용한다면 기본적으로 언마운트 되지 않는다.
1. Mount Verification
________________________
(1). 마운트된 장치 확인
- df -k
- mount /// etc/mnttab 화일을 출력한다.
[Ref.] mount CMD
/usr/sbin/mount - System Administrator typically use
/sbin/mount - The System boot scripts use
2. Mount CMD
______________
(0) 마운트에 관련된 파일들
솔라리스 시스템에서 /etc/mnttab 파일은 현재 마운트되어져 있는 정보를 담는다.
/etc/vfstab 파일은 부팅시에 마운트 할만한 자원(Resource, 예:장치)에 대한 정
보를 담는다.
* /etc/mnttab : read At Real(mntfs)
* /etc/vfstab : read At Boot
(1). /etc/mnttab 파일
/etc/mnttab 파일은 현재 마운트된 정보를 담고 있고 mntfs 가살 파일시스템으로 솔라리
스에 의해 관리된다. 관리자가 관리할 필요가 없는 파일이다.
EX) /etc/mnttab 파일 실습
# cat /etc/mnttab | grep export
# umount /export/home
# cat /etc/mnttab | grep export
# mount /export/home
# cat /etc/mnttab | grep export
(2). mount & /etc/mnttab 출력 정보
mount 명령어에 아무런 옵션이나 인자(Arguments) 없이 사용하면 현재 마운트 되어진 자원들에 대한 정보를 얻을수 있다. mount 명령어는 /etc/mnttab 파일을 정보를 사용하여 일정한 형식(출력 형식)으로 보여준다.
# mount
# cat /etc/mnttab
# man mnttab
.....
Each entry is a line of fields separated by <TAB>s in the form:
special mount_point fstype options time special
The name of the resource that has been mounted.
mount_point
The pathname of the directory on which the filesystem
is mounted.
fstype
The file system type of the mounted file system.
options
The mount options. See respective mount file system
man page in the SEE ALSO section below.
time The time at which the file system was mounted.
Examples of entries for the special field include the path-
name of a block-special device, the name of a remote file
system in the form of host:pathname, or the name of a swap
file, for example, a file made with mkfile(1M).
.....
(3). /etc/vfstab 파일
/etc/vfstab 파일은 부팅시에 마운트할만한 정보를 담고 있다. 하지만 /etc/vfstab 파일
/, /usr, /var, /tmp, 가상파일시스템등은 부팅시에 마운트 되지 않는다고 선언되어 있
다. 이것은 이 파일이 읽혀지는 런 레벨2 과정전에 미리 마운트가 되기 때문이다.
(주의) /etc/vfstab 파일의 모든 필드의 구분은 탭 1칸으로 정의 되어야 하며 필드의 정
보가 정의 되지 않는 경우 비워 놓지 않고 -(Dash), 0(Zero)로 표시 해야 한다. 만약 잘
못 정의한 경우 부팅하다 멈추는 경우가 생길수 있다.
# man vfstab
.....
The file /etc/vfstab describes defaults for each file sys-
tem. The information is stored in a table with the following
column headings:
device device mount FS fsck mount mount
to mount to fsck point type pass at boot options
The fields in the table are space-separated and show the
resource name (device to mount), the raw device to fsck
(device to fsck), the default mount directory (mount point),
the name of the file system type (FS type), the number used
by fsck to decide whether to check the file system automati-
cally (fsck pass), whether the file system should be mounted
automatically by mountall (mount at boot), and the file sys-
tem mount options (mount options). (See respective mount
file system man page below in SEE ALSO for mount options.) A
'-' is used to indicate no entry in a field. This may be
used when a field does not apply to the resource being
mounted.
.....
(3). Performing Mounts
mount attaches a file system to the file system hierarchy at
the mount_point, which is the pathname of a directory. If
mount_point has any contents prior to the mount operation,
these are hidden until the file system is unmounted.
umount unmounts a currently mounted file system, which may
be specified either as a mount_point or as special, the dev-
ice on which the file system resides.
The table of currently mounted file systems can be found by
examining the mounted file system information file. This is
provided by a file system that is usually mounted on
/etc/mnttab. The mounted file system information is
described in mnttab(4). Mounting a file system adds an entry
to the mount table; a umount removes an entry from the
table.
명령어 형식
mount [-F ufs] [-o option(s)] resouce mount_pointer
# mount -F ufs -o option /dev/dsk/c0t0d0s7 /export/home
# mount /dev/dsk/c0t0d0s7 /export/home
# mount /export/home (if defined in /etc/vfstab)
(3-1) The Default Options for the mount Command //기본....
# mount or # cat /etc/mnttab
read/write <-> read only
suid <-> nosuid // suid를 할수없다 .... [...]
intr <-> nointr // 예) 컨트롤 c 키 . 로 그 프로세서를 종류 시킬수없다
nologging <-> logging // jfs 화일시스템 = 리눅스의 ext3 =ufs +logging 한개의 슬라이스 2G가 안에서만
다른슬라이스의 로그기록을 쌓을수있는데 그것가지고 복구시킬수있다.
largfiles <-> nolargfiles // 제한이 2G
xattr
onerror=panic <-> lock, umount, panic
(3-2) Example Mount Command
# mount -o ro /dev/dsk/c0t0d0s6 /export/home
# mount -o ro,nosuid /dev/dsk/c0t0d0s7 /export/home
# mount -o noatime /dev/dsk/c0t0d0s3 /var
# mount -o nolargefiles /dev/dsk/c0t0d0s7 /export/home
# mount -o logging /dev/dsk/c0t0d0s7 /export/home
# mount -o rw,remount / (including solaris 9)
# mount -o remount,logging /export/home (Including Solaris8)
EX) mount Options Reference
ro /usr, /usr/local (x ) 추천하지않음.
nosuid /export/home // 사용자홈폴더에 /home 및에있는 suid 화일들을만들수업없다.
noatime /var //로그기록같은것들이 쌓이는장소에 . atime= access modify 파일을 안남기겠다.. 운영체제에 성능이 높아진다...
nolargefiles /export/home // 사용자들이 <2G 가 사용할 필요가없다. 그래픽서버들은 설정을하지않는다.
logging /export/home, /database, /data1, (/, /usr) //빠른복구를 위해서 ...설정한다.
EX) noatime 옵션 실습
# mount | grep data4
Options Verify
# mkdir /noatime
# umount /data4
# mount /dev/dsk/c0t0d0s6 /noatime
# mount | grep noatime
# cd /noatime
# cat > testfile
# cat testfile
# ls -l testfile
# ls -lu testfile
<1 Min. later>
# cat testfile
# ls -l testfile
# ls -lu testfile
# cd
# umount /noatime
# mount -o noatime /dev/dsk/c0t0d0s6 /noatime
# mount | grep noatime
# cd /noatime
# cat testfile
# ls -l testfile
# ls -lu testfile
<1 Min. later>
# cat testfile
# ls -l testfile
# ls -lu testfile
[Ref.] man ls
.....
-u Uses time of last access instead of last modification
for sorting (with the -t option) or printing (with the
-l option).
.....
(3-3) mountall / umountall
# mountall (/etc/vfstab, mount at boot)
# umountall(/etc/mnttab, current mount except /, /usr, /var, /tmp,
virtual filesystem)
EX) mountall/umountall 실습
# umountall
# df -k
# vi /etc/vfstab
.....
# /dev/dsk/c0t0d0s3 .... /data1 ....
.....
# mountall
# df -k
=> Restore /etc/vfstab
(3-4). Mounting Current Types of Filesystems
- /etc/vfstab file for the FS types field.
- /etc/default/fs file for a local filesystem type.
- /etc/dfs/fstypes file for a remote filesystem type.
[Ref.] cat /etc/default/fs, /etc/dfs/fstypes
# cat /etc/default/fs
LOCAL=ufs
# cat /etc/dfs/fstypes
nfs NFS Utilities
autofs AUTOFS Utilities
cachefs CACHEFS Utilities
EX) NFS Mount
# mount 172.16.8.254:/root/docs /mnt/server
# mount -F nfs -o options 172.16.8.254:/root/docs /mnt/server
생략가능
EX) CD-ROM, Floppy Mount
# /etc/init.d/volmgt stop
# ps -ef | grep vold
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom
# mkdir /pcfs
# mount -F pcfs /dev/diskette /pcfs
[Ref.] /root/docs/Fundamental/vold.txt
[Ref.] Summary
(0). Disk Add
(1). Device Reconfiguration
(2). Slice
(3). Filesystem
(4). mount
Disk Add
# devfsadm -v
# devfsadm -c disk
or
# devfsadm -i [dad | sd]
# format (Partition, Slice Works)
# newfs /dev/rdsk/c0t2d0s0
# newfs /dev/rdsk/c0t2d0s1
# newfs /dev/rdsk/c0t2d0s3
# mkdir /data5
# mkdir /data6
# mkdir /data7
# mount /dev/dsk/c0t2d0s0 /data5
# mount /dev/dsk/c0t2d0s1 /data6
# mount /dev/dsk/c0t2d0s3 /data7
# vi /etc/vfstab
.....
/dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 /data5 ufs 2 yes -
/dev/dsk/c0t2d0s1 /dev/rdsk/c0t2d0s1 /data6 ufs 2 yes -
/dev/dsk/c0t2d0s3 /dev/rdsk/c0t2d0s3 /data7 ufs 2 yes -
.....
3. umount CMD
______________________
(1) Performing Unmounts
# umount /export/home
or
# umount /dev/dsk/c0t0d0s7
(2) Unmounting a Busy Filesystem
솔라리스 시스템에서 마운트된 파일시스템을 누군가 사용하고 있다면 기본적으로 관리자는
파일시스템을 언마운트 할 수 없다. 관리자는 이런경우라 하더라도 반드시 언마운트 해야
한다면 umount 명령어에 -f 옵션을 사용하여 강제적으로 파일시스템을 언마운트 할수 있다.
EX) 사용중인 파일시스템 언마운트 실습
TERM1) User Windows
# cd /export/home
TERM2) Admin Windows
# umount /export/home
Error Message(Device Busy) //언마우트하지못한다 ..
Unmounting a busy filesystem. // 언마운트 못하는것을 .....언마운트시킨다!!!
- fuser
- umount -f
EX) 강제적으로 파일시스템 umount 실습
# fuser -cu /export/home
[Ref.] # wall -a /root/warnning.txt // 안에 있는 파일을 모든 사용자에게 출력시켜준다.
# fuser -ck /export/home //ㅇㅅㅇ)b 강추 ... -ck k는 킬시그날. kill -9 pid
or
# umount -f /export/home //이것을 쓰면 나중에 파일시스템을 반드시 정검 해야된다.
EX) 파일시스템 마운트의 정확한 의미
Mount exactly means
# touch /data4/testfile1
# ls -l /data4/testfile1
# cd
# umount /data4
# ls -l /data4
# touch /data4/testfile2
# ls -l /data4/testfile2
# mount /data4
# ls -l /data4 (?)
# umount /data4
# ls -l /data4 (?)
[Ref.] System Admin Tools for Security
- John the Ripper (Password Crack Tool)
- Nessus (Exploit Check Tool) //네트워크 점검툴..... 행킹용툴. [!!] 이들어있음..
- /Tools (Slice)
- Usage : mount
- Not Usage : umount
- /Backup (Slice, Crontab)
- Usage : mount
- Not Usage : umount
4. Troubleshooting
______________________
솔라리스에서 부팅중에 멈추게 되면 파일시스템을 점검할수 없게 된다. 따라서 디스크로
부팅할 수 없게 됨으로써 시스템을 제어하거나 문제를 해결할수 없게 된다. 이런 경우
1 of 2(1번 CD)를 사용하여 부팅해서 솔라리스 시스템을 제어 할수 있다.
(1) Repairing Important Files if Boot Fails
- Single User Mode with CDROM
- ksh function setting
- Basic Setting(mount)
- Working
- umount
다음은 root 사용자의 암호를 잃어 버린경우 복구하는 예이다.
# vi /etc/shadow # vi /etc/shadow
root:암호:~~~~~~~~ -----> root::~~~~~~~~~~
[그림] root 암호 NULL로 변경
+---- Disk -----+
| |
| |
| c0t0d0s0 | ------> / ----> # vi /etc/shadow
| |
| |
| |
+---------------+
| ....... |
+---------------+
+---- Disk -----+ +----- CD ------+
| | | |
| | | |
| c0t0d0s0 | ------> | /a | ----> # vi /a/etc/shadow
| | | |
| | | |
| | | |
+---------------+ +---------------+
| ....... |
+---------------+
[그림] CD로 부팅시 root 암호 NULL로 변경
(1-1) Single User Mode with CD-ROM
# sync ; sync ; sync
# init 0
ok boot cdrom -s
[Ref.] ok boot -s
[Ref.] Solaris 9 x86 on VMWare
설치 과정으로 중에 터미널을 띄워서 작업한다.
(1-2) ksh function setting
# ksh
# set -o vi
# stty erase ^H
# TERM=vt100 (or TERM=sun)
# export TERM
(1-3) Basic Setting
# fsck /dev/rdsk/c0t0d0s0
# mount /dev/dsk/c0t0d0s0 /a
(1-4) Working
# vi /a/etc/shadow
[Before]
root:DBIjVbLjfANLQ:13411::::::
[After]
root::13411::::::
:wq!
(1-5) umount
# cd
# umount /a
# init 6
After Boot
# passwd
knit