ArchLinux ; Installation #2 Disk Partitioning (This page)
ArchLinux ; Installation #3 Initial settings during installation
uses ext4 for the file system
If you are installing on a btrfs file system, the following page summarizes the installation
Contents
1. Partitioning the disk on which Arch Linux is installed
This time, use gdisk command in UEFI mode and GPT for the partition table.
Check current disk information
1 2 3 4 5 |
root@archiso~ # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 841.4M 1 loop /run/archiso/airootfs sda 8:0 0 20G 0 disk sr0 11:0 1 1.2G 0 rom /run/archiso/bootmnt |
The sda in the NAME line is the device name for the entire disk.
Partitioning is performed on sda.
This time, create an EFI partition and a partition for Arch Linux, but not a swap partition.
In the past, a partition was created for swap and allocated as swap, but now a "swap file" can be used without a swap partition.
A "swap file" is a method of creating a single file of any size for swap and using that area as swap, which can be created, deleted, and resized.
For GPT
1 2 3 4 5 6 7 8 9 10 |
root@archiso~ # gdisk /dev/sda GPT fdisk (gdisk) version 1.0.10 Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present Creating new GPT entries in memory. |
・Create an empty partition table with the command "o"
1 2 3 |
Command (? for help):o This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): Y |
・Create EFI system partition
"n" command to add a partition
1 2 3 4 5 6 7 |
Command (? for help): n Partition number (1-128, default 1): First sector (34-62914526, default = 2048) or {+-}size{KMGTP}: Last sector (2048-62914526, default = 62912511) or {+-}size{KMGTP}: +512M Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): ef00 Changed type of partition to 'EFI system partition' |
・Create partition for Arch Linux
"n" command to add a partition
1 2 3 4 5 6 7 |
Command (? for help): n Partition number (2-128, default 2): First sector (34-62914526, default = 1050624) or {+-}size{KMGTP}: Last sector (1050624-62914526, default = 62912511) or {+-}size{KMGTP}: Current type is 8300 (Linux filesystem) Hex code or GUID (L to show codes, Enter = 8300): 8300 Changed type of partition to 'Linux filesystem' |
・Write partition table to disk
Use the "w" command
1 2 3 4 5 6 7 8 |
Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!! Do you want to proceed? (Y/N): Y OK; writing new GUID partition table (GPT) to /dev/nvme0n1. The operation has completed successfully. |
2. Format each partition
・Formatting the EFI System Partition
1 2 |
root@archiso~ # mkfs.vfat -F32 /dev/sda1 mkfs.fat 4.2 (2021-01-31) |
・Formatting partitions for Arch Linux
File systems that can be used with Linux include ext4 and XFS, but use the stable ext4 file system.
1 2 3 4 5 6 7 8 9 10 11 12 |
root@archiso~ # mkfs.ext4 /dev/sda2 mke2fs 1.47.2 (1-Jan-2025) Creating filesystem with 5111296 4k blocks and 1277952 inodes Filesystem UUID: dedc0c61-f151-4937-aa06-0a7a2bf73881 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done |
3. Install Arch Linux
3.1 Connect to the Internet
The files (packages) to be installed must be downloaded from the Internet, so you must first connect to the Internet on the installation system. (In most cases, if you have a wired LAN, the connection is made automatically at startup.
Connection Confirmation
1 2 3 4 5 6 7 8 9 10 11 |
root@archiso~ # ping -c 4 archlinux.jp PING archlinux.jp (160.16.119.98) 56(84) bytes of data. 64 bytes from tk2-235-27344.vs.sakura.ne.jp (160.16.119.98): icmp_seq=1 ttl=53 time=10.3 ms 64 bytes from tk2-235-27344.vs.sakura.ne.jp (160.16.119.98): icmp_seq=2 ttl=53 time=14.0 ms 64 bytes from tk2-235-27344.vs.sakura.ne.jp (160.16.119.98): icmp_seq=3 ttl=53 time=12.8 ms 64 bytes from tk2-235-27344.vs.sakura.ne.jp (160.16.119.98): icmp_seq=4 ttl=53 time=14.3 ms --- archlinux.jp ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3005ms rtt min/avg/max/mdev = 10.274/12.834/14.327/1.589 ms |
3.2 Time setting
When downloading a package from the Internet, adjust the time from the Internet, as it may not be possible to download if the computer time is not correct.
1 |
root@archiso~ # timedatectl set-ntp true |
3.3 Mounting partitions
・Mounting partitions for Arch Linux
1 |
root@archiso~ # mount /dev/sda2 /mnt |
・Mounting the EFI System Partition
Mount the EFI system partition to /mnt/boot where the boot loader and Linux kernel will be installed
1 2 |
root@archiso~ # mkdir /mnt/boot root@archiso~ # mount /dev/sda1 /mnt/boot |
3.4 Select Repository Server
・When using the reflector command
1 |
root@archiso~ # reflector --sort rate --country jp --latest 10 --save /etc/pacman.d/mirrorlist |
・To edit a mirror list
Open a mirror site for Country:Japan with the Pacman Mirrorlist Generator (https://archlinux.org/mirrorlist/) and you will find the following
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
## ## Arch Linux repository mirrorlist ## Generated on 2025-04-12 ## ## Japan #Server = http://mirror.aria-on-the-planet.es/archlinux/$repo/os/$arch #Server = https://mirror.aria-on-the-planet.es/archlinux/$repo/os/$arch #Server = http://mirrors.cat.net/archlinux/$repo/os/$arch #Server = https://mirrors.cat.net/archlinux/$repo/os/$arch #Server = http://jp.mirrors.cicku.me/archlinux/$repo/os/$arch #Server = https://jp.mirrors.cicku.me/archlinux/$repo/os/$arch #Server = http://ftp.tsukuba.wide.ad.jp/Linux/archlinux/$repo/os/$arch #Server = http://mirror.hashy0917.net/archlinux/$repo/os/$arch #Server = https://mirror.hashy0917.net/archlinux/$repo/os/$arch #Server = http://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch #Server = https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch #Server = http://repo.jing.rocks/archlinux/$repo/os/$arch #Server = https://repo.jing.rocks/archlinux/$repo/os/$arch #Server = http://www.miraa.jp/archlinux/$repo/os/$arch #Server = https://www.miraa.jp/archlinux/$repo/os/$arch #Server = http://mirror.nishi.network/archlinux/$repo/os/$arch #Server = https://mirror.nishi.network/archlinux/$repo/os/$arch #Server = https://mirror.saebasol.org/archlinux/$repo/os/$arch |
Delete the # at the beginning of these and paste them at the top of /etc/pacman.d/mirrorlist
3.5 Installing packages
At a minimum, you will need a base Linux kernel, firmware, a text editor (CUI), etc.
Others are useful tools that can be installed later when needed.
1 |
root@archiso~ # pacstrap /mnt base base-devel linux linux-firmware networkmanager vi vim nano openssh dhcpcd netctl wget man-db man-pages |
3.6 Setting up fstab
Describe information such as partitions to be automatically mounted at startup in the file /etc/fstab.
1 |
root@archiso~ # genfstab /mnt >> /mnt/etc/fstab |
Check the contents of the fstab file
1 2 3 4 5 6 7 8 9 10 11 |
root@archiso~ # vim /mnt/etc/fstab # Static information about the filesystems. # See fstab(5) for details. # <file system> <dir> <type> <options> <dump> <pass> # UUID=dedc0c61-f151-4937-aa06-0a7a2bf73881 /dev/sda2 / ext4 rw,relatime 0 1 # UUID=A46D-BD54 /dev/sda1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 |