native G drive install

Talk about anything related to Gentoox or Gentoo.
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

native G drive install

Post by dito199 »

Hi,

Just checking if installation script support native G drive install? Or I am pretty much left to perform the manual partition/format/copy/edit :shock: routine in this post?

viewtopic.php?t=779&highlight=native+install

Cheers
keg188
Linux User
Posts: 19
Joined: Tue Aug 10, 2004 1:35 pm
Location: manchester, UK

Post by keg188 »

Does the method in that post work? or is there a way to edit the install script to install native on G:\?






Just as a side question is there a tutorial for upgrading to 128mb?
keg188
Linux User
Posts: 19
Joined: Tue Aug 10, 2004 1:35 pm
Location: manchester, UK

Post by keg188 »

After doing a little bit of checking i sort of have an issue with the commands nobspangle gives to to setup the partitions (I'm probably wronge and will probably get a good flaming for it but..)
then you need the code for fdiskCode:

fdisk -u /dev/hda
n
p
1
268435456
+256M
n
p
2
268935457
<just hit enter her for default>
t
1
82
a
2
w

If the start of your 1st partition is sector is 268435456, then you have a 256mb partition then shouldent your next partition start at 268959744 as this is the start point plus 256mb.

Can someone clear this up as i am interested in filling the rest of my drive with Gentoox Native style.
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

Yes, my mistake, I don't know where that other figure has come from, it's not close or the same as anything else.
You also might want to start at 268435457 to make sure you don't overlap the last block on your F drive.
If you keep an open mind, will your brain fall out?
keg188
Linux User
Posts: 19
Joined: Tue Aug 10, 2004 1:35 pm
Location: manchester, UK

Post by keg188 »

OK, so i got Home V3.1 on my box (on F: not Native) now and i want to copy it over to G:

After i've FDISKed my drive and copyed it over, what do i need to edit to get Gentoox to run from this new partition?

(I hate feeling like a n00b!) :oops:

Also:
I've noticed that my fan speed is a bit crazy when running 3.1 in that it keeps randomly speeding up, even when i'm not doing anything.
Is this normal? As i don't remember 3.0 doing this.


And:
Is it worth upgrading to 128 ram? and where is the best place to get them in the UK?


Quick statment:
Gentoox is F#@kin Great!! :D
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

Post by dito199 »

Here's my calculation. Please correct me if I am wrong.

HEX -> DEC
============

0x0FFFFFFF -> 268435455 (end of LBA28 boundary)
0x10000000 -> 268435456 (hda1_start)
-------------------------------------------------------
256MB = 256 x 1024 = 262144 (0x40000)
hda1_start + 256MB = 268697600 (0x10040000)
-------------------------------------------------------
0x10040000 -> 268697600 (hda2_start)


keg188: Taking your boundary 268959744 and,
268959744 - 268435456 = 524288 = 512 x 1024 (512MB)
That reflect your swap space as 512MB?

nobspangle: Taking your boundary 268935457 and,
268935457 - 268435456 = 500001
I think this is just a play-safe number and leave some blank space between hda1 and hda2 partition, right?

I have just converted linux to reiserfs and this miscalculation is no joke down the road. I will post the complete step-by-step here later once all numbers are confirmed.

keg188 wrote:After doing a little bit of checking i sort of have an issue with the commands nobspangle gives to to setup the partitions (I'm probably wronge and will probably get a good flaming for it but..)
then you need the code for fdiskCode:

fdisk -u /dev/hda
n
p
1
268435456
+256M
n
p
2
268935457
<just hit enter her for default>
t
1
82
a
2
w

If the start of your 1st partition is sector is 268435456, then you have a 256mb partition then shouldent your next partition start at 268959744 as this is the start point plus 256mb.

Can someone clear this up as i am interested in filling the rest of my drive with Gentoox Native style.
keg188
Linux User
Posts: 19
Joined: Tue Aug 10, 2004 1:35 pm
Location: manchester, UK

Post by keg188 »

You've not taken into account the fact that 1 sector is 512 bytes.

256MB = 256 x 1024 x 2 = 524288 sectors


512 bytes = 1 sector
1 KB = 2 sectors
1 MB = 2048 sectors
256 MB = 524288

i rechecked my maths for about an hour and a half wondering how i came up with that figure.

Nobspangle can you clear this up for us?
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

I've had a quick look at this,
When you create a 256MB partition in fdisk the partition is 500000 sectors long.
This isn't actually 256MB it's 256000000 bytes

If you actually want a 256MB partition then you need to put in the end sector yourself, which would be 268959744

So I now know where my original figure came from. The 500001 is not a playsafe you need to start the next partition 1 block after the end of the previous partition.

Best thing to do is create the first partition, then print the partition table to see what the last sector is and use that+1. Or quit fdisk and do

Code: Select all

fdisk -u -l /dev/hda | grep /dev/hda1 | awk -F' ' '{ print $3; }'
Which is what Shallax's install script does.

I'll edit my orginal post back.

glad to get this sorted though.
If you keep an open mind, will your brain fall out?
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

Post by dito199 »

Ok, I've consolidated information from here and there into following scripts.

viewtopic.php?t=281
viewtopic.php?t=503
viewtopic.php?t=779

Pre-requisite:
1. XBox with > 137Gb Hard-drive
2. Hard-drive partition to F+G drive
3. Current rootfs is in E drive
4. Your G partition (hda56) is empty or can be wipe out completely. Beware following script WILL delete your G partition!


There are alltogether 6 files needed to make the G-drive native install work.
1. disk.swap (28 bytes)
2. disk.root (27 bytes)
3. make.partition.sh (1813 bytes)
4. update.initrd.sh (1303 bytes)
5. xfer.content.sh (797 bytes)
6. update.fstab.sh (876 bytes)


Step 1. Login as root. Transfer these files to /tmp folder.

Step 2. If you created these files in Windows and ftp to your xbox, changes are those files will still retain the DOS format and script will not run or run with error. One way to confirm is do "ls -l" and the filesize should be as above.

If the filesize is different, use the following command to covert the format:

Code: Select all

      #cd /tmp
      #col -b < disk.swap > disk.swap1; mv disk.swap1 disk.swap
      #col -b < disk.root > disk.root1; mv disk.root1 disk.root
      #col -b < make.partition.sh > make.partition.sh1; mv make.partition.sh1 make.partition.sh
      #col -b < update.initrd.sh > update.initrd.sh1; mv update.initrd.sh1 update.initrd.sh
      #col -b < xfer.content.sh > xfer.content.sh1; mv xfer.content.sh1 xfer.content.sh
      #col -b < update.fstab.sh > update.fstab.sh1; mv update.fstab.sh1 update.fstab.sh
Step 3. Make all the sh files executeble.

Code: Select all

       #chmod 755 make.partition.sh
       #chmod 755 update.initrd.sh
       #chmod 755 xfer.content.sh
       #chmod 755 update.fstab.sh


Step 4. Make the partition, point of no return :)

Code: Select all

       #./make.partition.sh
Step 5. Transfer the content from rootfs to new hda2

Code: Select all

       #./xfer.content.sh
Step 6. Update the initrd.gz

Code: Select all

       #./update.initrd.sh

Step 7. Lastly, edit the fstab to use the new hda2 as root and hda1 as swap

Code: Select all

       #./update.fstab.sh
If you are familiar with linux shell environment, you can always execute the embedded command manually in sequence if in doubt. Some scripts are not fool-prove (error checking and such). Of course we can always combine them all into one script but I'll leave it at current state more as illustration purpose for those who wish to understand what goes on at each stage.


----------------------------------------------------------------------------------

File#1: disk.swap (viewtopic.php?t=281)

Code: Select all

n
p
1
@START@
@SIZE@
t
82
w

File#2: disk.root (viewtopic.php?t=281)

Code: Select all

n
p
2
@START@
@SIZE@
a
2
w

File#3: make.partition.sh (viewtopic.php?t=281)

Code: Select all

#!/bin/bash 
### 
# Settings for fdisk when making swap, then root partitions 
### 
DISKSWAP=/tmp/disk.swap 
DISKROOT=/tmp/disk.root 
DEVICE="/dev/hda" 

### 
# Start block for the end of the standard 137gb hdd 
### 
START=268435456 
SWAPSIZE="+256M" 

### 
# Options for deleting all possible partitions from the drive 
### 
echo -e "d\n1\nd\n2\nd\n10\nd\n9\nd\n8\nd\n7\nd\n6\nd\n5\nd\n3\nd\n4\nw" > /tmp/make.disk 

### 
# Zero out the partition table 
### 
echo "(1/5) Zeroing partition table ..."
dd if=/dev/zero of=/dev/hda seek=$START bs=512 count=1 > /dev/null 2>&1 
fdisk $DEVICE < /tmp/make.disk > /dev/null 2>&1 

### 
# Get the information needed to make the swap partition 
### 
echo "(2/5) Creating swap partition as /dev/hda1 ..."
sed -e "s/@SIZE@/$SWAPSIZE/g" -e "s/@START@/$START/g" < $DISKSWAP > /tmp/make.disk 
fdisk -u $DEVICE < /tmp/make.disk > /dev/null 2>&1 
rm -f /tmp/make.disk 

### 
# Get the information needed to make the root partition 
### 
echo "(3/5) Creating root partition as /dev/hda2 ..."
START=`fdisk -u -l ${DEVICE} | grep ${DEVICE}1 | awk -F' ' '{ print $3; }'` 
START=`expr $START + 1` 
sed -e "s/@SIZE@//g" -e "s/@START@/$START/g" < $DISKROOT > /tmp/make.disk 
fdisk -u $DEVICE < /tmp/make.disk > /dev/null 2>&1 
rm -f /tmp/make.disk 

### 
# Initialize the swap partition 
### 
echo "(4/5) Initialize swap partition ..."
mkswap /dev/ide/host0/bus0/target0/lun0/part1 1> /dev/null 2> /dev/null 
if [ $? != "0" ]; then 
/bin/led rxrx 
clear 
echo "An error occurred, halting" 
echo "[Error making swap]" 
exit
fi 

### 
# Format the root partition 
### 
echo "(5/5) Format root partition ..."
yes | /sbin/mkreiserfs /dev/ide/host0/bus0/target0/lun0/part2 1> /dev/null 2> /dev/null 
if [ $? != "0" ]; then 
/bin/led rxrx 
clear 
echo "An error occurred, halting" 
echo "[Error making root filesystem]" 
exit
fi

echo "Done ..."

File#4: xfer.content.sh (viewtopic.php?t=281)

Code: Select all

#!/bin/bash

#####################
# Transfer partition content from rootfs to new hda2
#####################

echo "(1/3) Mounting partition..."

# mount the new hda2
mkdir /mnt/hda2
mount -t reiserfs /dev/hda2 /mnt/hda2

# mount the current rootfs as loopback
mkdir /mnt/rootfs
mount -o loop /mnt/fatx/e/rootfs /mnt/rootfs

# copy from rootfs to hda2
echo "(2/3) Start copying content. This should take approximately 5-10 minutes..."
cp -ax /mnt/rootfs/* /mnt/hda2/

# check filecount
cd /mnt/rootfs
TOTAL1=`find . -type f -print | wc -l`

cd /mnt/hda2
TOTAL2=`find . -type f -print | wc -l`

echo "Total file count in rootfs : $TOTAL1"
echo "Total file count in hda2   : $TOTAL2"
 
# clean up
echo "(3/3) Cleaning up..."

cd /mnt
umount hda2
rmdir hda2
umount rootfs
rmdir rootfs

echo "Done..."

File#5: update.initrd.sh

Code: Select all

#!/bin/bash 

######################
echo "(1/3) Mounting initrd.gz ..."
#####################

# Copy out the initrd.gz
cp /mnt/fatx/e/initrd.gz /tmp

# Unzip it
gunzip /tmp/initrd.gz

# Mount as loopback
mkdir /mnt/initrd
mount -o loop /tmp/initrd /mnt/initrd


######################
echo "(2/3) Updating linuxrc ..."
#####################

# Update linuxrc to boot from part2
cd /mnt/initrd

# comment out mounting of e drive
sed -e "s~mount -t fatx /dev/ide/host0/bus0/target0/lun0/part50 /cdrom~#mount -t fatx /dev/ide/host0/bus0/target0/lun0/part50 /cdrom~" < linuxrc > linuxrc1 

# comment out mounting of rootfs from e drive
# add mount rootfs directly from hda2
sed -e "s~mount -o loop /cdrom/rootfs /ram~#mount -o loop /cdrom/rootfs /ram\nmount -t reiserfs /dev/ide/host0/bus0/target0/lun0/part2 /ram~" < linuxrc1 > linuxrc

rm linuxrc1
cd /


######################
echo "(3/3) Zip back new initrd.gz ..."
#####################

# Umount so we can zip it again
umount /mnt/initrd

# Zip it back
gzip /tmp/initrd

# Back up original initrd.gz
mv /mnt/fatx/e/initrd.gz /mnt/fatx/e/oldinitrd.gz

# Copy in the new initrd.gz
mv /tmp/initrd.gz /mnt/fatx/e

# Cleanup
rmdir /mnt/initrd

######################
echo "Original initrd.gz renamed to oldinitrd.gz."
echo "Done ..."
#####################

File#6: update.fstab.sh

Code: Select all

#!/bin/bash

#####################
# Update the new fstab to boot from hda2 and use hda1 as swap
#####################

# mount the new hda2
mkdir /mnt/hda2
mount -t reiserfs /dev/hda2 /mnt/hda2
cd /mnt/hda2/etc

# replace original /dev/loop/0 with /dev/hda2
sed -e "s~/dev/loop/0[ \t]*/[ \t]*reiserfs[ \t]*defaults,errors=remount-ro[ \t]*0[ \t]*1~\n#/dev/loop/0 / reiserfs defaults,errors=remount-ro 0 1\n/dev/hda2 / reiserfs defaults,errors=remount-ro 0 1\n~" < fstab > fstab1

# replace original swap on fatx/e/swap with /dev/hda1
sed -e "s~/mnt/fatx/e/swap[ \t]*none[ \t]*swap[ \t]*sw[ \t]*0[ \t]*0~\n#/mnt/fatx/e/swap none swap sw 0 0\n/dev/hda1 none swap sw 0 0\n~" < fstab1 > fstab

rm fstab1

# clean up
cd /mnt
umount hda2
rmdir hda2

######################
echo "fstab in /dev/hda2 updated."
echo "Gentoox will use new partition after reboot." 
#####################
Last edited by dito199 on Tue Sep 14, 2004 12:41 pm, edited 3 times in total.
miurl
Linux User
Posts: 10
Joined: Mon Sep 13, 2004 4:51 pm

Post by miurl »

hi!

thanks for your guide, but i think there's the last script (update.fstab.sh) missing :?
Furthermore, I think there's a small fault in the "xfer.content.sh"-script
mount -o loop /mnt/fatx/f/rootfs /mnt/rootfs
there should be "/mnt/fatx/e/rootfs" since we have installed it on "E"
i'm a linux newbie, and i don't really know how to update the fstab by the right way?

Thanks in advance!

Miles
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

Post by dito199 »

You are right. I was composing the instruction in notepad and forgot to update the code. Will re-edit it and include the fstab section when I get home later.

Cheers
miurl
Linux User
Posts: 10
Joined: Mon Sep 13, 2004 4:51 pm

Post by miurl »

... once again thanks for the guide!
I think i missed something, because now I've only 20GB at hda (/) I asked myself: "Where is the rest? (137 GB)"
Then I made a big mistake: I added a new partition (hda3) in front of the swap partition :cry:
... I lost my rootfs an gentoox didn't start correctly any more!
I was searching in the forum, and I think it has something to do with the F+G partition, but I didn't find a usefull post?!?
Q1: How do I make this two partitions? :?:
Q2: Which BIOS do I need? I have a Aladdin MODCHIP with Crowmwell 2.31 BIOS flashed? :?:

Thanks
Miles
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

Post by dito199 »

1. What's your HD size?
2. Have you completed all the steps as above?
3. What error does the screen says when you bootup?


Also, to further diagnose the problem, can you do the following?
1. boot from the cdrom
2. ssh into the box as you were during first time installation
3. ctrl-c to break into shell.
4. execute "fdisk -u -l /dev/hda"
5. post the result
miurl
Linux User
Posts: 10
Joined: Mon Sep 13, 2004 4:51 pm

Post by miurl »

1. HDD=160GB
2. Yes I've completed all the steps, but as i mentioned before I don't really know how I do the thing with F+G partition?!?
3. many errors, can't find.... and at the end it can't load x-server

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 268435456 268935456 250000+ 82 Linux swap
/dev/hda2 * 268935457 312581807 21823175+ 83 Linux
/dev/hda3 63 268435455 134217696+ 83 Linux
dito199
Novice
Posts: 22
Joined: Sat Aug 14, 2004 5:40 pm

Post by dito199 »

Don't worry, your original rootfs is still intact. Following should restore you back to the non-native mode.

1. boot from the cdrom
2. ssh into the box as you were during first time installation
3. ctrl-c to break into shell.
4. e drive should be mounted on /mnt/e. Execute "cd /mnt/e"
6. Restore original initrd.gz. Execute "mv oldinitrd.gz initrd.gz"
7. Reboot

Once reboot, you should get back your non-native installation.
Post Reply