xboxscene.org forums

OG Xbox Forums => Hardware Forums => General Hardware/Technical Chat => Topic started by: ldotsfan on June 23, 2010, 08:43:00 AM

Title: Lpartx
Post by: ldotsfan on June 23, 2010, 08:43:00 AM
Announcing the beta release of lpartx - my Linux based partitioning tool for the xbox hdd. This is an open-source project.

This draws on:
1. My recent work on Xbpartitioner 1.2 RC
2. xboxdumper for Windows
3. friedgold's mini linux. With xpad-keyboard patch by Chimpanzee
4. Shallax's Gentoox Loader.
5. My incomplete xboxhdm3.
6. chimpanzee's chimp26.

Features:
1. Shows the actual cluster size used by extended partitions for safety. Highlights cluster sizes in error. ie 32K when 64K should have be used, 16K when 32K should have been used.
2. A subset of xbpartitioner partitioning capability for extended partitions. Aka the toggle of partitioning schemes in xbpartitioner via the A button etc.
CODE

partition type 1: F partition is capped at 137Gb or less
partition type 2: F partition occupies all space
partition type 3: G partition occupies space after 137Gb
partition type 4: F and G partitions splits space evenly


3. A simple dialog based GUI controlled by the d-pad and A button (as opposed to B,X,Y buttons) on the controller. Original MS controller may be needed.
4. Works on Xbox 1.6 as well. In fact I used one as my test machine.
5. Formats 32K and 64K FATX extended partitions.
6. Should work on 1TB hdd and beyond. But I can't test this myself.
7. Hidden chimp26's cloning/locking/unlocking capability in linux shell - untested.
8. A simple GUI to configure network.
9. Reboot and Shutdown options.
10. Possibility of going to Linux shell from the main menu. USB keyboard needed.
11. I think telnet and ftp daemons are started if you need them.
12. Option to display the xbox version and hardware details.

Usage instructions:
1. Place the unzipped files in E:\Apps\lpartx folder.
2. Place linuxboot.cfg at the root of E drive. This file must reside at this location. If you change the installation folder in step 1, edit this file.
3. Launch default.xbe in lpartx folder. This is actually Gentoox loader. Comes with a simple GUI.
4. Select FATX boot option.
5. Press A button on controller when prompted to start a login and hence launch the tool.
6. Use controller's d-pad up and down arrows to navigate menu. A button to select option. If you have USB keyboard it will work too.
7. Select Reboot or Shutdown options after you have formatted the extended partitions.

I will try to capture screenshots. Will also post my Linux source code in subsequent posts.
Title: Lpartx
Post by: ldotsfan on June 23, 2010, 06:05:00 PM
Pictures of version 1.0:

1. The main menu:
IPB Image

2. Menu Option 2: Details of xbox
IPB Image

3. Option 3: Partition Info.
a. F and G evenly split.
IPB Image

b. F takes all.
IPB Image

4. Option 4 to format extended partitions:
IPB Image

Since the tool is based on Gentoox Loader which is a Cromwell derivative, a boot disc version is possible.
Is there any demand for the boot disc version?
Title: Lpartx
Post by: Bomb Bloke on June 23, 2010, 08:20:00 PM
Doesn't work on my X-Box, after selecting FATX I get:

QUOTE
Booting ...

Boot: Loading kernel '/Apps/lpartx/linux24379'... [x]

And there it freezes. Though I suspect this is a problem with my X-Box, which also freezes on PBL. I have no idea why.

Machine is a 1.0, TSOP flashed with X2 5035. Oddly enough I have another machine which is pretty much the same - that works with PBL, but I don't have it to hand to test it with this (only difference I know of is the HDD, which is stock (dunno if it's WD or SG), as opposed to the 750gb SATA Samsung in the problem machine).

You might consider renaming the XBE's title from "Linux" to "Lpartx", if only for the sake of presentation. One way to do this is by hitting the white button over it while viewing it in XBMC's Programs menu, though I'm sure there are PC-based tools that can do this as well.

To my limited understanding, programs should be able to determine where their XBE is launching from, which would make the config file redundant (and also allow for a version that'd boot from any location). Though I dunno how that would be done without the XDK.
Title: Lpartx
Post by: ldotsfan on June 23, 2010, 08:34:00 PM
I had issues launching Linux from my 1.1 xbox with XBMC as dash at one stage and did a workaround by first launching unleashX then launching the Linux XBE from there. Maybe you could try launching through unleashX instead.

The linux XBE - Gentoox loader is hard coded to look for linuxboot.cfg at E drive root , I considered it too much rework to recode Gentoox Loader which is actually a version of Cromwell to remove the dependency.
I suppose we could use xbeboot which is not path specific instead if that is more helpful. Please see if unleashX helps.

As for the title change, again Gentoox Loader needs to be recompiled. Not a priority but I'll get to it if I can find the piece of code to change  tongue.gif  
Title: Lpartx
Post by: Bomb Bloke on June 23, 2010, 11:39:00 PM
QUOTE(ldotsfan @ Jun 24 2010, 10:34 AM) View Post
I had issues launching Linux from my 1.1 xbox with XBMC as dash at one stage and did a workaround by first launching unleashX then launching the Linux XBE from there. Maybe you could try launching through unleashX instead.

I'm just brain-dead as it turns out. I'd copied the app to the correct location, then immediately "corrected" myself by moving it to my usual apps folder - e:\apps\applications.

After fixing that, got a Linux init-type screen with a few errors in it:

QUOTE
PCI: Failed to allocate resource 2(f8000000-f7ffffff) for 01:00.0
Populating ramdisk...
Mounting hard drive partitions...
Starting network...
DHCP broadcast failed, falling back to static IP
IP Address: 10.0.0.100
Starting FTP Server...
Starting Telnet Server...

You may now connect using:
username:root
password:xbox

Please press Enter to activate this console. kmod: failed to exec /sbin/modprobe
 -s -k net-pf-10, errno = 2

Dunno how much of that was expected. My console is networked and has access to a working DHCP server. I was able to ping to it on the static address (which I assume it picked up from what I'd set in the MS dash, 'cause that's the one I usually use anyway), but the FTP server didn't seem to be responsive. Though I doubt any of that matters.

Anyway, I pushed A on that screen and it jumped to the program. Option 2, "Xbox Info", worked fine: option 3, "Partition Info", gave me this:

QUOTE
Total Sectors  -> 1465149168
Error reading partition table in /dev/hda
Error in listing partitions

(The drive is a Samsung HD753LJ (750gb SATA), with about 500gb assigned to F (32kb clusters) and 250gb assigned to G (16kb clusters). Each of these partitions has less then 10gb free.)

I went into the "Format Extended Partitions" menu and tried the "List Partitions" option there, that just flickered the screen and jumped back to the main menu again.

QUOTE(ldotsfan @ Jun 24 2010, 10:34 AM) View Post
As for the title change, again Gentoox Loader needs to be recompiled. Not a priority but I'll get to it if I can find the piece of code to change  tongue.gif

Er, no, I'm quite serious: XBMC can patch the titles embedded in compiled XBE files directly. I wasn't sure if it'd work on this specific one, so I even tested it before making my previous post.  wink.gif

(All of the above info about the new set of errors was with an unpatched XBE, of course. I also configured my console to boot directly to UnleashX and performed a hard-reset, but that didn't affect matters either).
Title: Lpartx
Post by: ldotsfan on June 24, 2010, 06:46:00 AM
Thanks for the detailed testing. You can ignore the Fail to allocate resources message.

1. Fixed DHCP problem in new version. My router assigned an IP to the xbox.
2. Commented out ftp. Why do we need ftp daemon in a partitioning tool?  dry.gif The message is still onscreen but is easily removable.
3. Telnet should be working.
4. Fixed "List Partitions" option.
5. The "Error reading partition table" is more serious. Basically what it does is to read the xbpartitioner inserted magic string which uniquely identifies the partition table existance at sector 0, offset 0.
CODE

****PARTINFO****

I suspect your xbox hdd partition table is somehow corrupted  dry.gif but it seems that xbpartitioner/the bios isn't complaining  sleep.gif. I've hence relaxed the rule somehow by reading this partial magic string.
CODE

PARTINFO

Hopefully this will enable the List Partitions option to work.
6. Attempted to edit the title in the Gentoox Loader XBE by recompiling. It appeared in unleashX correctly but I cannot figure out XBMC yet.  sleep.gif

Grab the new version - 1.01 from here.

I've also added a linuxboot-componentcables.cfg which needs to be renamed to linuxboot.cfg for those consoles with component cables. My 1.1 xbox is one of those  biggrin.gif
Title: Lpartx
Post by: Bomb Bloke on June 24, 2010, 07:16:00 PM
QUOTE(ldotsfan @ Jun 24 2010, 08:46 PM) View Post
1. Fixed DHCP problem in new version. My router assigned an IP to the xbox.

Yup, works correctly now.

QUOTE(ldotsfan @ Jun 24 2010, 08:46 PM) View Post
3. Telnet should be working.

Didn't test this before, but I see it's working now.

QUOTE(ldotsfan @ Jun 24 2010, 08:46 PM) View Post
4. Fixed "List Partitions" option.
5. The "Error reading partition table" is more serious. Basically what it does is to read the xbpartitioner inserted magic string which uniquely identifies the partition table existance at sector 0, offset 0.
CODE

****PARTINFO****

I suspect your xbox hdd partition table is somehow corrupted  dry.gif but it seems that xbpartitioner/the bios isn't complaining  sleep.gif. I've hence relaxed the rule somehow by reading this partial magic string.
CODE

PARTINFO

Hopefully this will enable the List Partitions option to work.

It did, and also made a point that the "strict magic compare" failed. Though unlike your screenshots, my space figures display leading 0's (eg, 0000004882MB for E, instead of just 4884MB). Seems to be accurate though.

Regarding the "format" screen, option one doesn't mention what F is capped at, and option three is written as: "G occpies space beyond 137GB". Just a couple of minor typos there.

I managed to accidently hit a button over option one ("F is capped") and trash my filesystem. Er, um, a "warning: this will erase all data on both your extended partitions" message, with a confirmation prompt defaulting to "no", would be nice. Guess I'll be buying that new HDD earlier then I thought (I'll need it for data recovery).  laugh.gif

After this the app no longer complained about the "strict magic compare" failing.

Regarding the pre-set layouts, obviously an option to set whatever sizes the user wants to use would be good, but I think the whole "F capped at 137gb" thing isn't very practical.

For example, preset options like these would be somewhat more efficient:

1) F takes 250gb, G takes rest
2) F takes 500gb, G takes rest
3) F takes 750gb, G takes rest
4) F takes all.

If a user's mod can't handle partitions like these, then they don't have any need for this app in the first place.
Title: Lpartx
Post by: ldotsfan on June 25, 2010, 02:36:00 AM
QUOTE(Bomb Bloke @ Jun 25 2010, 09:16 AM) View Post

Regarding the "format" screen, option one doesn't mention what F is capped at, and option three is written as: "G occpies space beyond 137GB". Just a couple of minor typos there.

Corrected the typos. Grab new version 1.02  

QUOTE(Bomb Bloke @ Jun 25 2010, 09:16 AM) View Post

I managed to accidently hit a button over option one ("F is capped") and trash my filesystem. Er, um, a "warning: this will erase all data on both your extended partitions" message, with a confirmation prompt defaulting to "no", would be nice. Guess I'll be buying that new HDD earlier then I thought (I'll need it for data recovery).  laugh.gif

Sorry to hear of your unplanned formatting.  ohmy.gif
I've added the Confirm to format option defaulting to No for safety.

QUOTE(Bomb Bloke @ Jun 25 2010, 09:16 AM) View Post

After this the app no longer complained about the "strict magic compare" failing.

I think we may have a bug in Xbpartitioner 1.1 somewhere. My 1.1 hdd was formatted with Xbpartitioner 1.0 and didn't have this issue. Anyway it's not a showstopper since the bios didn't bother.

QUOTE(Bomb Bloke @ Jun 25 2010, 09:16 AM) View Post

Regarding the pre-set layouts, obviously an option to set whatever sizes the user wants to use would be good, but I think the whole "F capped at 137gb" thing isn't very practical.

For example, preset options like these would be somewhat more efficient:

1) F takes 250gb, G takes rest
2) F takes 500gb, G takes rest
3) F takes 750gb, G takes rest
4) F takes all.

I've tweaked the Configure Network - IP address GUI - Menu option 1 and recycled the GUI into a "Custom F size,G gets the rest" option. The GUI is working but I'm getting strange results for the created partition table. This feature will require more work.
Title: Lpartx
Post by: Bomb Bloke on June 25, 2010, 03:24:00 AM
QUOTE(ldotsfan @ Jun 25 2010, 04:36 PM) View Post
I think we may have a bug in Xbpartitioner 1.1 somewhere. My 1.1 hdd was formatted with Xbpartitioner 1.0 and didn't have this issue. Anyway it's not a showstopper since the bios didn't bother.

If such a bug exists within 1.1, then it would also exist with 1.0. None of the code that does the actual "formatting" was modified in the update. I messed with the code for ensuring the cluster size was correct (which also allowed it to be set to 64kb), changed the way capacities were displayed to the user, and altered the version number. That's the full list of changes.

In short, if I formatted with 1.0, then the table should've been identical to that from 1.1. Assuming I actually used 1.1; I can't even remember.

Although I don't have much knowledge as to what this "magic string" thing is, I get the impression it should only be altered when a drive is formatted. So I suppose the "error" must have something to do with that (as opposed to just a bad shutdown or something during a file-write)?
Title: Lpartx
Post by: ldotsfan on June 25, 2010, 06:54:00 AM
QUOTE(Bomb Bloke @ Jun 25 2010, 05:24 PM) View Post

In short, if I formatted with 1.0, then the table should've been identical to that from 1.1. Assuming I actually used 1.1; I can't even remember.

Although I don't have much knowledge as to what this "magic string" thing is, I get the impression it should only be altered when a drive is formatted. So I suppose the "error" must have something to do with that (as opposed to just a bad shutdown or something during a file-write)?

I'm at a loss to explain why things worked or did not. It's likely there's a bug in versions of xbpartitioner which only surfaced under certain unknown scenarios but I cannot explain see why the bios ignores the error value. I first noticed that the the first byte of the "****PARTINFO****" magic string was corrupted somehow in my testing for xboxdumper by doing comparisons with a hex editor. Hence my relaxed check in lpartx and your testing confirmed my suspicions of the bug's existance.

Since nightShd - author of xbpartitioner and oz_paulb author of LBA48 in bios are no longer active in the scene, we can only speculate. However I can test the tolerance of how far the corrupted magic value can go before xbpartitioner complains or the bios refuses to boot the hdd. That will determine how Linux based tools like lpartx, xboxhdm3 and the new kernel in xdsl 0.7 should react to the 'dirty' partition table magic value.

If we have more testers for lpartx, we may also be able to isolate the exact cause sooner.
Title: Lpartx
Post by: ldotsfan on June 25, 2010, 08:44:00 AM
QUOTE(ldotsfan @ Jun 25 2010, 04:36 PM) View Post

I've tweaked the Configure Network - IP address GUI - Menu option 1 and recycled the GUI into a "Custom F size,G gets the rest" option. The GUI is working but I'm getting strange results for the created partition table. This feature will require more work.

Instead of an arbitary size for F, I thought, why not do a slider in term of percentage of total size to assign to F (and rest to G)?

IPB Image

Is this better for the user?
Title: Lpartx
Post by: Bomb Bloke on June 25, 2010, 05:39:00 PM
Well, yes: You'd simply set the percentage to anything less then 50%. Though there's quite a number of other ways to do it outside of Lpartx (including, of course, XBPartitioner, which has a more complex interface but grants full control over partition layouts). There's no problem with having a larger G partition, if that's what you're thinking?

The values I listed aren't totally arbitrary; they sit slightly below the points where the cluster sizes on F would increase, hence keeping the average cluster size down (though really that last option should be "F takes up to 1tb, G takes rest" instead of "F takes all").

Though the slider would be more suitable for those who wish to set things out according to what data they have (for eg, if a user has X amount of media data and Y amount of game data, they'll probably want to partition according to those figures). Would it be possible to have the slider show the prospective sizes for F/G as the slider is moved left/right?
Title: Lpartx
Post by: ldotsfan on June 25, 2010, 09:21:00 PM
I got the slider to display the estimated sizes of F and G on the PC but unfortunately lpartx relies on minilinux which uses uclibc library and the version of dialog command in minilinux used to render the GUI is too old to include the gauge option used for the slider. I tried compiling a copy of dialog but couldn't figure out the uclibc nuances.  dry.gif In other words, it doesn't work  mad.gif

Well the effort isn't wasted. This feature will debut in xboxhdm3 instead since that is based on a modern distribution SLAX and the dialog command is built-in.  biggrin.gif
Title: Lpartx
Post by: steveo1978 on June 25, 2010, 10:38:00 PM
I am still a little lost about the slider. If I had a 100gb of space to divide up and I set the slider to 0 what would be the space on F would it be 0 and G get all the 100gbs
Title: Lpartx
Post by: Endymion_ on August 28, 2010, 08:23:00 PM
Well, I had hoped that lpartx might solve some problems that I had been having with a 1.5TB hard disk installation. In a nutshell, everything works fine until I install so many games (290 last count), at that point any new games just stop working, no matter the source, even a game loaded from the DVD drive would not work.

lpartx did not appear to format the large F and G drive properly. If I attempted to split the space evening between the two drives, F drive took 711GB and the G drive took 0GB, hence its space was inaccessable. If I formatted using other options, such as F in a custom size and G taking the rest, the custom size was never respected, always some strange number much much much lower than requested. G drive would also appear to start on the same block as reported by lpartx.
Title: Lpartx
Post by: ldotsfan on August 29, 2010, 08:02:00 AM
Extract the newer version of lpartx from LUD: http://sourceforge.n...so.zip/download. I made some changes to the code while working on LUD but didn't update the copy in lpartx as I wasn't aware of any interest in lpartx - other than Bomb Bloke, nobody else posted in the thread.

Please report back on your results. If the bugs are traceable and reproducible, I can try to fix them.
Title: Lpartx
Post by: Endymion_ on September 01, 2010, 11:11:00 AM
Okay, I will give this another go with the newer version, probably this week end, as methodically as I can. Are you open to PM?