Linux CentOS / AlmaLinux 外付けHDDフォーマット&マウントメモ

投稿者:

[root@localhost ~]# fdisk /dev/sdd

Thank you for reading this post, don't forget to subscribe!

fdisk (util-linux 2.32.1) へようこそ。
ここで設定した内容は、書き込みコマンドを実行するまでメモリのみに保持されます。
書き込みコマンドを使用する際は、注意して実行してください。

デバイスには認識可能なパーティション情報が含まれていません。
新しい DOS ディスクラベルを作成しました。識別子は 0x0fa26329 です。

コマンド (m でヘルプ): p
ディスク /dev/sdd: 1.8 TiB, 2000398934016 バイト, 3907029168 セクタ
単位: セクタ (1 * 512 = 512 バイト)
セクタサイズ (論理 / 物理): 512 バイト / 512 バイト
I/O サイズ (最小 / 推奨): 512 バイト / 33553920 バイト
ディスクラベルのタイプ: dos
ディスク識別子: 0x0fa26329

コマンド (m でヘルプ): n
パーティションタイプ
p 基本パーティション (0 プライマリ, 0 拡張, 4 空き)
e 拡張領域 (論理パーティションが入ります)
選択 (既定値 p): p
パーティション番号 (1-4, 既定値 1):
最初のセクタ (65535-3907029167, 既定値 65535):
最終セクタ, +セクタ番号 または +サイズ{K,M,G,T,P} (65535-3907029167, 既定値 3907029167):

新しいパーティション 1 をタイプ Linux、サイズ 1.8 TiB で作成しました。

コマンド (m でヘルプ): w
パーティション情報が変更されました。
ioctl() を呼び出してパーティション情報を再読み込みします。
ディスクを同期しています。

[root@localhost ~]# mkfs.ext4 /dev/sdd
mke2fs 1.45.6 (20-Mar-2020)
Found a dos partition table in /dev/sdd
Proceed anyway? (y,N) y
Creating filesystem with 488378646 4k blocks and 122101760 inodes
Filesystem UUID: e9a7cd7a-2adb-4cae-a98b-a19fda0e8500
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 (262144 blocks):
done
Writing superblocks and filesystem accounting information:
done

[root@localhost ~]# mkdir /mnt/usb-hdd
[root@localhost ~]# mount /dev/sdd /mnt/usb-hdd/

[root@localhost ~]# ls -l /dev/disk/by-uuid
合計 0
lrwxrwxrwx 1 root root 10 6月 27 02:47 282e9bc3-05db-445a-8be1-9ed3e8d74c57 -> ../../dm-1
lrwxrwxrwx 1 root root 10 6月 27 02:47 3b2c27cb-8793-43f6-8b6c-44b165cebde3 -> ../../sda1
lrwxrwxrwx 1 root root 10 6月 27 02:47 42cd270a-bc5d-4735-bc48-8da02d55945b -> ../../dm-0
lrwxrwxrwx 1 root root 10 6月 27 02:47 5e1c61f2-c973-42d8-aacb-1d8412928d91 -> ../../sda2
lrwxrwxrwx 1 root root 10 6月 27 02:47 768b797f-5fa7-428a-a527-0d98502a11d8 -> ../../sdb1
lrwxrwxrwx 1 root root 10 6月 27 02:47 de92ab39-0426-4b17-a248-26d14d254429 -> ../../dm-2
lrwxrwxrwx 1 root root 9 8月 16 13:37 e9a7cd7a-2adb-4cae-a98b-a19fda0e8500 -> ../../sdd

UUIDを確認した後に
/etc/fstab に記述して起動時の自動マウント設定
UUID=e9a7cd7a-2adb-4cae-a98b-a19fda0e8500 /mnt/usb-hdd ext4 defaults 0 0