BigData_Off1/리눅스1

리눅스1> 2018.01.09_20일차 - File system & Disk Management(① 개념 ② Partition)

오정oI 2018. 1. 9. 15:19
반응형
SMALL

* File System & Disk Management

* 목차

 

 

1> HDD(Hard Disk Drive)

- 자성체로 코팅된 알루미늄 기판에 자료를 저장할 수 있또록 만든 보조기억 장치의 한 종류

 

① 플래터(Platter)

- 하드 디스크를 구성하는 얇은 판

- 코팅 된 산화금속 막을 논리적으로 나누고(Partitioning)

   위치를 지정(formatting) 하면 정보를 저장할 수 있음

 

② 스핀들(Spindle)

- 플래터가 회전할 수 있도록 모터와 직접 연결된 축

- 플래터를 일정한 속도로 회전시키는 장치인 모터가 있고,

  HDD용 모터는 스핀들에 직접 연결되어있기 때문에 '스핀들 모터' 라고도

  부름

 

③ 해드(Head)

- 플래터 표면에 코팅된 자성체를 자화/소거하여 정보를 저장/삭제하거나

  저장된 정보를 읽는 장치

 

④ 해드구동 장치(Actuator)

- 엑츄에이터는 해드를 움직이는 장치

- 해드가 부착된 ARM(팔) 을 지정한 위치까지 이동함

 

⑤ 실린더(Cylinder)

- 다수개의 플래터의 트랙을 수직적으로 관통하는 3차원적인 스택을 말함

- 기록 밀도가 높은 곳은 그 만큼 데이터 안정에 문제가 있을 수 있음

  위 이유로 모든 섹터가 같은 길이를 갖도록 데이터를 기록하는 방식이 일반 적임

- 디스크에 중심축으로 같은 위치에 있는 트랙의 집합

 

⑥ 트랙, 섹터(Track, Sector)

- 하드디스크 기록 단위의 하나로써 자기 매체에 늘어선 동심원으로 구획된

  하나하나를 트랙이라 부르고 그 트랙들을 다시 섹터로 나눔

- 트랙은 정보가 저장되는 동심원

- 섹터는 최소 단위가 512byte (피자조각) 이고 공간낭비가 없으나 읽는 속도가 느림

=> 위 문제 해결 :

     클러스터 (섹터의 최소단위 문제점 해결)

     클러스터 : 섹터의 집합 (4kb = 4096 byte = 섹터 8개)

읽는 속도는 빠르나, 공간낭비가 있음

- 하나의 데이터만 저장 가능

 

⑦ 클러스터(Cluster)

- 섹터의 최소 단위의 문제점을 해결하기 위함

- 기본적으로 4KB

- 읽는 속도는 빨라졌으나 공간낭비가 있음 

 

2> HDD의 형식

MBR(Master Boot Record) 와 GPT(GIUD Partition Table)

- 사용할 수 있는 디스크 종류는 크게 2가지가 있음

 

1) 전통적인 BIOS(Basic Input Output System) 방식의 시스템에서 사용되고

   있는 디스크 형식인 MBR 디스크

 

2) 새롭게 개발된 EFI(Extensible Fimware Interface)방식의 시스템에서 사용되고

   있는 디스크 형식인 GPT 디스크

   (BIOS가  아니라 EFI라는 좀 더 개선된 핌웨어에서 사용함 (BIOS에서 GPT  디스크 사용불가)

    다시 말하면 디스크에 관한 정보를 담는데는  MBR이냐 GPT냐로 나뉘게 됨)

 ex> N클라우드, 서버계열, 대형 회사

=> 우리가 일반적으로 쓰고 있는건 1)

 

섹터 512byte 중,

부팅에 관한 정보를 담고 있는 440byte의 Master Boot Code 영역

파티션에 대해 정보를 담고 있는 64byte의 Partition Table 영역

 

- MBR 의 단점? (Partition 영역 4개뿐이 못 만듦..,)

Primary(주) Partition Table에 기록이 되는  파티션 엔트리(공간)는 개당 16byte로 이루어져

있음

최대  MBR Primary Partition을 4개까지만 생성할 수 있음.

GPT  디스크는 Primary Partition을 무려 128개까지 생성가능(거의 무제한)

 

MBR의 최대 파티션 생성 개수가 4개까지라는 제한으로 인해 이를 해결하기 위해서

Extended(확장) Partition과 Logical(논리) Partition을 생성해야만 4개이상 생성할 수 있음

 

C:\

 

C:\             E:\        

프로그램     부가, 중요

3 : 7

C:\ E:\ F:\

=> 관리의 효율성 위함

 

- 볼륨? 파티션과는 다른 개념임 (파티션 묶음)

 

 

3> Partitioning

- 그림

- 특징

주는 독립적임 삭제되는 데 영향 미치지 않음

 

Extended 삭제시, Logical 에 영향 있음

 

Logical을 삭제 하는 경우에는 다른 부분에 영향을 주지 않음

Logical은 Extended 사이즈를 넘을 수 없음

 

4> HDD Type

IDE(Integrated Drive Electronics : 병렬)는 CPU에서 직접관리하기 때문에 부팅 중에

(전원이 켜져 있을 때) 장착할 수 없음

hd + 문자 → hda, hdb, hdc는 CD-ROM(우리가 사용불가), hdd, ... 등등

 

SCSI(Small Computer System Interface : 직렬)는 CPU에서 직접관리하지 않고 내부에서

scsichip에서 직접관리함. 부팅 중에도 추가할 수 있으나 인식이 되지 않으므로 재부팅후에

인식가능

sd+문자 → sda, sdb, sdc, sdd, ...  등등

 

참고로

CentOS 5.x에서는 IDE HDD를 추가하면  hd+문자, SCSI HDD를 추가하면 sd+문자 사용됨

CentOS 6.x이후부터는 IDE HDD나 SCSI HDD 를 추가하면  sd+문자로만 사용 됨

 

5> Partition Type

IDE HDD(hd+문자)+숫자  →   hda1, hdb2, hdd3, hde4, ...  등등

SCSI HDD(sd+문자)+숫자 →   sda1, sdb2,  sdc3,  sdd4, ...  등등

 

 

////////////////////////////// 2018.01.10 내용 추가 //////////////////////////////

 

 

 

* Partitioning 방법

 

1. HDD 추가 (IDE)

 

poweroff> VMware> Edit virtual machine> settings> add> 예>

Hard Disk  클릭> IDE 체크> Create a new virtual disk  클릭>

Maximum disk size : 1.0 GB> Disk file(기본값)> Finish> 확인 후 OK

 

2. HDD 삭제

 

poweroff> Edit virtual machine> settings> 삭제할 HDD를 선택>

Remove> OK

 

3. HDD  확인

 

사용형식

fdisk [option]

fdisk [option] 장치명

 

option

-l :  하드디스크와 파티션 목록

 

 

4. 파티션 생성

 

사용형식

fdisk 장치

 

fdisk에서 사용할 명령어들

d는 파티션 삭제

l은 파티션 타입 리스트

m은 도움말 출력

n은 파티션 생성

p는 파티션 테이블 출력

q는 저장하지 않고 종료

t는 파티션의 시스템 ID 변경

w는 저장하고 종료

 

1) Primary(주) Partition 생성

n → p 또는  enter → 파티션 번호는 생성하는 순서대로 잡아주는 것이 좋음(1 또는 enter)

→ 첫 번째 섹터는 기본값대로  → 마지막 섹터는 용량으로 하는게 편함(용량은 +용량단위) +500M

 

2) Extened(확장)

Partition 생성

n → e → 파티션 번호 순서대로(2 또는 enter) → 첫번째 섹터는 기본값으로(enter)

→ 마지막 섹터는 용량으로(+용량단위) +300M

 

3) Logical(논리)

Partition 생성

n →  l → 파티션 번호는 무조건 5번(이상) → 첫번째 섹터는 기본값으로(enter)

→ 마지막 섹터는 용량으로(+ 용량단위) 또는 용량으로 enter(남은 용량 다 잡아라)

→ enter

 

 

삭제시 d

Partition num : 2

확장(extended) 지우면 logical 도 같이 지워짐

 

p

sdb1 : HDD명+partition num,

End : sector

Blocks :  용량

ID : 리눅스 시스템 고유 번호, 83

 

확장은 System의 Extended

논리는 Device Boot의 /dev/sdb5 => 5번부터인것 확인~!

 

 

5. 포맷(Make File System)

 

사용형식

mkfs [option]  인자값 장치(파티션)

또는

mkfs. 인자값 장치(파티션)

 

option

-t : type.

 

인자값

 xfs    // centos7 에서 쓰는 파일 시스템 (windows에서 NTFS; FAT32(기본값) : 4GB 이상은 못 받음)

 

cf. 포맷 대상

p(주), l(논리)

p는 포맷이 되는데

e는 포맷이 안됨(사용할 수 있는 공간이 아님)

 

(참고!

CentOS 5.x  포맷 방법

mkfs -t ext3 장치(파티션)

또는

 mkfs.ext3 장치(파티션)

 

CentOS 6.x 포맷 방법

mkfs -t ext4 장치(파티션)

또는

mkfs.ext4  장치(파티션)  )

 

 

6. 마운트(mount)

- 파일 시스템을 디렉터리 일부에 넣어서 이용가능하게 하는 작업

마치, 디렉터리처럼 사용하는 것을 마운트라 할 수 있음

- 서버의 자원을 사용하는 것이므로 관리자만 사용가능

- 장치파일을 디렉터리화 함

 

ㆍ사용형식(mount 장착)

mount 장치(파티션) 임의의 디렉터리(mount point)

mount

→ 마운트 된 목록을 출력

 

 

ㆍ사용형식(mount 장착해제)

umount 장치(파티션)

또는

umount 임의의 디렉터리(mount point)

 

ㆍ별도로 mount 상태 확인할 때   df -h를 사용함

df(명령어)는 디스크 공간 확인

-h은 사람이 보기 편하게 출력

 

!  mount 주의사항

 

1)  mount를 할 때 하나의 장치나 파티션은 반드시 하나의 임의의 디렉터리(mount point)를

사용해야 함

(예를 들어, 1개의 장치를 사용할 때 여러 개의 mount point를 사용할 필요가 없으며, 여러

개의 장치를 하나의 mount point로  mount 해서는 안 됨)

 

2) umount를 할 때 반드시 mount point에 있어선 안 됨

(예를 들어,  mount point나 그 하위에 있으면 umount가 안됨. 그래서 mount point가 아닌

곳으로 변경해야 함)

 

3) mount를 할 때 Primary Partition과 Logical Partition만 해당 됨    // 포맷이 되니까

(Extended Partition은 mount  할 수 없음)        // 포맷이 안되니까

 

4) mount를 할 때 반드시 기존에 사용중인 디렉터리로 mount 해서는 안 됨

(예를 들어, 사용자 홈 디렉터리 X 기존에 사용중인 /home/itbank 로 하지마!!!

mkdir로 새로 만들것! )

 

ex>

 장치파일    

 디렉터리

 /dev/sdb1

 /a 

 

   귀신  →  어떤 사람

             mount

           ↑ 빙의

Driver

S/W ↔ H/W

 

☆ CD-ROM 사용 방법

먼저 iso image file을 삽입!

: VM> Settings> CD/DVD => C:0_CentOS7>ISO

사용형식
mount /dev/sr0(원본파일) 임의의 디렉터리(mount point)
또는
mount /dev/cdrom(바로가기) 임의의 디렉터리(mount point)

 

(참고로

The partition table has been altered!        // w 눌렀을 때??

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

위 문구 사이에... The new table will be used at the next reboot ... 문구가 나오면

재부팅을 반드시 하세요)

 

cf) 로그인 하기 전에 CD-ROM을 삽입 한 경우

수동으로 mount  해줘야..,

 

centOS 5.x : /dev/hdc

centOS 6.x : /dev/sr0

    /dev/cdrom

 

cf) vmware하단에 CD 아이콘 불 안 깜박 거리면

오.버> connect 클릭!

 

 

 

// hdd 추가

Virtual Machine Settings> Add...> Hard Disk>

SCSI> default> 1 입력> Finish> OK

[root@localhost ~]# cd ~itbank
[root@localhost itbank]#

// 하드디스크와 파티션  보기 (all)

[root@localhost itbank]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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
Disk label type: dos
Disk identifier: 0x000a586b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200     6293503     2097152   82  Linux swap / Solaris
/dev/sda3         6293504    41943039    17824768   83  Linux

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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@localhost itbank]#

// 내가 추가한 장치 보기

[root@localhost itbank]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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@localhost itbank]# 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 0xd8f28c00.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   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): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
Disk label type: dos
Disk identifier: 0xd8f28c00

   Device Boot      Start         End      Blocks   Id  System

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-2097151, default 2048):     Enter
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +500M
Partition 1 of type Linux and of size 500 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
Disk label type: dos
Disk identifier: 0xd8f28c00

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux

/////

sdb1 : HDD명+partition num,

End : sector

Blocks :  용량

ID : 리눅스 시스템 고유 번호, 83

/////

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2): 2
First sector (1026048-2097151, default 1026048):   Enter
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-2097151, default 2097151): +300M
Partition 2 of type Extended and of size 300 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
Disk label type: dos
Disk identifier: 0xdd30b289

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     1640447      307200    5  Extended

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 5
First sector (1028096-1640447, default 1028096):   Enter
Using default value 1028096
Last sector, +sectors or +size{K,M,G} (1028096-1640447, default 1640447):   Enter
Using default value 1640447
Partition 5 of type Linux and of size 299 MiB is set

Command (m for help): p

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
Disk label type: dos
Disk identifier: 0xd8f28c00

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2        1026048     1640447     307200     5  Extended
/dev/sdb5        1028096     1640447     306176   83  Linux

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

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

// 하드디스크와 파티션 목록 확인

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 1073 MB, 1073741824 bytes, 2097152 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
Disk label type: dos
Disk identifier: 0xdd30b289

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048     1640447      307200    5  Extended
/dev/sdb5         1028096     1640447      306176   83  Linux

 

// 포맷

 

cf. 포맷 대상

p(주), l(논리)

p는 포맷이 되는데

e는 포맷이 안됨(사용할 수 있는 공간이 아님)

[root@localhost itbank]#
[root@localhost itbank]# mkfs -t xfs /dev/sdb1
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=32000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=128000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost itbank]#
[root@localhost itbank]#
[root@localhost itbank]# mkfs -t xfs /dev/sdb2    //Extended는 포맷 대상이 아님!
mkfs.xfs: /dev/sdb2 appears to contain a partition table (dos).
mkfs.xfs: Use the -f option to force overwrite.
[root@localhost itbank]#
[root@localhost itbank]# mkfs.xfs /dev/sdb5
meta-data=/dev/sdb5              isize=512    agcount=4, agsize=19136 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=76544, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost itbank]#
[root@localhost itbank]#

 

// 마운트(장치 쓰기)

=> 아직 장치를 쓸 수 없음..,

=> 장치파일을 디렉터리화 함

[root@localhost itbank]# mkdir /dev/sdb1/hello
mkdir: `/dev/sdb1/hello' 디렉토리를 만들 수 없습니다: 디렉터리가 아닙니다    // 아직 장치를 쓸 수 없음!
[root@localhost itbank]#
[root@localhost itbank]# touch /dev/sdb1/hello
touch: cannot touch `/dev/sdb1/hello': 디렉터리가 아닙니다
[root@localhost itbank]#
[root@localhost itbank]# ls -l /dev/sdb1
b
rw-rw----. 1 root disk 8, 17  1월 10 13:31 /dev/sdb1        // b : block system file
[root@localhost itbank]#
[root@localhost itbank]#

// 장치 마운트할 dir. 생성

[root@localhost itbank]# mkdir /mountpoint
[root@localhost itbank]#
[root@localhost itbank]# ls -ld /mountpoint
drwxr-xr-x 2 root root 6  1월 24 22:32 /mountpoint

[root@localhost itbank]#
[root@localhost itbank]# touch /mountpoint/testfile2
[root@localhost itbank]#
[root@localhost itbank]# ls -l /mountpoint
합계 0
-rw-r--r--. 1 root root 0  1월 10 14:05 testfile2        // 현재 /mountpoint dir. 에 testfile2 file 존재
[root@localhost itbank]#
[root@localhost itbank]# ls -l /dev/sdb1
brw-rw----. 1 root disk 8, 17  1월 10 13:31 /dev/sdb1
[root@localhost itbank]#
[root@localhost itbank]# mount /dev/sdb1 /mountpoint     // /dev/sdb1 == /mountpoint
[root@localhost itbank]#
[root@localhost itbank]# ls -l /mountpoint/    
합계 0                                            // dev/sdb1으로 mount를 해서 testfile2가 사라짐
[root@localhost itbank]#

[root@localhost itbank]# touch /mountpoint/testfile1
[root@localhost itbank]#
[root@localhost itbank]# ls -l /mountpoint
합계 0
-rw-r--r--. 1 root root 0  1월 10 14:08 testfile1

 

// 현재 마운트된 목록 확인

// 1> 마운트된 detail한 목록

[root@localhost itbank]# mount | tail -1
/dev/sdb1 on /mountpoint type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

or

// 2> mount  유무

[root@localhost itbank]# df -h | tail -1
/dev/sdb1       497M   26M  472M   6% /mountpoint

 

// 마운트 해지

[root@localhost itbank]# umount /dev/sdb1

or

[root@localhost itbank]# umount /mountpoint

 

// 확인해 보면 해지 된 것을 알 수 있다

[root@localhost itbank]# mount | tail -1        
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=99972k,mode=700)
[root@localhost itbank]#
[root@localhost itbank]# df -h | tail -1
tmpfs            98M     0   98M   0% /run/user/0
[root@localhost itbank]#
[root@localhost itbank]# ls -l /mountpoint/
합계 0
-rw-r--r--. 1 root root 0  1월 10 14:05 testfile2    // mount하기전 만든 파일 존재 => mount할 dir은 비어있는 거로 하기!
[root@localhost itbank]#
[root@localhost itbank]# ls -l /dev/sdb1
brw-rw----. 1 root disk 8, 17  1월 10 13:31 /dev/sdb1    
[root@localhost itbank]#
[root@localhost itbank]#
[root@localhost itbank]# df -h
Filesystem      Size  Used Avail Use% Mounted on    // mount 장치 빠진 것 확인?
/dev/sda3        17G  4.8G   13G  28% /
devtmpfs        474M     0  474M   0% /dev
tmpfs           489M     0  489M   0% /dev/shm
tmpfs           489M  7.0M  482M   2% /run
tmpfs           489M     0  489M   0% /sys/fs/cgroup
/dev/sda1      1014M  194M  821M  20% /boot
tmpfs            98M   12K   98M   1% /run/user/42
tmpfs            98M     0   98M   0% /run/user/0
[root@localhost itbank]#

[root@localhost itbank]# mount /dev/sdb1 /mountpoint
[root@localhost itbank]#
[root@localhost itbank]# df -h | tail -1
/dev/sdb1       497M   26M  472M   6% /mountpoint
[root@localhost itbank]#
[root@localhost itbank]# umount /mountpoint/
[root@localhost itbank]#
[root@localhost itbank]# df -h | tail -1
tmpfs            98M   28K   98M   1% /run/user/0

 

// CD-ROM mount ( 위에 ☆ CD-ROM 사용 방법 참고)

// mount된 목록 출력

[root@localhost ~]# mount | tail -1
/dev/sr0 on /run/media/root/CentOS 7 x86_64 type iso9660 (ro,nosuid,nodev,relatime,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
[root@localhost ~]#

// mount 상태 확인

[root@localhost ~]# df -h | tail -1
/dev/sr0        8.1G  8.1G     0 100% /run/media/root/CentOS 7 x86_64
[root@localhost ~]#

// unmount

[root@localhost ~]# umount /dev/sr0
[root@localhost ~]#
[root@localhost ~]# mount | tail -1
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
[root@localhost ~]#

// mount 장치 2가지 (둘 중에 아무거나 써도 됨)

[root@localhost ~]# ls -l /dev/sr0    // 원본
brw-rw----+ 1 root cdrom 11, 0  1월 10 14:30 /dev/sr0
[root@localhost ~]# ls -l /dev/cdrom // 바로가기
lrwxrwxrwx. 1 root root 3  1월 10 14:30 /dev/cdrom -> sr0    // 바로가기 → 원본
// ex> ln -s 원본 바로가기

// cdrom mount

[root@localhost itbank]# mkdir /mountpoint
[root@localhost itbank]#
[root@localhost itbank]# ls -ld /mountpoint
drwxr-xr-x 2 root root 6  1월 24 22:32 /mountpoint

[root@localhost ~]# mount /dev/cdrom /mountpoint
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]#

// mount 상태 확인

[root@localhost ~]# mount | tail -1
/dev/sr0 on /mountpoint type iso9660 (ro,relatime)
[root@localhost ~]#
[root@localhost ~]# df -h | tail -1
/dev/sr0        8.1G  8.1G     0 100% /mountpoint
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# cd /mountpoint/
[root@localhost mountpoint]#
[root@localhost mountpoint]# ls
CentOS_BuildTag  GPL       RPM-GPG-KEY-CentOS-7          images
EFI              LiveOS    RPM-GPG-KEY-CentOS-Testing-7  isolinux
EULA             Packages  TRANS.TBL                     repodata

// unmount

[root@localhost mountpoint]# pwd
/mountpoint

[root@localhost mountpoint]# umount /dev/cdrom
umount: /mountpoint: target is busy.        // mountpt. 가 아닌 곳으로 나가야..,
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@localhost mountpoint]#
[root@localhost mountpoint]# cd ~itbank
[root@localhost itbank]#
[root@localhost itbank]# umount /dev/cdrom

반응형
LIST