LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices



Reply
 
Search this Thread
Old 08-12-2004, 08:33 PM   #1
silverback011
LQ Newbie
 
Registered: Apr 2004
Location: Florida USA
Posts: 23

Rep: Reputation: 15
partitions/making room for LFS


I know I am missing something basic here. I have a single hard drive.

On the first part of the hard drive I have M$ Win2k Pro. On the second half I have linux installed (Mandrake 10.0). I shrank the windows partition by 5GB to make room for the LFS project.

Then I run 'cfdisk' to partition it off. This renumbers my linux partitions. So I change my /etc/fstab to reflect the changes, but not adding the new 5GB portion, since it is not formatted yet. Then I changed the boot loader GRUB to look at the correct partition. When I reboot to make sure things are still good. I get an error message saying it can't find init on /dev/hda5. However with the modifications the unformatted partition I just made for LFS is now /dev/hda5. The changes I made to grub and my /etc/fstab say look at /dev/hda6.

So I remove the partition without changing anything else and linux boots up fine. That includes the numbers in GRUB and my /etc/fstab. I am confused as to why this is. I know I am missing something really basic here.

Output of fisk -l:

omitting empty partition (5)

Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 30786 15516112+ 7 HPFS/NTFS
/dev/hda2 30787 77545 23566536 5 Extended
/dev/hda5 40945 53133 6143224+ 83 Linux
/dev/hda6 53134 54148 511528+ 82 Linux swap
/dev/hda7 54149 77545 11792056+ 83 Linux

Output of cat < /etc/fstab:

none /dev/pts devpts mode=0620 0 0
/dev/hda5 / ext2 defaults 1 1
/dev/hda6/ swap swap defaults 0 0
/dev/hda7 /home ext2 defaults 1 2
/dev/hdc /mnt/cdrom auto umask=0,user,iocharset=iso8859-1,codepage=850,noauto,ro,exec 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0,iocharset=iso8859-1,sync,codepage=850 0 0
/dev/hda1 /mnt/windows ntfs umask=0,nls=iso8859-1,ro 0 0
none /proc proc defaults 0 0
 
Old 08-12-2004, 11:10 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi silverback011,
You need to do 2 changes in grub when you change the partition:
Code:
kernel (hd0,4)/boot/vmlinuz ro root=/dev/hda5
Did you do both?
 
Old 08-12-2004, 11:39 PM   #3
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
It's me again!
I remembered one more trick. If you use "initrd", it will always mount "/dev/hda5" even if you make all the changes in grub. In this case you need to create another initrd containing the proper device and script to boot when the partition number changes.
I would suggest you the following steps before the boot trial:
- uncompress the initrd to a temp file, mount it and cd to it:
Code:
gunzip -c /boot/initrd-XXX >/tmp/initrd.tmp
mkdir /mnt/tmpinitrd
mount -o loop /tmp/initrd.tmp /mnt/tmpinitrd
cd /mnt/tmpinitrd
, where "/boot/initrd-XXX" is your real initrd.
- Edit the file "linuxrc", changing all partition references from "hda5" to "hda6".
- copy the "hda6" device to this image or create it:
Code:
cp -a /dev/hda6 /mnt/tmpinitrd/dev
- unmount it:
Code:
cd
umount /mnt/tmpinird
- compress it to create a new initrd
Code:
gzip -c /tmp/initrd.tmp >/boot/inirtd-hda6.img
Now, edit grub, creating a new kernel entry, pointing to hda6 and giving this inirtd.

Last edited by osvaldomarques; 08-12-2004 at 11:42 PM.
 
Old 08-13-2004, 08:24 PM   #4
silverback011
LQ Newbie
 
Registered: Apr 2004
Location: Florida USA
Posts: 23

Original Poster
Rep: Reputation: 15
I thank you for the help. Everything you said makes sense to me except when I look at the 'linuxrc' file.

Output of cat < linuxrc:

#!/bin/nash

echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo Mounting /proc filesystem
mount -t proc /proc /proc
echo Creating device files
mkdevices /dev
echo Mounting sysfs
mount -t sysfs none /sys
echo Creating root device
mkrootdev /dev/root
umount /sys
echo 0x0100 > /proc/sys/kernel/real-root-dev
echo Mounting root filesystem
mount -o defaults --ro -t ext3 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd
echo Remounting devfs at correct place if necessary
handledevfs
umount /initrd/proc

I don't see anywhere where it refers to /dev/hda#. I guess Mandrake cutomizes things quite a lot.
 
Old 08-13-2004, 10:06 PM   #5
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
HI silverback011,
I'm doing some research since I received your post. Basically, your script does a lot of work to determine which is your root file system.
Quote:
mkdevices path
Creates device files for all of the block devices
listed in /proc/partitions in the directory spec-
fied by path.

mkrootdev path
Makes path a block inode for the device which
should be mounted as root. To determine this device
nash uses the device suggested by the root= kernel
command line argument (if root=LABEL is used
devices are probed to find one with that label).
If no root= argument is available, /proc/sys/ker-
nel/real-root-dev provides the device number.
So, at first glance, this script does not need to be modified. If you want to force "/dev/hda6", you need to replace "/dev/root" on the mount command with it. I found some links which may help you on your chalenge: initrd is a initrd manual and The Answer Gang has a discussion on a problem on mounting scsi raids.
Good luck!
 
Old 08-14-2004, 09:20 AM   #6
silverback011
LQ Newbie
 
Registered: Apr 2004
Location: Florida USA
Posts: 23

Original Poster
Rep: Reputation: 15
Once again thanks for you help. I will do some reading. I'll let you know how it comes out.
 
Old 08-15-2004, 12:22 PM   #7
silverback011
LQ Newbie
 
Registered: Apr 2004
Location: Florida USA
Posts: 23

Original Poster
Rep: Reputation: 15
I am able to boot up now with the added partition.

I installed the Lilo boot loader. Then I added:

image=/boot/vmlinuz
label="Primary"
root=/dev/hda6
initrd=/boot/initrd.img
append="root=/dev/hda6" #tells initrd to use this instead of old
vga=788
read-only

In addition to this I editied my /etc/fstab to change the partition numbers to the correct ones.

I have already learned a bit doing this project. Discovered I have been running for awhile without any swap. Hasn't been mounting on boot up.

Thanks a lot osvaldomarques for pointing me in the correct direction.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a Distro with LFS rmckayfleming Linux From Scratch 7 10-30-2005 03:59 AM
Formatting Partitions to have room for a new one SoccerPenguin15 Linux - General 3 02-06-2005 09:31 AM
making a LFS-installation CD/DVD ParticleHunter Linux From Scratch 2 09-17-2004 07:02 AM
Error compiling Perl (making LFS system 3.3)... MatMan5959 Linux - Software 0 06-02-2002 05:36 PM
Creating partitions during LFS. trickykid Linux From Scratch 4 02-08-2002 02:11 PM


All times are GMT -5. The time now is 12:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration