can I convert a rootfs install to a native install?

Ask questions regarding Gentoox, Gentoo and Linux in general in these forums and we'll do our best to help you!
Post Reply
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

can I convert a rootfs install to a native install?

Post by nobspangle »

I finally have my gentoox set up just how I wanted it. I've got all the software I need installed and nothing else and it's on the f drive leaving me plenty of room on my e drive for other stuff. Then I start thinking why bother with the loop filesystems when I am using the whole of the f drive. I might as well have a native install.
This is what I have tried.
First I moved my rootfs and swap back to e with magic e-drive. Then I formated f using "mkreiserfs /dev/hda55".
copied rootfs to tmpfs
mounted tmpfs and /dev/hda55
copied the contents of tmpfs to /dev/hda55
in the fstab on /dev/hda55

Code: Select all

# /etc/fstab: static file system information.
#
# <file system>         <mount point>   <type>          <options>                               <dump>  <pass>
/dev/hda55              /               reiserfs        defaults,errors=remount-ro              0    1
proc                    /proc           proc            defaults                                0    0
/dev/cdrom              /mnt/cdrom      iso9660         defaults,ro,user,noauto                 0    0
/dev/hda50              /mnt/fatx/e     fatx            defaults                                0    0
/dev/hda51              /mnt/fatx/c     fatx            defaults,noauto                         0    0
/mnt/fatx/e/swap        none            swap            sw                                      0    0
Now I need to edit the boot loader.
I gunzip and mount initrd then edit linuxrc

Code: Select all

mount 
#mount -t fatx /dev/ide/host0/bus0/target0/lun0/part50 /cdrom
mount -t reiserfs /dev/ide/host0/bus0/target0/lun0/part55 /ram
I'm clearly missing something as this doesn't work, any help as always much appreciated. Maybe what I am trying to do can't be done. I don't know.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

The problem is, once you format /dev/hda55 as reiserfs it "disappears". The xbox nolonger recognises it as a valid partition so it does not report it as existant. This means that the partition is not shown to linux.

Youve done absolutely everything right except for one part ;). What you need to do is partition the drive. Make a linux partition right where the fdrive boundary is to the end of the disk. This should then make a /dev/hda1, format this as reiserfs, then copy your contents to /dev/hda1. To take a tool out of stardust distro, what you need to do is this:

1) make a script containing this (call it /tmp/mkpartition):

Code: Select all

   #!/bin/bash
   ###
   # Settings for fdisk when making swap, then root partitions
   ###
   FDISKSWAP=/tmp/fdisk.swap
   FDISKROOT=/tmp/fdisk.root
   DEVICE="/dev/hda"
   #START=15657985

   ###
   # Start block for the end of the standard 8gb hdd
   ###
   START=15633072
   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.fdisk

   ###
   # Get the information needed to make the swap partition
   ###
   sed -e "s/@SIZE@/$SWAPSIZE/g" -e "s/@START@/$START/g" < $FDISKSWAP > /tmp/make.fdisk
   fdisk -u $DEVICE < /tmp/make.fdisk > /dev/null 2>&1
   rm -f /tmp/make.fdisk

   ###
   # Get the information needed to make the root partition
   ###
   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" < $FDISKROOT > /tmp/make.fdisk
   fdisk -u $DEVICE < /tmp/make.fdisk > /dev/null 2>&1
   rm -f /tmp/make.fdisk

   ###
   # Initialize the 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]"
      sleep 10
      halt
      sleep 1000
   fi

   ###
   # Format the 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]"
      sleep 10
      halt
      sleep 1000
   fi
2) Make the following files, note the path is important! Leave them in /tmp and dont change the filename unless you update the above script:

a) /tmp/fdisk.swap

Code: Select all

n
p
1
@START@
@SIZE@
t
82
w
b) /tmp/fdisk.root

Code: Select all

n
p
2
@START@
@SIZE@
a
2
w
Also note that the formatting of the above two files is absolutely crucial. There should be no trailing newlines and no leading newlines. I.e. both files must start with "n" on the first line and end with "w" on the last line.

Finally, execute the /tmp/makepartition script. This should make you a 256MB swap partition on /dev/hda1 and use the remaining space on /dev/hda2 as a linux reiserfs partition. After youve done this, mount /dev/hda2 then copy over the contents of your rootfs :)

Note that this works for stardust, I dont guarantee it will work for you. BACKUP ALL OF YOUR DATA FIRST!!! And goodluck ;)
Last edited by ShALLaX on Tue Mar 22, 2005 12:57 am, edited 2 times in total.
bobbyaustin
Linux User
Posts: 17
Joined: Tue Sep 02, 2003 1:01 pm
Location: England

Post by bobbyaustin »

Don't know if I am a bit of the mark here or not and if I am right it is going to take a while for me to figure out.

From reading this post I got the idea that I might be able to make these partitions at a point on my f drive, it is 110gig so would I be able to make these partitons and still leave myself 60gig for my f drive, is that possible?

Thanks in advance.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

No, you either take all of your F-drive or none of it. Thats the way the xbox bios works unfortunately.
¡Mysto!
Novice
Posts: 37
Joined: Mon Sep 08, 2003 9:03 pm

Post by ¡Mysto! »

Now when I may be way wide of the mark here too, but when LBA48 support was added didn't some people start having G partitions(They already had hdd's >127gb but fifn't want to format there f:)? couldn't you use some thing like this.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

I guess you could. You'd need to know the G drive partition boundaries then update the above code accordingly.
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

OK don't know if I'm going right so I need more advice incase I screw it all up.
I ran the script it failed intialising swap but my Xbox still works so I went back and just ran the command myself and it worked. Then I tried to format hda2 as reiserfs that failed. When I run fdisk and print the partition information I get this.

Code: Select all

Disk /dev/hda: 10.2 GB, 10242892800 bytes
16 heads, 63 sectors/track, 19846 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1     19847  10002793+  82  Linux swap
/dev/hda2   *         1         1         0    0  Empty
Partition 2 does not end on cylinder boundary.
This looks to me like I have 1 partition covering the entire drive and 1 taking up no space.
So as far as I can tell the script hasn't entered the values for the start cylinder. Is the cylinder the same for all drives or does it differ depending on which drive you have? How would I find out the correct cylinder to start at so I can partition the drive manually. Is it safe to delete the partitions I now have? Will my xbox be affected, I am quite suprised it still works but I'd like to keep it that way.
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Crap, i made a mistake.. forgot to copy and paste some info in the code. Ive updated it, notice the added:

Code: Select all

   ###
   # Start block for the end of the standard 8gb hdd
   ###
   START=15633072
   SWAPSIZE="+256M"
Delete all your partitions and try again. Sorry! (You may have experienced data loss!)
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

I thought there was something missing but I don't know a lot about bash, I wonder what I have lost because my xbox seems OK but I must have killed some data intialising the partition as swap. Lucky I have a sector backup of the whole drive. Damn quick on the reply by the way
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

I do my best :P
nobspangle
Gentoox Guru!
Posts: 1681
Joined: Sun Sep 28, 2003 11:59 am
Location: Manchester, UK

Post by nobspangle »

everything is looking good I now have gentoox running on /dev/hda2 with the swap on /dev/hda1 and your (little) mistake doesn't seem to be causing any problems. Cheers for your help
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Woohoo :)
fixedsys
Novice
Posts: 21
Joined: Wed Feb 23, 2005 10:11 pm

Post by fixedsys »

#!/bin/bash
###
# Settings for fdisk when making swap, then root partitions
###
FDISKSWAP=/tmp/fdisk.swap
FDISKROOT=/tmp/fdisk.root
DEVICE="/dev/hda"
#START=15657985

###
# Start block for the end of the standard 8gb hdd
###
START=15633072
SWAPSIZE="+256M"
Ok I want to understand this code b4 I get home and try this again.
From what I see the swap partition comes 1st physically since this line states the number/sector/block is 156330072 is at the end of the 8gig standard drive
###
# Start block for the end of the standard 8gb hdd
###
START=15633072
SWAPSIZE="+256M"

And then the main partion is created because of this line:
###
# Settings for fdisk when making swap, then root partitions
###
FDISKSWAP=/tmp/fdisk.swap
FDISKROOT=/tmp/fdisk.root
DEVICE="/dev/hda"
#START=15657985
The number 15657985 is futher out of the drive (Difference between the 2 sector values is: 24913 sectors/blocks - This space should be 256meg.

So basicly I would be changing the number under the "is at the end of the 8gig standard drive" to the end of my F: drive then adding 24913 blocks to that number and using that intead of the number under "DEVICE="/dev/hds".

If I got this correct I should be able to ssh into the stardust installer and modify the gentooxinstaller with these values and it should work...?
ShALLaX
Site Admin
Posts: 1973
Joined: Sun Aug 10, 2003 9:25 pm
Location: England
Contact:

Post by ShALLaX »

Just change +256M to +512M... leave that other start line, its commented out because it was wrong.
The original Xbox adaptation of Gentoo
jeokeefx
Novice
Posts: 20
Joined: Thu Mar 24, 2005 3:13 pm

Post by jeokeefx »

hey guys , I am going crazy trying to this , I have searched through the forum and cannot find the answer ..

How can I move my installation from f to e ?

each time i boot with the restoox cd in the drive it just loads linux as normal ? I have edited the linuxboot.cfg file and put the restoox entry in , but i do not get the option to click on it ...
Post Reply