Ok, I have the minimal version of Debian Eeepc distro installed on my Asus Eeepc; The problem is, the HDD is only 4GB and it will not be able to install everything to run a desktop environment.

Is there a way I can keep that in the same HDD but the next apt-get install I do (and so on) use the SD card? Even if I have to startx by hand (as in, I don't mind that login shell);

All I really need is a web-browser capable of running todays-age websites and a text editor for coding (vim is OK, though i have to find the help-key combo), if moving apt-get to SD card isn't an option.

  • 2
    check this answer as a hint: unix.stackexchange.com/a/96552/23721 – Serge Sep 7 '16 at 23:19
  • @Serge Thanks - If nothing else that certainly solves the problem, though I'd like to keep the minimal installation and boot-stuff on the current HDD and just the next stuff be installed on the SD – MoshMage Sep 8 '16 at 0:37
  • I am not a fan of debian and flavors, so have no much experience. My preference is RHEL and Fedora. I usually use KVM with a raw disk image that matches the SD in size. Then I install all I need, make any settings, e.t.c, test it and then copy the image over to SD – Serge Sep 8 '16 at 0:45
  • I'd do that, except the SD card reader is ... on the machine that's having the problem :D points for effort though – MoshMage Sep 8 '16 at 1:05

apt installs files in your / directory, so you can't let it install package on your SD card unless you want to move your whole / to the SD card. But instead you can mount your SD card in /usr where most files of a package would be installed there (I checked on my system, it's size is about half of my /).

To do this, make sure your SD card have linux-compatible filesystem, for example, ext4. Then mount your SD card, clear it and copy your /usr in to that:

(I'll pretend your SD card has an ext4 partition /dev/sdb1, and it's mounted at /sdb, change the commands as your need)

cp -r /usr/* /sdb

And then remount it at /usr:

umount /sdb
mount /dev/sdb1 /usr

And then add this line to your /etc/fstab:

/dev/sdb1              /usr          ext4      defaults              1      1

Reboot and see if there's any problem, use mount to check /dev/sdb1 is mounted at /usr.

If there's no problem, you can remove the old content of user by using bind mount:

mkdir /mnt/work
# This command will mount your / at /mnt/work, but will not mount /dev/sdb at /mnt/work/usr
mount --bind / /mnt/work

# Do NOT type this as rm -rf /mnt/work/*, or it'll be the same as rm -rf /*
rm -rf /mnt/work/usr/*

# And then finish
umount /mnt/work
rmdir /mnt/work

It should work, don't delete your old /usr too quick, though. Test it for a while.

| improve this answer | |
  • Do you happen to know how I'd achieve that? right now, it's mounted auto in /sdb – MoshMage Sep 8 '16 at 12:16
  • @MoshMage I updated my answer, try it – Rio6 Sep 9 '16 at 2:27
  • Thanks @Rio -- I ended up setting a LVM and added the sdcard to the LVM - i have now a wipping 14GB to work with xD [ill set this answer as correct though, as it does what I ask] – MoshMage Sep 9 '16 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.