Linux HDD Mount 하드 추가

1 minute read

테스트 환경 OS

  • Ubuntu18.04 Bionic Beaver
  • Debian10 Buster

파티션 잡기

두가지 툴을 보통 사용

  • fdisk 2TB이하
  • parted 2TB이상 대용량

이었는데… fdisk에서 gpt가 지원이 되는 듯 한데..
원래 됐다 / 지금도 안된다 / 버전업되서 추가됐다
3가지중 뭘까

fdisk로 파티션 잡기

$ fdisk -v
 fdisk from util-linux 2.33.1

$ sudo fdisk -l
여기서 새로 설치한 디스크를 잘~ 확인

$ fdisk /dev/sdb
Welcome to fdisk (util-linux 2.33.1).
 Changes will remain in memory only, until you decide to write them.
 Be careful before using the write command.
 Command (m for help): m
 Help:
 GPT
    M   enter protective/hybrid MBR
 Generic
    d   delete a partition
    F   list free unpartitioned space
    l   list known partition types
    n   add a new partition
    p   print the partition table
    t   change a partition type
    v   verify the partition table
    i   print information about a partition
 Misc
    m   print this menu
    x   extra functionality (experts only)
 Script
    I   load disk layout from sfdisk script file
    O   dump disk layout to sfdisk script file
 Save & Exit
    w   write table to disk and exit
    q   quit without saving changes
 Create a new label
    g   create a new empty GPT partition table
    G   create a new empty SGI (IRIX) partition table
    o   create a new empty DOS partition table
    s   create a new empty Sun partition table

(??) m  -- 위에 나온거 다시볼 수 있다

(??) d  -- 파티션 다 지우기

(??) g  -- GTP로..

(??) n  -- 파티션 생성

(??) i  -- 파티션 정보보기

(??) p -- 파티션 테이블 정보보기

parted로 파티션 잡기

https://blog.hqcodeshop.fi/archives/273-GNU-Parted-Solving-the-dreaded-The-resulting-partition-is-not-properly-aligned-for-best-performance.html
$ sudo parted /dev/sdb
~~~
parted는 기본으로 안 깔려있으니 설치
$ sudo apt install parted

(parted) mktable gpt
(parted) mkpart
ext4
0%
100%

포맷

http://mhugt.tistory.com/47
http://noota.tistory.com/entry/%EC%9E%90%EB%8F%99-%EB%A7%88%EC%9A%B4%ED%8A%B8-%EB%B6%80%ED%8C%85-%EC%8B%9C-%EC%9B%90%ED%95%98%EB%8A%94-%ED%95%98%EB%93%9C%EB%94%94%EC%8A%A4%ED%81%AC-%EC%9E%90%EB%8F%99%EC%9C%BC%EB%A1%9C-%EB%A7%88%EC%9A%B4%ED%8A%B8-%EB%90%98%EB%8F%84%EB%A1%9D-%EC%B2%98%EB%A6%AC%ED%95%98%EA%B8%B0

$ sudo mkfs.ext4 /dev/sdb1
$ mkdir tmpdir
$ sudo mount /dev/sdb1 /tmpdir

자동 마운트

uuid 확인

$ sudo blkid
$ ll /etc/disk/by-uuid
$ nano /etc/fstab

맨뒷줄에 추가
UUID=xxxxxxxxxxxxxxxxxxxxxxuuidxxxxx /tmpdir ext4 defaults 0 0

tmpdir을 원하는 경로로 변경

마운트 테스트

$ sudo mount -fav

LVM추가

  • https://hiseon.me/linux/lvm-configuration/
  • https://jangpd007.tistory.com/235
  • https://wiki.debian.org/LVM#Create_a_PV