본문 바로가기
SW 프로그래밍/센토스(CenTOS)

USB 추가하여 사용하기(인식, 마운트 및 설치)

by N2info 2021. 9. 27.

 

임시 DB서버가 용량이 거의 찬듯하다

추가로 USB를 설치하여 DB 백업용으로 사용하기 위해 아래와 같이 설정한다

 

USB 인식 확인

[root@localhost bin]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   1.8T  0 disk
└─sda1            8:1    0   1.8T  0 part
  ├─centos-root 253:0    0   1.9T  0 lvm  /
  ├─centos-swap 253:1    0   7.5G  0 lvm  [SWAP]
  ├─centos-var  253:2    0   9.3G  0 lvm  /var
  └─centos-home 253:3    0   9.3G  0 lvm  /home
sdb               8:16   0 111.8G  0 disk
├─sdb1            8:17   0   488M  0 part /boot
└─sdb2            8:18   0 111.3G  0 part
  └─centos-root 253:0    0   1.9T  0 lvm  /
sdc               8:32   1  29.4G  0 disk
└─sdc1            8:33   1  29.4G  0 part
sr0              11:0    1  1024M  0 rom
[root@localhost bin]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   1.8T  0 disk
└─sda1            8:1    0   1.8T  0 part
  ├─centos-root 253:0    0   1.9T  0 lvm  /
  ├─centos-swap 253:1    0   7.5G  0 lvm  [SWAP]
  ├─centos-var  253:2    0   9.3G  0 lvm  /var
  └─centos-home 253:3    0   9.3G  0 lvm  /home
sdb               8:16   0 111.8G  0 disk
├─sdb1            8:17   0   488M  0 part /boot
└─sdb2            8:18   0 111.3G  0 part
  └─centos-root 253:0    0   1.9T  0 lvm  /
sr0              11:0    1  1024M  0 rom
[root@localhost bin]#

lsblk 명령어를 입력하면 설치된 디스트 정보가 보인다. -f 옵션을 추가하면 더 많은 정보가 보인다.

[root@localhost bin]# lsblk -f
NAME            FSTYPE   LABEL    UUID                                   MOUNTPOINT
sda
└─sda1          LVM2_mem          pxgx2f-f2lp-jg3a-mFZe-0pEu-wcAT-pm2ivH
  ├─centos-root xfs               e2c68c33-f69b-443b-b500-d7ed00ea1656   /
  ├─centos-swap swap              ec5bb185-d8ef-4054-92bd-dad8eeb1039a   [SWAP]
  ├─centos-var  xfs               363b3039-585a-4674-ae29-d9e082e99bb6   /var
  └─centos-home xfs               1d12fd44-59f4-4dba-8d5f-adf98647f111   /home
sdb
├─sdb1          xfs               8dacd01a-8273-453e-b52a-a5d049739b42   /boot
└─sdb2          LVM2_mem          Rwx8jf-g6aL-4mdk-5h0b-2zVJ-i1U7-glF69A
  └─centos-root xfs               e2c68c33-f69b-443b-b500-d7ed00ea1656   /
sdc
└─sdc1          vfat     SONNY_32GB
                                  EA23-472C
sr0
[root@localhost bin]#

소니 USB 32GB 용량의 USB가 화면에 보인다. 참조

 

USB디스크를 마운트하기전 디렉토리를 하나 만들고...

그 다음에 마운트 한다.

[root@localhost bin]# mkdir /home/usb
[root@localhost bin]# ls -al /home/usb
total 0
drwxr-xr-x. 2 root root  6 Sep 27 11:40 .
drwxr-xr-x. 5 root root 47 Sep 27 11:40 ..
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]# mount /dev/sdc1 /home/usb
[root@localhost bin]# ls -al /home/usb
total 13008
drwxr-xr-x.  2 root root   16384 Feb 12  2020 ??
drwxr-xr-x. 10 root root   16384 Jan  1  1970 .
drwxr-xr-x.  5 root root      47 Sep 27 11:40 ..
-rwxr-xr-x.  1 root root 3496402 Aug 12  2019 8? PID ????.pdf
drwxr-xr-x.  4 root root   16384 May  6  2018 Android
-rwxr-xr-x.  1 root root 1699858 Aug 12  2019 Arduino UNO?? ESP8266 WiFi ??? ???? ?? __ ???? ?????.pdf
drwxr-xr-x.  3 root root   16384 Jan 11  2019 BCQRE
-rwxr-xr-x.  1 root root 2833672 Jul 21  2018 CrystalDiskMark5_5_0.exe
-rwxr-xr-x.  1 root root    2787 Jan  4  2019 DHT.zip
drwxr-xr-x.  3 root root   16384 Jan 11  2019 NPKI
-rwxr-xr-x.  1 root root 2661608 Jul 29  2019 ??? ?? ???? ??? ??? ?? ???.pdf
-rwxr-xr-x.  1 root root   15432 May 29  2019 ?????.png
drwxr-xr-x.  3 root root   16384 Jan 11  2019 SGASolutions
drwxr-xr-x.  2 root root   16384 Sep 22 05:59 System Volume Information
drwxr-xr-x.  7 root root   16384 Feb 12  2020 teraterm
drwxr-xr-x.  2 root root   16384 Feb 12  2020 VCard
-rwxr-xr-x.  1 root root 2424827 Aug 12  2019 [???? ??] WIFI ESP8266(ESP-01) ?? ???? ???? _ ??? ???.pdf
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  2.0T  1.8G  1.9T   1% /
devtmpfs                 890M     0  890M   0% /dev
tmpfs                    902M     0  902M   0% /dev/shm
tmpfs                    902M   97M  805M  11% /run
tmpfs                    902M     0  902M   0% /sys/fs/cgroup
/dev/sdb1                485M  229M  256M  48% /boot
/dev/mapper/centos-var   9.4G  4.4G  5.0G  47% /var
/dev/mapper/centos-home  9.4G  5.9G  3.5G  64% /home
tmpfs                    181M     0  181M   0% /run/user/0
/dev/sdc1                 30G   36M   30G   1% /home/usb
[root@localhost bin]#
[root@localhost bin]#
[root@localhost bin]#

 

기존 파일이 보이고 잘 연결되었다.

 

USB를 뺄때는 반드시 unmount 한후에 해야 한다

[root@localhost bin]#
[root@localhost bin]# umount /dev/sdc1
[root@localhost bin]# ls -al /home/usb
total 0
drwxr-xr-x. 2 root root  6 Sep 27 11:40 .
drwxr-xr-x. 5 root root 47 Sep 27 11:40 ..
[root@localhost bin]#