LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2009, 07:58 AM   #1
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Rep: Reputation: 15
Disk doesn't contain a valid partition table


I know there are a lot of other questions just like this, but I went through them and they didn't help me.

I'm using a PPC version of Gentoo 2006 live CD on an iBook G4 and I'm trying to mount the main disk, this is the result of fdisk -l:

Code:
Disk /dev/hda: 30,0 GB, 30005821400 bytes
255 heads, 63 sectors/tracks, 3648 cylinders
Units = cylinders of 16065 * 512 = 8225282 bytes

Dsi k/dev/hda doesn't contain a valid partition table
This is very odd, especially since I tried the same command on this computer the last time I used it and then it worked without a hitch. Mounting /dev/hda with something like mount -f -t hfsplus /dev/hda /media/elin only results in the folder /media/elin to be empty.

Some forums advised using gparted, but that program simply isn't on the live CD. I do have cfdisk but I have no idea what to do with it.

p.s. just an extra question, when I log into the 'alternative' consoles in Gentoo (ctrl+alt+f1) they present me with the prompt "livecd root #" but when I use su - it becomes "livecd ~ #" what's the difference?

Last edited by baldurpet; 05-09-2009 at 08:08 AM.
 
Old 05-09-2009, 08:22 AM   #2
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
At first I was afraid that no partition table means the HDD had be damaged or something.

Are all the files lost?
 
Old 05-09-2009, 08:35 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
If the partition table is damaged the data *might* still be there. Here programs like testdisk and photorec can come in handy.

However, "the why" is what would worry me the most. Why has been it corrupted? This time the answer can be hardware, yes. But it could also be an unstable fs driver (not likely if you stick to vanilla or gentoo kernels), an electrical outage or simply the theory of chaos
 
Old 05-09-2009, 08:49 AM   #4
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
If the partition table is damaged the data *might* still be there. Here programs like testdisk and photorec can come in handy.

However, "the why" is what would worry me the most. Why has been it corrupted? This time the answer can be hardware, yes. But it could also be an unstable fs driver (not likely if you stick to vanilla or gentoo kernels), an electrical outage or simply the theory of chaos
The Gentoo live CD includes neither testdisk nor photorec.. can anyone think of a way to restore the partition table? My girlfriend is going to kill me otherwise

(I have no idea why this happened, it worked perfectly fine some weeks ago, and I didn't do anything to the computer except moving it around, not enough to ruin it I think?)
 
Old 05-09-2009, 08:53 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Does the Live CD have parted on it? That's a command-line tool, but you should be able to investigate your problem with it.

If you have access to another system (or can do it with the Live CD you have), you could download and burn the System Rescue Live CD which does contain many tools for investigating and fixing system problems. (IIRC, it uses Gentoo as its Linux shell.)
 
Old 05-09-2009, 08:58 AM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Oh, as to your actual problem, if you've been moving the system around, check that the disk drive cables are correctly seated (at both ends) since a partially connected cable can make a good drive look quite funkey.
 
Old 05-09-2009, 09:02 AM   #7
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by PTrenholme View Post
Does the Live CD have parted on it? That's a command-line tool, but you should be able to investigate your problem with it.
Yes I have parted! I've never used it before so I guess I could consult the man page, but I would really appreciate it if you could tell me what to do? This isn't something I want to mess up
Quote:
Originally Posted by PTrenholme View Post
If you have access to another system (or can do it with the Live CD you have), you could download and burn the System Rescue Live CD which does contain many tools for investigating and fixing system problems. (IIRC, it uses Gentoo as its Linux shell.)
Thanks, I'll check it out
 
Old 05-09-2009, 09:03 AM   #8
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by PTrenholme View Post
Oh, as to your actual problem, if you've been moving the system around, check that the disk drive cables are correctly seated (at both ends) since a partially connected cable can make a good drive look quite funkey.
Excuse me? I have no idea what you're talking about I'm on an iBook G4 with a live CD inserted

/dev/hda is inside the laptop? there are no cables
 
Old 05-09-2009, 09:12 AM   #9
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by baldurpet View Post
The Gentoo live CD includes neither testdisk nor photorec.. can anyone think of a way to restore the partition table? My girlfriend is going to kill me otherwise

(I have no idea why this happened, it worked perfectly fine some weeks ago, and I didn't do anything to the computer except moving it around, not enough to ruin it I think?)
There's a statically linked testdisk package on its nome website, just download it with wget and run.

Code:
# Read the PS below before downloading this.
wget http://www.cgsecurity.org/testdisk-6.11.3.linux26.tar.bz2
If not, use a rescue livecd of any kind, most of them do ship these tools.

http://www.cgsecurity.org/wiki/TestDisk_Livecd


Parted is an advanced partition editing tool, but if you don't know what you are doing and you don't know the layout that your partitions had it's going to do you no good in this circumstance. Testdisk can guess the partition table when it's broken, however it's not infallible. It all depends on the state of your fs's.

PS. Sorry, I see you are using a Mac, I guess this is the right one for you then:

Code:
wget http://www.cgsecurity.org/testdisk-6.11.3.darwin.tar.bz2

Last edited by i92guboj; 05-09-2009 at 09:15 AM.
 
Old 05-09-2009, 02:36 PM   #10
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
I see you are using a Mac
Yes but I am running a PPC Gentoo on the Mac, so I'm not using a Mac environment. Should I download the "linux.png Linux, kernel 2.6.x i386/x86_64, tar.bz2" from here

I can't get Testdisk to work though, I downloaded the package and it didn't include any helpful files! There is the file 'testdisk.1" something but I don't know how to run it.
 
Old 05-09-2009, 03:12 PM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
You need a build for ppc, that one is for i386/x86_64 as reflected in the link. I think that the darwin one that I linked is the right one for you. At least, that's what the file command tells me:

Code:
wget http://www.cgsecurity.org/testdisk-6.11.3.darwin.tar.bz2
--2009-05-09 22:09:21--  http://www.cgsecurity.org/testdisk-6.11.3.darwin.tar.bz2
Resolviendo www.cgsecurity.org... 193.168.50.120
Connecting to www.cgsecurity.org|193.168.50.120|:80... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: 733896 (717K) [application/x-bzip2]
Saving to: `testdisk-6.11.3.darwin.tar.bz2'

100%[==========================================================================================================================>] 733.896      111K/s   in 5,7s    

2009-05-09 22:09:26 (126 KB/s) - `testdisk-6.11.3.darwin.tar.bz2' saved [733896/733896]

$ tar xf testdisk-6.11.3.darwin.tar.bz2 
$ cd testdisk-6.11.3
$ cd darwin/
$ ls
photorec  photorec.1  readme.txt  testdisk  testdisk.1
$ file testdisk
testdisk: Mach-O executable ppc
That's the program.

However I have zero experience with ppc machines.
 
Old 05-09-2009, 03:25 PM   #12
Completely Clueless
Member
 
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 899

Rep: Reputation: 70
There's a tool called "Gpart" included in some distros which does exactly what you want. It scans the entire drive for traces of filesystem signatures and reconstructs what the partition table must have looked like from them. It's normally effetive, just requiring the odd tweak sometimes at the end of the scan, though. After its run and you're happy it will re-write the table to hard hard disk. Most likely you'll get it right first time without any tweak being required.
 
Old 05-09-2009, 06:39 PM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I would be mighty surprised if fdisk knows about the mac layout - the ppc gentoo handbook mentions "mac-fdisk".

You are using the ppc handbook, right ... ?.
 
Old 05-09-2009, 07:31 PM   #14
baldurpet
Member
 
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
I would be mighty surprised if fdisk knows about the mac layout - the ppc gentoo handbook mentions "mac-fdisk".

You are using the ppc handbook, right ... ?.
...
Boy is my face ever red.. no it turns out I wasn't using the ppc handbook! Yeah, you may gloat now. But mac-fdisk is here on Gentoo (compiling gparted and testdisk on a 3 year old OS was a bitch anyhow, almost all the dependencies were missing).

I fired up mac-parted selected p to print the partition table of /dev/hda and this is the result:
Code:
livecd ~ # mac-fdisk /dev/hda
/dev/hda
Command (? for help): p
/dev/hda
        #                    type name                 length   base     ( size )  system
/dev/hda1     Apple_partition_map Apple                    63 @ 1        ( 31.5k)  Partition map
/dev/hda2              Apple_Free                      262144 @ 64       (128.0M)  Free space
/dev/hda3               Apple_HFS Untitled           58342902 @ 262208   ( 27.8G)  HFS
/dev/hda4              Apple_Free                          10 @ 58605110 (  5.0k)  Free space

Block size=512, Number of Blocks=58605120
DeviceType=0x0, DeviceId=0x0
Now I've never used a command line partition tool before, and I'm a bit afraid of doing anything since I have a history of breaking things.

These are the tools, what should I do?
Code:
Commands are:
  h    help
  p    print the partition table
  P    (print ordered by base address)
  i    initialize partition map
  s    change size of partition map
  b    create new 800K bootstrap partition
  c    create new Linux partition
  C    (create with type also specified)
  d    delete a partition
  r    reorder partition entry in map
  w    write the partition table
  q    quit editing (don't save changes)
Command (? for help):

Last edited by baldurpet; 05-09-2009 at 07:46 PM.
 
Old 05-09-2009, 08:55 PM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If you're uncomfortable using CLI, you're probably going to have plenty of anxious moments on gentoo.
The doco seems to cover all this rather well. Gentoo has the best doco I've seen - read it. Several times in need.
You don't have enough space to install even a minimal gentoo - that implies you are going to have to (and happy to) delete hda3. You can't resize partitions from fdisk type tools - well actually you can, but it makes a hell of a mess of the filesystem if you reduce the size.
If so, merely delete that partition and create new as per the doco. If you need to keep that hda3 partition, you'll need to resize it from somewhere else to free up space for gentoo to use.
 
  


Reply



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
Disk /dev/hdb doesn't contain a valid partition table LOLobo Linux - Hardware 11 11-06-2008 01:47 AM
Disk doesn't contain a valid partition table expatCM Linux - Hardware 9 10-01-2007 02:38 AM
Disk /dev/hdb doesn't contain a valid partition table manudath Linux - Hardware 2 09-01-2006 02:23 PM
Disk /dev/hdb doesn't contain a valid partition table rajeshdorai Linux - Software 10 04-14-2006 11:19 PM
Disk /dev/hdb doesn't contain a valid partition table rajeshdorai Linux - Hardware 1 04-12-2006 07:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:54 PM.

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
Open Source Consulting | Domain Registration