- USBを差込み割り当てられているドライブを確認
fdisk -lDisk /dev/sda: 234.4 GiB, 251658240000 bytes, 491520000 sectors
Disk model: USB DISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000Device Boot Start End Sectors Size Id Type
/dev/sda1 4294967295 8589934589 4294967295 2T ff BBT
/dev/sda2 4294967295 8589934589 4294967295 2T ff BBT
/dev/sda3 4294967295 8589934589 4294967295 2T ff BBT
/dev/sda4 4294967295 5035196669 740229375 353G ff BBT/dev/sdaに割り当てられていることを確認
- /dev/sdaを編集
fdisk /dev/sda - デリートコマンドで全てのパテーションを削除します
Command (m for help): d
Partition number (1-4, default 4):
※1から4まで全て消す。4から消していくCommand (m for help): d
Partition number (1-4, default 4): 4Partition 4 has been deleted.
Command (m for help): d
Partition number (1-3, default 3): 3Partition 3 has been deleted.
Command (m for help): d
Partition number (1,2, default 2): 2Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted. - 新規にパテーションを作成する
コマンドはn ※まるごとUSBを使うので全てデフォルトCommand (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-491519999, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-491519999, default 491519999):Created a new partition 1 of type ‘Linux’ and of size 234.4 GiB.
※内容確認 コマンドはp
Command (m for help): p
Disk /dev/sda: 234.4 GiB, 251658240000 bytes, 491520000 sectors
Disk model: USB DISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 491519999 491517952 234.4G 83 Linux無事にLINUXパテーションが作成されました。
- 確認後よければwコマンドで書込みし完了
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks. - フォーマット
- 使えるフォーマットを確認
root@raspberrypi:/home/pi# ls /sbin/mkfs.*
/sbin/mkfs.bfs /sbin/mkfs.ext3 /sbin/mkfs.minix /sbin/mkfs.vfat
/sbin/mkfs.cramfs /sbin/mkfs.ext4 /sbin/mkfs.msdos
/sbin/mkfs.ext2 /sbin/mkfs.fat /sbin/mkfs.ntfs - フォーマット開始
mkfs -t ext4 /dev/sdb1
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 61439744 4k blocks and 15360000 inodes
Filesystem UUID: db4c96f7-2ef2-48a4-ae9f-97c343a3d205
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks):
done
Writing superblocks and filesystem accounting information: done
- 使えるフォーマットを確認
- 完了