2016年8月13日 星期六

[Archlinux] Using MBR method to boot archlinux os

Using parted to divide first bootable partition
Using cfdisk to divide rest of patition

Replace ‘sdX’ with your block device name, in my case it was:

# parted /dev/sda

We have to first create a partition table with msdos.
It will warn you about destroying all data. Type Yes.

(parted) mklabel msdos

Now we have to create partitions (keep a note, this tutorial is for MBR/BIOS systems.) 
Use the following pattern to create partitions:

We first need to create the root, so the part-type will be primary; the file system will be ext4.

(parted) mkpart primary ext4 1M 60G

Now we will set boot flag on it:

(parted) set 1 boot on


Format each partition and swapon the swap partition.
mkfs -t ext4 /dev/sda1
mkfs -t ext4 /dev/sda3

mkswap /dev/sda2
swapon /dev/sda2

mount /dev/sda1 /mnt

mkdir /mnt/home
mount /dev/sda3 /mnt/home
Install base package into /mnt
pacstrap -i /mnt base net-tools dhclient

Create fstab into /mnt/
genfstab -U /mnt > /mnt/etc/fstab

Switch shell to user shell
arch-chroot /mnt

Install bootloader
pacman -S grub

Here sdX will be the drive and not a partition, so in my case it was:

# grub-install --recheck --target=i386-pc /dev/sda

Now generate grub.cfg:

# grub-mkconfig -o /boot/grub/grub.cfg

Remove USB device and restart PC will load arch OS successfully.

Ref:

0 意見:

張貼留言