You are not logged in.

#1 2012-01-08 01:01:08

Cows
Member
From: Brooklyn, NY
Registered: 2007-05-20
Posts: 101

[VIDEO TUTORIAL] Installing Arch Linux on GPT/LVM/GRUB2

Hello everyone,

I've recently switched over from running my machine on LVM with a MSDOS partition style, and I was tired of the limitations of it. Such as 4 primary partions or 3 primary and 1 extended. It was also hindering my flexibility since I had to make 1 primary partition that was /boot, which forced me to make an initram image if I wanted to put my / inside of the LVM. The only way I could truly fix all my problems was to move away from GRUB-Legacy (Which I love since it's so easy to configure) over to GRUB 2(Which is not as bad as I thought it was).

I made this video to help people trying to do this combination. I also included the links to further information in the videos' description. It contains a link to GRUB 2 Architecture and moving over to GRUB (on IBM's site), and also ArchWiki resources for further reading.

I hope you enjoy it.

http://www.youtube.com/watch?v=69X9ZYA41xU

After you finish doing this, you will end up with this style:

GPT Partition Layout w/ Protective MBR.

/dev/sda1 - BIOS Boot Partition
/dev/sda2 - Linux LVM (arch is name of LVM)
--> /dev/arch/boot - ext2
--> /dev/arch/swap - swap
--> /dev/arch/root - ext4
--> /dev/arch/home - ext4

Offline

#2 2012-01-08 13:52:09

Earnestly
Member
Registered: 2011-08-18
Posts: 805

Re: [VIDEO TUTORIAL] Installing Arch Linux on GPT/LVM/GRUB2

As a complete newbie to partitioning on Linux I'd like to say how grateful I am to for making this.
You've kept it clear, clean and simple which I appreciate.

As most of my ventures into installing Linux is usually accompanied with a graphical installer a great deal of this is fairly alien. It could be nice to have a wiki entry just laying out a few examples for partitioning and setting up arch in various simple and exotic ways.

Again, thank you for this contribution. (While I quickly transcribe the steps in your video and ready the 'man' command)

Edit:
Basic step by step transcription

[root@archiso ~]# modprobe dm-mod
[root@archiso ~]# dhcpcd
...
[root@archiso ~]# pacman -Syy gptfdisk
...
[root@archiso ~]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.1

Partition table scan:
    MBR: not present
    BSD: not present
    APM: not present
    GPT: not present

Creating new GPT entries.

Command (? for help): [n]
Partition number (1-128, default 1): [RETURN]
First sector (34-[max], default = 34) or {+-}size{KMGTP}: [RETURN]
Information: Moved requested sectory from 34 to 2048 in
order to align on 2048-sector boundries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-[max], default = [max]) or{+-}size{KMGTP}: [+32MB]
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): [EF02]
Changed type of partition to 'BIOS boot partition'

Command (? for help): [n]
Partition number (2-128, default 2): [RETURN]
First sector (34-[max], default = 67584) or {+-}size{KMGTP}: [RETURN]
Last sector (2048-[max], default = [max]) or {+-}size{KMGTP}: [RETURN]
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): [8E00]
Changed type of partition to 'Linux LVM'

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).
The operaton has completed successfully.
[root@archiso ~]# pvcreate /dev/sda2
...
[root@archiso ~]# vgcreate arch /dev/sda2
...
[root@archiso ~]# vgdisplay
...
[root@archiso ~]# lvcreate -L 100M -n boot arch
[root@archiso ~]# lvcreate -C y -L 1G -n swap arch
[root@archiso ~]# lvcreate -L 10G -n root arch
[root@archiso ~]# lvcreate -l 100%FREE -n home arch
[root@archiso ~]# lvscan
...
[root@archiso ~]# mkfs.ext2 /dev/arch/boot
[root@archiso ~]# mkfs.ext4 /dev/arch/root
[root@archiso ~]# mkfs.ext4 /dev/arch/home
[root@archiso ~]# mkswap /dev/arch/swap
[root@archiso ~]# /arch/setup
...
Prepare Hard Drive

    3 Manually Configure block devices, filesystems andmountpoints

Partition Access Method

    dev directly by /dev/* (most intuitive but devicefile names can change

Manage Filesystems

    /dev/sda1 raw - 32MiB	         N
    /dev/mapper/arch-boot raw - 100MiB	 N > [IGNORE]
    /dev/mapper/arch-home raw - 91000MiB N > filesystem (re)created? [NO] > ext4 home
    /dev/mapper/arch-root raw - 10240MiB N > filesystem (re)created? [NO] > ext4 root
    /dev/mapper/arch-swap raw - 1024MiB  N > filesystem (re)created? [NO] > swap
    
Choose bootloader

    [SKIP]

Configuration

    mkinitcpio > HOOKS="...lvm2..."
    
DONE
Exit

[root@archiso ~]# mount -o bind /dev /mnt/dev
[root@archiso ~]# mount -t proc /proc /mnt/proc
[root@archiso ~]# mount -t sysfs /sys /mnt/sys
[root@archiso ~]# chroot /mnt /bin/bash
[root@archiso /]# dhcpcd
...
[root@archiso /]# pacman-db-upgrade
[root@archiso /]# pacman -Syy grub2-bios
...
[root@archiso /]# grub_bios-install --boot-directory=/boot --no-floppy --recheck --debug /dev/sda
...
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
...
[root@archiso /]# exit
[root@archiso ~]# reboot
...
login
...
[root@host ~]# $EDITOR /etc/default/grub
    #GRUB_GFXMODE=auto
    #GRUB_GFXPAYLOAD_LINUX=keep
    #GRUB_COLOR_NORMAL="light-blue/black"
    #GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
[root@host ~]# chmod -x /etc/grub.d/10_linux
[root@host ~]# $EDITOR /etc/grub.d/40_custom
     menuentry "Arch Linux" {
    	insmod lvm
        
        set root=(arch-boot)
        linux /vmlinuz-linux root=/dev/arch/root ro
        initrd /initramfs-linux.img
    }
    menuentry "Arch Linux Fallback" {
    	insmod lvm
        
        set root=(arch-boot)
        linux /vmlinuz-linux root=/dev/arch/root ro
        initrd /initramfs-linux-fallback.img
    }
[root@host ~]# grub-mkconfig -o /boot/grub/grub.cfg
...
[root@host ~]# reboot

Last edited by Earnestly (2012-01-09 11:51:45)

Offline

#3 2012-01-09 09:33:06

Cows
Member
From: Brooklyn, NY
Registered: 2007-05-20
Posts: 101

Re: [VIDEO TUTORIAL] Installing Arch Linux on GPT/LVM/GRUB2

No problem smile.

I tested the lvm2 hook step which I was suspicious about. You do need it there. Just because GRUB2 can see the LVMs, doesn't mean that the kernel will too sad.

Offline

Board footer

Powered by FluxBB