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 |
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 788.9M 1 loop /run/archiso/airootfs sr0 11:0 1 1.1G 0 rom /run/archiso/bootmnt nvme0n1 259:0 0 30G 0 disk |
In the above case, a 30 GB virtual HDD was created on VmwareWorkstion, so the SIZE of the nvme0n1 is set to 30 GB.
The sda in the NAME line is the name of the device that represents the entire disk and will be partitioned to this 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 |
# gdisk /dev/nvme0n1 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 |
# mkfs.vfat -F32 /dev/nvme0n1p1 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 13 14 |
# mkfs.ext4 /dev/nvme0n1p2 mke2fs 1.47.0 (5-Feb-2023) /dev/nvme0n1 contains a vfat file system Proceed anyway? (y,N) y Creating filesystem with 7864320 4k blocks and 1966080 inodes Filesystem UUID: ae90b5e9-eada-4e19-9ef7-1d03f312384a 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 |
# 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 |
# timedatectl set-ntp true |
3.3 Mounting partitions
・Mounting partitions for Arch Linux
1 |
# mount /dev/nvme0n1p2 /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 |
# mkdir /mnt/boot # mount /dev/nvme0n1p1 /mnt/boot |
3.4 Select Repository Server
・When using the reflector command
1 |
# 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
##Japan
#Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
#Server = https://mirrors.cat.net/archlinux/$repo/os/$arch
#Server = http://ftp.tsukuba.wide.ad.jp/Linux/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 = 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 |
# 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 |
# genfstab /mnt >> /mnt/etc/fstab |
Check the contents of the fstab file
1 2 3 4 5 6 7 8 9 10 11 |
# vim /mnt/etc/fstab # Static information about the filesystems. # See fstab(5) for details. # <file system> <dir> <type> <options> <dump> <pass> # UUID=6d751983-f27b-4761-b2be-a97e73f46e47 /dev/nvme0n1p2 / ext4 rw,relatime 0 1 # UUID=BC5A-3349 /dev/nvme0n1p1 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 |