본문 바로가기
DBMS/기타

리눅스 디스크 추가 (오라클 버추얼박스)

by 드바 2023. 10. 26.
리눅스 디스크 추가 작업
- 오라클 버추얼박스 디스크 추가
- o/s 디스크 파티션 생성
- 파일시스템 포멧 및 마운트

 

VirtualBox 진행

버추얼박스 관리자 화면
머신 -> 설정

버추얼박스 머신 설정
버추얼박스 머신 설정

 
머신설정 화면
저장소 -> 컨트롤러 -> 하드디스크 추가

디스크 추가
디스크 추가

 
원하는 경로와 사이즈를 지정 후 만들기 버튼 클릭
data01.vdi로 만들어 주겠습니다

디스크 만들기
디스크 만들기

 
위에 지정해 준 data01.vdi 디스크가 생성된 것이 확인 됩니다
선택 버튼 클릭

디스크 선택
디스크 선택

 
해당 머신에 하드디스크가 추가 되었습니다
이제 VM을 기동해 주세요
이후 작업은 O/S(리눅스)에서 진행 합니다

디스크 추가
디스크 추가

 

반응형

O/S 진행

현재 파티션(디스크) 상태 확인
신규로 추가한 디스크는 /dev/sdc 입니다. 디스크에 파티션이 생성되어 있지 않음

[root@svr1 ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x0009e414

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896   209715199   104369152   8e  Linux LVM

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 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 /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x8fcc2d4e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux

Disk /dev/mapper/ol-root: 102.9 GB, 102869499904 bytes, 200916992 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 /dev/mapper/ol-swap: 4001 MB, 4001366016 bytes, 7815168 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@svr1 ~]#

 
신규 추가한 디스크(/dev/sdc)에 파티션 생성

[root@svr1 ~]# fdisk /dev/sdc
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 0x8d8d55e5.

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

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

Calling ioctl() to re-read partition table.
Syncing disks.
[root@svr1 ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x0009e414

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      976895      487424   83  Linux
/dev/sda2          976896   209715199   104369152   8e  Linux LVM

Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 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: 0x8d8d55e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048    20971519    10484736   83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x8fcc2d4e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux

Disk /dev/mapper/ol-root: 102.9 GB, 102869499904 bytes, 200916992 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 /dev/mapper/ol-swap: 4001 MB, 4001366016 bytes, 7815168 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@svr1 ~]#

 
파티션을 만든 후 파일시스템을 마운트 하여 실제 사용하기 위해서는 적절한 형태로 포멧을 진행해줘야 합니다
xfs 타입으로 파일시스템을 생성하겠습니다

[root@svr1 dev]# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1              isize=256    agcount=4, agsize=655296 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=2621184, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

-- 확인
[root@svr1 dev]# file -s /dev/sdc1
/dev/sdc1: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)

-- 디렉토리 생성
[root@svr1 dev]# mkdir /data01

-- 신규 디스크 /data01 경로에 마운트
[root@svr1 dev]# mount /dev/sdc1 /data01

-- 확인
[root@svr1 /]# df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
devtmpfs            devtmpfs  3.9G  4.0K  3.9G   1% /dev
tmpfs               tmpfs     3.9G  637M  3.3G  16% /dev/shm
tmpfs               tmpfs     3.9G  9.6M  3.9G   1% /run
tmpfs               tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/ol-root xfs        96G   80G   17G  84% /
/dev/sda1           xfs       473M  194M  280M  41% /boot
tmpfs               tmpfs     799M  4.0K  799M   1% /run/user/42
tmpfs               tmpfs     799M   24K  799M   1% /run/user/0
/dev/sdc1           xfs        10G   33M   10G   1% /data01
[root@svr1 /]#

 

서버 재기동 시  자동 mount

/etc/fstab 파일에 내용 추가해줘야 자동 mount 됩니다

/dev/sdc1 /data01 xfs defaults 0 0

[root@svr1 work]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Sat Jun 27 22:06:13 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/ol-root     /                       xfs     defaults        0 0
UUID=6c562677-d197-4aff-8f0e-db276c8f94d3 /boot                   xfs     defaults        0 0
/dev/mapper/ol-swap     swap                    swap    defaults        0 0
/dev/sdc1     /data01                       xfs     defaults        0 0
[root@svr1 work]#

댓글