(2023/05/13)systemdを使用したケースをこちらの記事で追加しました。
#環境
- Raspberry Pi 2 B+
- ArchLinux armv7l
- HD-LC3.0U3-BKE(バッファローの外付けHDD3TB)
一度Windowsにつなげて使っていたため、ファイルシステムを「ntfs」から「ext4」にする。
#コマンド
まず、2TB以上のドライブを扱うので「parted」コマンドを使う。
「fdisk」は2TB未満に対応しているらしい。
「parted」コマンドのインストール
[root@alarmpi ~]# pacman -Ss parted
extra/gparted 0.27.0-1
A Partition Magic clone, frontend to GNU Parted
extra/parted 3.2-5
A program for creating, destroying, resizing, checking and copying partitions
[root@alarmpi ~]#
[root@alarmpi ~]#
[root@alarmpi ~]# pacman -S parted
resolving dependencies...
looking for conflicting packages...
Package (1) New Version Net Change Download Size
extra/parted 3.2-5 2.07 MiB 0.37 MiB
Total Download Size: 0.37 MiB
Total Installed Size: 2.07 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
parted-3.2-5-armv7h 381.2 KiB 116K/s 00:03 [#######################################################################################################################] 100%
(1/1) checking keys in keyring [#######################################################################################################################] 100%
(1/1) checking package integrity [#######################################################################################################################] 100%
(1/1) loading package files [#######################################################################################################################] 100%
(1/1) checking for file conflicts [#######################################################################################################################] 100%
(1/1) checking available disk space [#######################################################################################################################] 100%
:: Processing package changes...
(1/1) installing parted [#######################################################################################################################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...
[root@alarmpi ~]#
パーティションの作成
「fdisk -l」は見慣れてるのですが、「parted -l」は初めて見ます。
[root@alarmpi ~]# parted -l
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Warning: failed to translate partition name
Number Start End Size File system Name Flags
1 524kB 3001GB 3001GB ntfs msftdata
Model: SD SL32G (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 8192B 105MB 105MB primary fat16 lba
2 105MB 31.9GB 31.8GB primary ext4
[root@alarmpi ~]#
ラベルの作成
[root@alarmpi mnt]# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted)
(parted) print
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted)
パーティションの作成
(parted) unit GB
(parted) print
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart
Partition name? []? buffalohdd
File system type? [ext2]? ext4
Start? 0
End? 3000
(parted)
(parted)
(parted) print
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 0.00GB 3000GB 3000GB ext4
(parted) quit
ext4でフォーマットする
[root@alarmpi mnt]# parted -l
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3000GB 3000GB ntfs
Model: SD SL32G (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 8192B 105MB 105MB primary fat16 lba
2 105MB 31.9GB 31.8GB primary ext4
[root@alarmpi mnt]#
[root@alarmpi mnt]#
[root@alarmpi mnt]# mkfs.ext4 /dev/sda
mke2fs 1.43.3 (04-Sep-2016)
/dev/sda contains `DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,1), end-CHS (0x3ff,254,63), startsector 1, 4294967295 sectors, extended partition table (last)' data
Proceed anyway? (y,n) y
Creating filesystem with 732566646 4k blocks and 183148544 inodes
Filesystem UUID: 2c30ae70-8197-441d-9ea6-33d652e28df2
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
[root@alarmpi mnt]#
確認
「parted -l」の内容。
[root@alarmpi ~]# parted -l
Model: BUFFALO External HDD (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 3001GB 3001GB ext4
Model: SD SL32G (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 8192B 105MB 105MB primary fat16 lba
2 105MB 31.9GB 31.8GB primary ext4
[root@alarmpi ~]#
「mount」する。
[root@alarmpi ~]# mount /dev/sda /mnt/usbhdd/
[root@alarmpi ~]# mount
/dev/mmcblk0p2 on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=467864k,nr_inodes=116966,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=94436k,mode=700,uid=1001,gid=10)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda on /mnt/usbhdd type ext4 (rw,relatime,data=ordered)
[root@alarmpi ~]#