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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
05-09-2009, 08:58 AM
|
#1
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Rep:
|
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 09:08 AM.
|
|
|
05-09-2009, 09:22 AM
|
#2
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
At first I was afraid that no partition table means the HDD had be damaged or something.
Are all the files lost?
|
|
|
05-09-2009, 09:35 AM
|
#3
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
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
|
|
|
05-09-2009, 09:49 AM
|
#4
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by i92guboj
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?)
|
|
|
05-09-2009, 09:53 AM
|
#5
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.)
|
|
|
05-09-2009, 09:58 AM
|
#6
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
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.
|
|
|
05-09-2009, 10:02 AM
|
#7
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by PTrenholme
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
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
|
|
|
05-09-2009, 10:03 AM
|
#8
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by PTrenholme
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
|
|
|
05-09-2009, 10:12 AM
|
#9
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by baldurpet
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 10:15 AM.
|
|
|
05-09-2009, 03:36 PM
|
#10
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by i92guboj
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.
|
|
|
05-09-2009, 04:12 PM
|
#11
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
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.
|
|
|
05-09-2009, 04:25 PM
|
#12
|
Member
Registered: Mar 2008
Location: Marbella, Spain
Distribution: Many and various...
Posts: 913
Rep:
|
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.
|
|
|
05-09-2009, 07:39 PM
|
#13
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,286
|
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 ... ?.
|
|
|
05-09-2009, 08:31 PM
|
#14
|
Member
Registered: Dec 2008
Location: Iceland
Distribution: Ubuntu, freeBSD
Posts: 110
Original Poster
Rep:
|
Quote:
Originally Posted by syg00
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 08:46 PM.
|
|
|
05-09-2009, 09:55 PM
|
#15
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,286
|
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.
|
|
|
All times are GMT -5. The time now is 07:22 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|