You are not logged in.

#1 2021-12-26 00:12:36

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Installing Arch on removable medium

Hi! I apologize if you've my previous post on this. I made a post almost two months ago with this question but I had pneumonia and completely forgot about the post. Because it's been so long, I am making a new post because I'm not sure if anyone (including the people that previously helped me) will see it. Basically, I have arch on an internal hard drive at /dev/sda3. I also have a flash drive on which I would like to have a copy of /dev/sda3. However, one challenge of this is that I only want arch on a small partition of this. I would like to keep the majority of the flash drive for general storage and keep it formatted with exfat. To visualize this, here is my lsblk output:

lsblk
NAME   LABEL    FSTYPE   UUID                                                                 MOUNTPOINT    FSUSED FSSIZE FSUSE%
sda                                                                                                            
├─sda1                   vfat        2600-471E                                                     
├─sda2                                                                                                      
├─sda3                   ext4       38ecd6d2-4502-4fd1-b548-ba903101f322   /                         20.6G    62.8G    33%
└─sda5                   ext4       712504da-d862-4184-92f9-261a86c9c425                          
sdb                                                                                    
├─sdb1 EFI             vfat        67E3-17ED                                                     
├─sdb2 FlashDrive exfat      618C-4570                                                     
└─sdb3 Arch           ext4       4ecb08f5-dd79-40d3-9339-d93b8ba59561

I have followed the advice of @V1del (by the way, thanks for the response) and formatted /dev/sdb3 with ext4 and copied the parts of /dev/sda3 that I want on it with:

rsync -gloptrucaAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt/usbmnt

Next I edited my fstab on the flash drive to get the right UUID on it. Lastly, after running fdisk -l, I saw that it had an efi partition at /dev/sdb1

Disk /dev/sdb
Disk model:  SanDisk 3.2Gen1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt

Device         Start       End   Sectors  Size Type
/dev/sdb1         40    409639    409600  200M EFI System

But after mounting it I saw that it was empty. The wiki (https://wiki.archlinux.org/title/Instal … edium#GRUB) instructed me to run the following command but results in an error.

$ grub-install --target=x86_64-efi --efi-directory=/mnt/usbmnt --removable --recheck
     Installing for x86_64-efi platform.
     grub-install: error: failed to get canonical path of `/boot/grub'.

When I try to boot from this drive it doesn't work and I was hoping someone could help me. Thanks in advance!

ps I have read the wiki guide I linked above.

Last edited by anthanor2 (2021-12-26 00:21:21)

Offline

#2 2021-12-26 00:13:50

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: Installing Arch on removable medium

Sorry if you're seeing this I accidentally submitted my question before I was done but am finishing it now.

Edit, I have finished my post sorry again for that!

Last edited by anthanor2 (2021-12-26 00:21:53)

Offline

#3 2021-12-26 00:55:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,296

Re: Installing Arch on removable medium

Mount your sticks root partition on /mnt and the ESP on /mnt/boot chroot in and run the installation command/the grub-mkconfig invocation from the "perspective" of your stick.

Offline

#4 2021-12-26 01:29:47

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: Installing Arch on removable medium

Thanks for helping again V1del! Just to clarify, I should do this from inside my main arch partition, correct? I also just wanted to confirm that I should first mount /dev/sdb3 and THEN mount sdb1 within my sdb3 mnt.  Thanks!

Last edited by anthanor2 (2021-12-26 01:35:33)

Offline

#5 2021-12-26 02:22:51

anthanor2
Member
Registered: 2021-09-24
Posts: 18

Re: Installing Arch on removable medium

I tried following what you told me and mounted /dev/sdb3 at /mnt and then /dev/sdb1  at /mnt/boot. One thing I want to make sure is that before mounting /dev/sdb1, I noticed that /mnt/boot had the following files: grub, initramfs-linux-fallback.img, initramfs-linux.img, vmlinuz-linux. Don't I need these to boot arch? When mounting sdb1, these files are deleted. Back to my issue I ran the same command with the new ESP mount and got this:

[root@archlinux /]# grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck
        Installing for x86_64-efi platform.
        grub-install: error: cannot find a device for /boot (is /dev mounted?).

What am I doing wrong? I ran lsblk to see where my flash drive was mounted from the perspective of chroot and got

[root@archlinux /]# lsblk
        lsblk: failed to access sysfs directory: /sys/dev/block: No such file or directory

I fixed this by running mount -t sysfs sysfs /sys but I am unsure how to proceed. Thanks!

Offline

#6 2021-12-26 04:03:06

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,296

Re: Installing Arch on removable medium

They aren't deleted, you hide them by mounting your ESP over the directory.

If you have those already then mount the ESP somewhere else e.g. /mnt/efi, then you need to arch-chroot  from arch-install-scripts into your /mnt (this is a helper script that does all the necessary chroot mounts, if you want to know how to do this manually see https://wiki.archlinux.org/title/Chroot ) and do a

grub-install --target=x86_64-efi --efi-directory=/efi --removable --recheck

Offline

Board footer

Powered by FluxBB