Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoggy/4ff01e8ddcc972d2befdec8dff616606 to your computer and use it in GitHub Desktop.
Save yoggy/4ff01e8ddcc972d2befdec8dff616606 to your computer and use it in GitHub Desktop.

XFSでパーティションを作成するメモ.md

パーティションの切り方

$ sudo parted /dev/sdb
...
(parted) p
...
Number  Start  End  Size  File system  Name  Flags
※元からパーティションがあった場合は、1番以降に何か表示される

もしパーティションタイプがMBRだった場合はパーティションタイプをGPTに変更しておく
(parted) mklabel gpt

パーティションを消す場合はrmコマンド
(parted) rm 1

パーティションの作り方
(parted) mkpart
Partition name?  []? test-name
File system type?  [ext2]? xfs
Start? 0%
End? 100%
(parted) p
...
Number  Start   End     Size    File system  Name  Flags
 1      1049kB  ????TB  ????TB  xfs          test-name

(parted) quit   ← quitするとパーティション情報が更新される

フォーマット

$ sudo mkfs.xfs /dev/sdb1

/etc/fstabの設定

$ ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 root root  80 May  2 11:12 .
drwxr-xr-x 7 root root 140 May  2 11:12 ..
lrwxrwxrwx 1 root root  10 May  2 11:12 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -> ../../sdb1 ←これが追加したHDDのUUID
lrwxrwxrwx 1 root root  10 Apr 30 13:39 ????????-????-????-????-???????????? -> ../../sda1

$ sudo vi /etc/fstab
※以下の行を追加
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt xfs defaults 1 2

※最後にfstabの内容でマウントできるかどうかをチェック
$ sudo mount -a
$ df -h
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sdb1       7.3T  0G  7.3T   0% /mnt

メモ

ext4は16TBまでらしい…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment