I'm interested in going through the Linux From Scratch (LFS) book for an under-the-hood Linux learning experience. To do this, one needs an existing host Linux system from which to work. I want to use a current Slackware (14.2) distro because it has the pre-requisite packages LFS needs. I couldn't see see any reason why using a read-only (no persistence) "live cd" version of slackware would be a problem as a host OS, so I created one and booted up with it, no problem.

Most of what I've read in the LFS book seems to imply that creating LFS is done using an actual physical hard drive, (re-)partitioning it first, then creating file sytems and swap, etc. Well I don't want to mess around with my laptop's main hard drive.

So here's my question:

Can I stick a second USB drive into one of my remaining USB ports, then use that USB as the main target drive for all of my LFS work instead of an actual hard drive?

I'm not asking how to do this. I know how to partition and put an fs on a USB drive. I'm asking if anyone knows if it can be done, or knows of it having been done for LFS. I STFW for hours, but only came up with outdated info that addressed creating ISOs on USBs after LFS was done.

closed as off-topic by Rui F Ribeiro, Archemar, cas, Stephen Rauch, Anthon Aug 6 '17 at 19:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Rui F Ribeiro, Archemar, cas, Stephen Rauch, Anthon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    If you have to ask that, I advise to do that project at a later date. – Rui F Ribeiro Aug 6 '17 at 8:24

Does anyone know if it can be done?

Yes, it can be done. A pen drive is no different than any hard drive from a logical viewpoint. It may have a partition table and each of its partitions can be formatted with whatever FS ou like. Moreover, you can always install Linux on any separate block device. The only requirement for you is that your system must know how to boot that particular block device.

So, the question is not really whether what you want to achieve can be done (it can), it is rather whether you can do it without harming your existing system. I can't answer that but, as Rui F Ribeiro told you in comment, the fact that you ask may imply that it would be wise to wait a bit that you gain some experience with Linux.

What complications should I expect if it can be done?

It's difficult to answer. This question is quite broad, it depends heavily on your skills and, personally, I don't know the LSF book and I haven't touch a Slackware distro for almost 20 years.

I see two possible issues:

  • Choose the disk to partition with caution. You will have at least three disks on your machine: the main hard drive that you don't want to touch (make a backup first!), the live USB drive you are operating from, the new drive your are installing Linux onto. They will probably be called sda, sdb and sdc. You must know for sure which is which. This is the biggest risk. Just be cautious, no Linux distro will erase things without asking you first.
  • You say you don't use persistence. I assume then that all your changes to the read-only live distro will be kept in RAM. Compiling big things like the Linux kernel or the libc can require a lot of disk space, which will turn into RAM space in your situation (if I'm not mistaken, again I don't know LFS). Do you have enough RAM? Note that if you don't, this will not be a big risk, things will just fail at some point.

Good luck. Be bold but don't be reckless.

  • Thanks! Your first paragraph confirms what I was assuming, but I wanted to ask to get confirmation before wasting a bunch of time. I know how to determine which of the /dev/sd* are the USB drives, so the only hangup may be the memory consumption you mentioned. I suppose I could run in text mode w/o a GUI. – Apollonius Aug 6 '17 at 12:01
  • 2
    Use a disposable machine/VM. an old machine laying around is the ideal. – Rui F Ribeiro Aug 6 '17 at 12:09

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