Linux

Centos7 하드디스크 추가하기

Jack Moon 2020. 3. 6. 13:04

하드디스크를 추가 장착한 후 현재 파티션 상황을 보면 추가 장착한 하드가 나타난다.


[root@up ~]# fdisk -l


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 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: 0x0008d07f


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1050623      524288   83  Linux

/dev/sda2         1050624   855590911   427270144   83  Linux

/dev/sda3       855590912  1674790911   409600000   83  Linux

/dev/sda4      1674790912  1953523711   139366400    5  Extended

/dev/sda5      1674795008  1879595007   102400000   83  Linux

/dev/sda6      1879597056  1941037055    30720000   83  Linux

/dev/sda7      1941039104  1949427711     4194304   82  Linux swap / Solaris

/dev/sda8      1949429760  1953523711     2046976   83  Linux

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk label type: gpt

Disk identifier: F00E5BE5-7275-4243-867C-6CB55AB162DF



#         Start          End    Size  Type            Name

 1           34   1953525134  931.5G  Microsoft basic 

Partition 1 does not start on physical sector boundary.


추가 하드디스크의 파티션을 나눈다.


[root@up ~]# fdisk /dev/sdb

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

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.



Command (m for help): d

Selected partition 1

Partition 1 is deleted


Command (m for help): n

Partition number (1-128, default 1): 1

First sector (34-1953525134, default 2048): 

Last sector, +sectors or +size{K,M,G,T,P} (2048-1953525134, default 1953525134): 

Created partition 1



Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.


디스크 포맷 (ext4 형식으로)


[root@up ~]# mkfs -t ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

61054976 inodes, 244190385 blocks

12209519 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2392850432

7453 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, 71663616, 78675968, 

102400000, 214990848


Allocating group tables: done                            

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done   


새로운 폴더를 생성하고 마운트 시킨다


[root@up ~]# mkdir /home2

[root@up ~]# mount -t ext4 /dev/sdb1 /home2

[root@up ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda2       401G  7.5G  374G   2% /

devtmpfs        3.8G     0  3.8G   0% /dev

tmpfs           3.8G     0  3.8G   0% /dev/shm

tmpfs           3.8G  8.6M  3.8G   1% /run

tmpfs           3.8G     0  3.8G   0% /sys/fs/cgroup

/dev/sda6        29G  2.8G   25G  11% /usr

/dev/sda8       1.9G  5.9M  1.8G   1% /tmp

/dev/sda5        96G   20G   72G  22% /var

/dev/sda1       488M  164M  289M  37% /boot

/dev/sda3       385G  190G  176G  52% /home

tmpfs           778M     0  778M   0% /run/user/0

/dev/sdb1       917G   77M  871G   1% /home2


리부팅시에도 마운트 되도록 영구저장.

먼저 uuid를 찾고 /etc/fstab 파일을 수정한다.


[root@up ~]# ls -l /dev/disk/by-uuid

합계 0

lrwxrwxrwx 1 root root 10  3월  6 11:55 16bf2629-c76e-436d-badf-523adddd2ceb -> ../../sda7

lrwxrwxrwx 1 root root 10  3월  6 11:55 19f11acd-50b1-439f-ab8e-6fd3ddfffc60 -> ../../sda6

lrwxrwxrwx 1 root root 10  3월  6 11:55 29fbd435-4982-47c3-b379-64e463791092 -> ../../sda2

lrwxrwxrwx 1 root root 10  3월  6 11:55 77dd7e37-7480-4a69-954b-bc7d71503f8f -> ../../sda8

lrwxrwxrwx 1 root root 10  3월  6 11:55 92ac0fb8-6e51-45b0-8e11-cbecb186d7da -> ../../sda1

lrwxrwxrwx 1 root root 10  3월  6 11:55 aff96214-8629-4137-a637-3f7909bf49d4 -> ../../sda3

lrwxrwxrwx 1 root root 10  3월  6 12:04 c686e50a-92b3-4b40-8a69-441a38326f6b -> ../../sdb1

lrwxrwxrwx 1 root root 10  3월  6 11:55 d23977c6-3611-4039-84b6-0e95bbf7c2e9 -> ../../sda5


[root@up ~]# vi /etc/fstab 

UUID=29fbd435-4982-47c3-b379-64e463791092 /                       ext4    defaults        1 1

UUID=92ac0fb8-6e51-45b0-8e11-cbecb186d7da /boot                   ext4    defaults        1 2

UUID=aff96214-8629-4137-a637-3f7909bf49d4 /home                   ext4    defaults        1 2

UUID=77dd7e37-7480-4a69-954b-bc7d71503f8f /tmp                    ext4    defaults        1 2

UUID=19f11acd-50b1-439f-ab8e-6fd3ddfffc60 /usr                    ext4    defaults        1 2

UUID=d23977c6-3611-4039-84b6-0e95bbf7c2e9 /var                    ext4    defaults        1 2

UUID=c686e50a-92b3-4b40-8a69-441a38326f6b /home2                  ext4    defaults        1 2

UUID=16bf2629-c76e-436d-badf-523adddd2ceb swap                    swap    defaults        0 0


'Linux' 카테고리의 다른 글

CentOS 8 에 Visual Studio Code (vs code) 설치  (0) 2020.03.10
Centos8 APM 설치  (0) 2020.03.09
Centos 8 설치 및 셋팅  (0) 2020.03.06
CentOS 7, 8 iptables 사용하기  (0) 2020.02.24
PHP 첨부파일 용량 문제  (0) 2020.02.06