Arch Linux: Extending / using an additional HDD

1

My root partition for Arch Linux is running out of space (2.4GB), which isn't enough space for a project I'm going to start, the only option I have is my Micro SD but i cant switch my installation to it since it has less space then my current SSD. Is there any way i can extend my root partition using my external Mirco SD?

Edit:

Model: ATA KINGSTON SNS4151 (scsi)
Disk /dev/sda: 16.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  211MB   210MB   fat32                 boot, esp
 2      211MB   12.1GB  11.9GB  ext4
 3      12.1GB  16.0GB  3949MB  linux-swap(v1)        swap


Model: Generic MassStorageClass (scsi)
Disk /dev/sdb: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  15.9GB  15.9GB  primary  ext4


bash: dpkg: command not found

Arch uses Pacman rather than dpkg/apt, the correct command would have been, sudo parted -l &&pacman -Qqe > pkglist.txt | grep linux-image which exports a list to a txt Here:

accerciser
android-emulator-canary
android-tools
android-udev
archey3
automake
baobab
base
beignet
bison
cheese
chrome-gnome-shell
connman
dconf-editor
devhelp
dhclient
dpkg
eog
epiphany
evince
evolution
fakeroot
file-roller
firefox-developer-edition
five-or-more
flex
four-in-a-row
gdm
gedit
ghex
gnome-backgrounds
gnome-books
gnome-boxes
gnome-builder
gnome-calculator
gnome-calendar
gnome-characters
gnome-chess
gnome-clocks
gnome-code-assistance
gnome-color-manager
gnome-contacts
gnome-control-center
gnome-devel-docs
gnome-dictionary
gnome-disk-utility
gnome-documents
gnome-font-viewer
gnome-getting-started-docs
gnome-keyring
gnome-klotski
gnome-logs
gnome-mahjongg
gnome-maps
gnome-menus
gnome-mines
gnome-multi-writer
gnome-music
gnome-nettool
gnome-nibbles
gnome-photos
gnome-recipes
gnome-remote-desktop
gnome-robots
gnome-screenshot
gnome-session
gnome-settings-daemon
gnome-shell
gnome-shell-extensions
gnome-software
gnome-sound-recorder
gnome-sudoku
gnome-system-monitor
gnome-taquin
gnome-terminal
gnome-tetravex
gnome-themes-extra
gnome-todo
gnome-tweaks
gnome-usage
gnome-user-docs
gnome-user-share
gnome-video-effects
gnome-weather
grilo-plugins
gvfs
gvfs-afc
gvfs-goa
gvfs-google
gvfs-gphoto2
gvfs-mtp
gvfs-nfs
gvfs-smb
hdparm
hitori
iagno
intel-hybrid-codec-driver
iwd
jre8-openjdk
lib32-mesa
lib32-vulkan-icd-loader
lib32-vulkan-intel
lightsoff
linux
linux-firmware
make
mergerfs-git
minecraft-launcher-beta
mousetweaks
mutter
nano
nautilus
nautilus-sendto
networkmanager
openvpn
orca
pakku
pavucontrol
pkgconf
plasma-pa
polari
ponymix
porntime-bin
pulseaudio-jack
python-adb-git
quadrapassel
rowhammer-native-git
rygel
samus-scripts
sex
simple-scan
sudo
sushi
swell-foop
sysprof
tali
texinfo
totem
tracker
tracker-miners
vino
vulkan-intel
wpa_supplicant
xdg-user-dirs-gtk
xf86-video-vesa
xkeyboard-config-chromebook
xorg-bdftopcf
xorg-docs
xorg-font-util
xorg-fonts-100dpi
xorg-fonts-75dpi
xorg-fonts-encodings
xorg-iceauth
xorg-luit
xorg-mkfontscale
xorg-server
xorg-server-common
xorg-server-devel
xorg-server-xephyr
xorg-server-xnest
xorg-server-xvfb
xorg-server-xwayland
xorg-sessreg
xorg-setxkbmap
xorg-smproxy
xorg-x11perf
xorg-xauth
xorg-xbacklight
xorg-xcmsdb
xorg-xcursorgen
xorg-xdpyinfo
xorg-xdriinfo
xorg-xev
xorg-xgamma
xorg-xhost
xorg-xinput
xorg-xkbcomp
xorg-xkbevd
xorg-xkbutils
xorg-xkill
xorg-xlsatoms
xorg-xlsclients
xorg-xmodmap
xorg-xpr
xorg-xprop
xorg-xrandr
xorg-xrdb
xorg-xrefresh
xorg-xset
xorg-xsetroot
xorg-xvinfo
xorg-xwd
xorg-xwininfo
xorg-xwud
yelp

I have to install programs using Pacman (arch package manager) that would take up the remaining space on said SSD, Pacman -S - -gpdir would install to a custom directory, but this command only works if there is a home installation within this directory. Thus meaning I would have to make my Micro SD the /home folder and mount it as so. I may do this for /home and /usr and /var which would help with the project, I'm going to look into setting this up without installing a fresh copy of Arch Linux.

Thx for the help! :)

SSF scott

Posted 2020-02-10T18:22:13.193

Reputation: 9

1It is EXTREMELY not recommended. The reliability of a USB interfaced drive is far less, and if you join the USB HDD together with your internal SSD then the USB HDD fails, all the contents on both are lost. Let's look for another solution. Please run sudo parted -l &&pacman -Qqe > pkglist.txt | grep linux-image then come back here, click edit and paste the results into your question so we can see what you have taking space. Please do not use Add Comment as it loses the formatting of the response. – K7AAY – 2020-02-10T19:30:38.097

Answers

0

With help form Jarmund, and K7AAY I've come a answer to my problems.

~

To fix the issue I will need to create 3 partitions (or have 3 drives) for the /usr /var and /home folders, I only have a single drive so I'll create 3 partitions on my Drive (Micro SD for me).

The partitions will need to be properly sized to fit the folders, if your doing this on a current instillation like me, you can use du <directory> -h to see how much space these folders take up.

For me /home takes up 550MB, /usr takes up 6.6GB, and /var takes up 590MB.

So I'll be creating 3 partitions, 2 of 2GB (for /home and /var) and another of the remaining space on my drive (for /usr) The partition sizes don't have to be the same, I'm simply attempting to reserve as much space as possible for the installation I'll be carrying out after I've copied the folders to there matching mount points

Next you'll need to copy the matching folders to their locations on your drive. (or mount points)

After you've created the partitions and copied the files, we have to edit the /etc/fstab file so the partitions will auto mount at boot. First we need to get the UUID of the partitions, to do so we would issue the command sudo blkid /dev/sd** (e.g sdb1) this will output the UUID for the partition specified.

E.g:

$ sudo blkid /dev/sdc1
/dev/sdc1: UUID="b78a94a5-b910-4bce-9f79-c281b312a242" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3774f7ec-01"

(The UUID for above would be for /home for me) Then we would edit our /etc/fstab file to contain the following:

UUID={UUID for /home} /home   ext4    defaults        0       0
UUID={UUID for /var}           /var    ext4    defaults        0       0
UUID={UUID for /usr}           /usr    ext4    defaults        0       0

NOTE: IF YOU DON'T WISH TO BRICK UR DEVICE COPY THE UUID'S WITHOUT THE QUOTES THAT ARE PROVIDED BY BLKID

If you don't wish to reboot to see the changes you can --bind the partitions to their matching directory's.

E.g

sudo mount --bind /home /dev/sd**

~

I'll edit this answer based on my results after the files finish copying (6.6GB takes long to copy with speeds of 1.4MB/s)

sudo mount --bind /home /dev/sd**

~

I'll edit this answer based on my results after the files finish copying (6.6GB takes long to copy with speeds of 1.4MB/s)

It works, to say the least, my pc is quite slow, with the /home folder mounted, I've unmounted it and may leave it unmounted as it slowed my device so bad gdm crashed during boot, (it did start, froze then crashed) Write speeds to /var and /usr are understandably very slow now, gdm works with /home unmounted and removed from fstab, otherwise everything is fine, although the load speeds of any app are quite slow, since apps are held in /usr and my SD only runs at about 1.4MB/s

This is unbareably slow, I'm going to simply install - - bind my /usr partition and then install the program, then I'll reboot and - - bind the exact location of said program.

SSF scott

Posted 2020-02-10T18:22:13.193

Reputation: 9

My networkmanager is held within /usr, it seems it cant start from the sd – SSF scott – 2020-02-10T22:49:52.987

1

In your case, it is advisable to not rely on the root partition for everything, but instead have several mounts. This was more common before, but now that most harddrives are big enough for 90% of use cases, and often used by only one person with a fairly simplistic set of filesystem requirements, it's more common to lump it all into one partition.

Historically, a common way of dividing up the filesystem would involve one or more of the following partitions/filesystems:

/         <-- obviously.
/usr      <-- Programs and other things that are read, but not written that often
/home     <-- Because users tend to take up a lot of space.
/var      <-- Many small files read and written very often.

And the benefit of this is that those separate filesystems need not be limited to the same harddrive. /home running out of space? Move the entire thing to a separate bigger harddrive.

Now, over to your case: I doubt that your upcoming project needs space on / itself, but rather in a subfolder. In that case, it would be advisable to leave / alone, and mount your USB harddrive to an appropriate folder. For example, mounting that drive to /home/yourusername/projectname would allow for your project to reside on that drive, without the rest of the system being affected. This, of course, depend entirely on the nature of your project, but I am sure you can apply this logic to allow for the root filesystem to remain as it is. Running / off of an USB is really not recommended, as @K7AAY pointed out in his comment.

How to mount a filesystem to a directory depends on the drive, its filesystem, where you want it, as well as the nature of the mount itself (automount on boot, read only, etc), but I am sure looking around for guides how filesystems and drives are mounted should net you a decent guide. This is fairly uniform across linux distros. The basics are like this:

mkdir /some/folder
mount /dev/sdb1 /some/folder

....where sdb1 is the filesystem you want to mount. You might also want to look up the file /etc/fstab and consider if you want to do this at boot or not.

Jarmund

Posted 2020-02-10T18:22:13.193

Reputation: 5 155