LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   How To Install LiveCD to Hard Drive (https://www.linuxquestions.org/questions/linux-from-scratch-13/how-to-install-livecd-to-hard-drive-369365/)

jimbo-62 10-03-2005 09:51 AM

How To Install LiveCD to Hard Drive
 
Here is a procedure that I used to install the LFS 6.1 Live CD to my hard drive. Use it at your own risk. The installed size is about 1.6 GB. You can delete the /sources directory and a file in / named .root.sqfs (or something similar) and reduce the size to about 1.3 GB.

1. Prepare a partition on your hard drive for LFS Live CD installation. Or maybe you want to use the whole hard drive. Format and install the file system of your choice. I used ext3.

2. Also prepare a swap partition. I used a swap equal in size to my RAM.

3. Boot the LFS Live CD. Configure your network so that you can connect to the Internet.

4. Mount the partition you want for your LFS Live CD hard drive installation
on /mnt. I used the following command.

# mount /dev/hda4 /mnt

5. Copy the system to your mounted partition. I used the following procedure.

# tar -C / -l -cpvf - . | tar -C /mnt -xpf -

6. Download a kernel source tar ball from kernel.org and put it in /mnt/usr/src. I used kernel 2.6.13.2. Make sure the kernel is in /usr/src of your new system, not in /usr/src of the Live CD.

7. chroot into your new system.

# chroot /mnt

8. Install the LFS bootscripts. I used the following procedure.

# cp /sources/lfs-bootscripts-3.2.1.tar.bz2 /usr/src/
# cd /usr/src
# tar -xvjf lfs-bootscripts-3.2.1.tar.bz2
# cd lfs-bootscripts-3.2.1
# make
# make install

9. Edit /etc/fstab. You need to delete references to union file system and add normal entries for a hard drive installation. The first two lines in my /etc/fstab are:

/dev/hda4 / ext3 defaults 1 1
/dev/hda5 swap swap defaults 0 0

10. Install the new kernel. I used the following procedure.

# cd /usr/src
# tar -xvjf linux-2.6.13.2.tar.bz2
# cd linux-2.6.13.2
# make mrproper
# make menuconfig (Set all configuration options that you need or want.)
# make
# make modules
# make modules_install
# cp arch/i386/boot/bzImage /boot/lfskernel-2.6.13.2
# cp System.map /boot/System.map-2.6.13.2
# cp .config /boot/config-2.6.13.2

11. Edit the bootloader of your choice for your new LFS Live CD system. I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows.

image=/mnt/hda4/boot/lfskernel-2.6.13.2
vga=791
label=LFS-LiveCD
root=/dev/hda4
read-only

12. Boot into your new hard drive installation of the LFS 6.1 Live CD and enjoy.

Good luck, jimbo

CCMCornell 10-03-2005 04:35 PM

Neat tip. You should submit it as a hint to the LFS web site. I already finished my first LFS 6.1, but I'll definitely consider it the next time I do an LFS build. It was quite annoying having to find the CD every time I returned to the LFS build or listening to my loud CD drive spin up whenever I had to run something off the disk in another console while I was chroot'd in my LFS environment.

One question: why does the HD install require over 1 GB if the disk itself is only a couple hundred MB?

jimbo-62 10-03-2005 06:30 PM

Thanks for the reply. I am not sure the LFS web site would appreciate a procedure that "short circuits" all of the painful compile steps.

The installed size does seem very large. I know that Live CDs use compressed file systems, but I didn't know they got that much compression.

jimbo

jhuntwork 10-04-2005 02:30 PM

Why not? You should browse through the list of current hints to see how many there are that 'goes against the grain' of LFS, so to speak. I'm sure there are several people that would appreciate the hint. Though, as I'm sure you realize, that particular hint isn't likely to ever be officially supported by LFS or the LFS Livecd project.

Btw, the compression we get on the LiveCD is about 50%. :) Thanks to squashfs.

Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.

--
JH

sundialsvcs 10-05-2005 02:41 PM

I think that it would be a fine idea if the LFS (and BLFS) projects included that kind of information, if only as a last-resort step if you happen to really hose something up. :rolleyes:

Also, the rsync command is very useful to look at. When used in strictly local mode (not involving the network... source and destination systems are the same) it is quite good at replicating things like symlinks and so-on which can confuse simpler commands. It's also clever at deciding what actually needs to be copied and what does not.

I agree that these instructions should be fleshed-out and published as an official document. It certainly has its place.

shevegen 10-06-2005 02:09 PM

Ok all worked except for the last one:


"11. Edit the bootloader of your choice for your new LFS Live CD system. I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows."

I dont have an existing bootloader (or working ones), should i just create the file /etc/lilo.conf and put up the settings for the kernel i compiled in there?

sundialsvcs 10-06-2005 06:34 PM

lilo... ick! That's one place where I've always completely-ignored the LFS instructions. grub is a much better boot-loader, imho. Easy to set up, a great deal smarter overall, and if you encounter a glitch at boot-time you can quite easily fix it without grabbing for that rescue-CD. The configuration files are ordinary text-files and there's none of this balderdash of having to execute the 'lilo' command...

jhuntwork 10-06-2005 07:54 PM

Quote:

Originally posted by sundialsvcs
lilo... ick! That's one place where I've always completely-ignored the LFS instructions.
When was the last time you actually looked at LFS then? Grub replaced Lilo in the LFS instructions a long time ago.

--
JH

shevegen 10-07-2005 05:21 AM

I personally dont really care if its Lilo, or Grub, i want an installed LFS system to HDD
with a working bootloader.

I think this last information lacks, for either lilo or Grub, so that you can boot into
your hdd installed LFS.

"I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows."

I try to google for the answer meanwhile :)

jimbo-62 10-07-2005 09:03 AM

The entry I gave for my lilo.conf file is what you would use for any other lilo. But you would need normal lilo.conf entries preceeding the LFS section. Just look up an example lilo.conf file.

Good luck, jimbo

Spoonman 11-12-2005 02:58 PM

Quote:

Originally posted by shevegen
I think this last information lacks, for either lilo or Grub, so that you can boot into
your hdd installed LFS.

The livecd has the sources for an LFS 6.1 build, you can just chroot into /mnt and build a copy of grub and install it.

This was a great hint, Jimbo, thanks. This is probably going to save my butt, as I've been trying to get an LFS 6.1 build to work for a little while now. I kept running into problem after problem, and it always came down to the fact that glibc does not compile properly if you compile it on a host that's running a 2.6.x kernel compiled with gcc 2.95 (which most distros still do). It took me forever to finally find a distro that worked, only to find it's glibc was too old and I had issues after a few of the temp tools were built. An LFS 6.1 makes a perfect host to build an LFS 6.1 on. It meets all the requirements AND for those few places where little things can creep into your build from the host...who cares? It's the same version! :)

GoldCPUfish 11-12-2005 04:18 PM

The problem is that You need to be root in order to run X windows. Also You don't need to compile The kernel, There is a file called "linux" on the cd and thats the kernal.

Spoonman 11-16-2005 12:28 PM

Quote:

Originally posted by jhuntwork
Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.

Actually, it doesn't because he's using the "-l" (which is replaced in the next version with --one-file-system), this limits it to the root fs. Mounted filesystems, including /proc and /sys, aren't done. The only drawback is I've found different versions of tar implement this more or less right, depending on which one you get. The latest on the CD seems to handle it right, though.

-S

jimbo-62 11-20-2005 10:34 PM

Quote:

Originally posted by GoldCPUfish
The problem is that You need to be root in order to run X windows. Also You don't need to compile The kernel, There is a file called "linux" on the cd and thats the kernal.
The reason that I compiled a kernel was to eliminate any Live CD specific stuff that might be in there. Maybe not necessary, but I wanted to be sure I had a "clean" hard drive installation.

Good luck, jimbo

satimis 12-02-2005 05:18 PM

Hi jimbo-62,

Tks for your work.

What about if I expect keeping /var and /home in separate partitions, say /dev/hda6 and /dev/hda7. How to make it after mounting them? Just moving them from /dev/hda4? TIA

BR
satimis


All times are GMT -5. The time now is 06:07 PM.