LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-11-2011, 05:19 AM   #1
linluvr
LQ Newbie
 
Registered: Dec 2005
Distribution: Linux Mint 9
Posts: 10

Rep: Reputation: Disabled
Question need to change f.s. id in partition table


Hello, all.

A couple of years ago, I got a 2TB drive and installed Debian on it.
I used the standard installation procedure, as I recall, and created
three partitions, which are shown below in the output of "fdisk":

| Command (m for help): p
| Disk /dev/sdb: 2000 GB, 2000396321280 bytes
| 255 heads, 63 sectors/track, 243201 cylinders
| Units = cylinders of 16065 * 512 = 8225280 bytes
|
| Device Boot Start End Blocks Id System
| /dev/sdb1 1 13 104391 83 Linux
| Warning: Partition 1 does not end on cylinder boundary.
| /dev/sdb2 13 24328 195310237 83 Linux
| Warning: Partition 2 does not end on cylinder boundary.
| /dev/sdb3 24328 243202 1758105405 83 Linux
| Warning: Partition 3 does not end on cylinder boundary.
|
| Command (m for help): l
| System types for this disk label type are not available.

And here's what I get from parted:

| Welcome to GNU Parted! Type 'help' to view a list of commands.
| (parted) p
| Model: ATA ST32000542AS (scsi)
| Disk /dev/sdb: 2000GB
| Sector size (logical/physical): 512B/512B
| Partition Table: gpt
|
| Number Start End Size File system Name Flags
| 1 17.4kB 100MB 100MB ext2 boot
| 2 100MB 200GB 200GB windoze msftres
| 3 200GB 2000GB 1800GB 2tb-all

(Due to the web squishing of blanks, you can't see in the
lines pertaining to the second and third partition that
there is no filesystem type indicated - "windoze" and
"2tb-all" are in the "Name" column.)


And here's the output of "df" - which shows how the first and third
partitions are mounted:

| Filesystem 1K-blocks Used Available Use% Mounted on
| /dev/sdb1 91511 21307 65322 25% /boot
| /dev/mapper/vg2-all 1752190744 646575836 1105614908 37% /

The third partition is encrypted, with an LVM volume thing living
inside it. Yes, I know it's also possible to do things the other
way 'round - I don't know which is better, but that's a subject for
another day, I suppose, as is how to create partitions that end on
cylinder boundaries, which you can see the installer failed to do.

I am unsure at this point whether fdisk (GNU Fdisk 1.2.1) is capable
of handling large drives, but at least I suppose that what it says
about the absence of a disk label is accurate, since that fact is
confirmed by parted (GNU parted 1.8.8).

My immediate problem is that the second partition (/dev/sdb2), which
contains a FAT32 file system, cannot be mounted, presumably due to
its being mislabeled with the Id code "83" (rather than "b"). Using
the "od" command shows that at least the first part of the partition
does contain a FAT32 file system - at least it's pretty much the
same as what I see for the start of another partition which does
mount just fine using a near-identical entry in /etc/fstab:

| /dev/sda5 /aux vfat rw,uid=500 0 0
| /dev/sdb2 /win1 vfat rw,uid=500 0 0

When I enter "mount -a" I get:

| mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
| missing codepage or helper program, or other error
| In some cases useful info is found in syslog - try
| dmesg | tail or so

Syslog sez:

| [94176.426183] FAT: utf8 is not a recommended IO charset for FAT
| filesystems, filesystem will be case sensitive!
| [94176.426429] FAT: bogus sectors per cluster 0
| [94176.426447] VFS: Can't find a valid FAT filesystem on dev sdb2.

Yes, I suppose it's possible that the filesystem somehow got corrupted,
but I tend to doubt that it did. I believe that at one point, I was
able to boot into Windoze directly from that partition - but then after
I installed Linux, GRUB replaced the other boot loader, and I never was
able to figure out how to get it to boot from that partition (being lazy,
and having little use for Windoze at the time).

Though I know I do have some stuff in that filesystem, if I become
convinced that it's more trouble than it's worth to figure out how
to mount it, I would be willing to make a new FAT32 filesystem on
that partition. (I only have a Windoze2K install disk, so FAT32
is good enough for my present purposes - I know it works with both
Windoze and Linux, even if it lacks some features of NTFS.)

My question, then, is whether there is a way to set the volume label
that the partitioning programs need to see - I don't know at this
point whether the label is per physical drive or per filesystem.
In fact, it may be that the word "label" is here being used as a
synonym for the partition table itself. (But I hope you can see
my confusion - there's clearly a partition table on the drive,
since the "p" command works in both fdisk and parted.)

My reading of the parted documentation seems to indicate that the
"mklabel" command has to be issued prior to making any partitions,
which would indicate that the sort of label we're talking about is
for the entire drive - and yes, I know, I can't use that command
now, because it wipes out the partition table or does something
else that's equally nasty, so I'm not about to make that mistake.

I assume that if I can set the volume label, I can use the "t"
command within fdisk to change the partition type (I don't see
an equivalent command within parted).

Thanks in advance for any suggestions, questions, advice,
criticism or anything else you might like to send my way!

Last edited by linluvr; 06-11-2011 at 05:57 AM.
 
Old 06-11-2011, 06:00 AM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Just a quick thought...if you have the space, back up your second
partition as it is. Not only will it give you a way to restore
files, but it will let you spin off another copy to experiment
with.

For the backup, run "dd if=/dev/sdb2 of=/some/path/sdb2.vfat"
or "dd if=/dev/sdb2 | gzip > /some/path/sdb2.vfat.gz".

To make a copy to experiment with, run "cp /some/path/sdb2.vfat
/whatever/path/test.vfat" or "zcat /some/path/sdb2.vfat >
/whatever/path/test.vfat". You can then mount this file as
if it were a hardware device.
 
1 members found this post helpful.
Old 06-11-2011, 06:17 AM   #3
linluvr
LQ Newbie
 
Registered: Dec 2005
Distribution: Linux Mint 9
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by carltm View Post
Just a quick thought...if you have the space, back up your second
partition as it is. Not only will it give you a way to restore
files, but it will let you spin off another copy to experiment
with.

For the backup, run "dd if=/dev/sdb2 of=/some/path/sdb2.vfat"
or "dd if=/dev/sdb2 | gzip > /some/path/sdb2.vfat.gz".
Hmmm. Yeah - I do have the 200GB available in the root filesystem
at present, so that's a possibility - one that hadn't occurred to me,
and for which I thank you very much!

Quote:
To make a copy to experiment with, run "cp /some/path/sdb2.vfat
/whatever/path/test.vfat" or "zcat /some/path/sdb2.vfat >
/whatever/path/test.vfat". You can then mount this file as
if it were a hardware device.
Would I use something like:

mount -t vfat -o ro,loop=/dev/loop1 /some/path/sdb2.vfat /mnt/sda2

or some such?

I should also mention that parted doesn't see a filesystem on
the partition, but maybe it's because it's also looking for some
sort of Linux filesystem, due to the Id of 83:

> (parted) check 2
> Error: Could not detect file system.

I'm surprised that parted doesn't even show the partition types.

Can someone tell me whether having that code set incorrectly is
enough to explain the facts as I've laid them out, including the
fact that I can't mount the partition using the fstab shown in
my original posting? I also tried "fsck" - which produced:

| # fsck.vfat /dev/sdb2
| dosfsck 3.0.1, 23 Nov 2008, FAT32, LFN
| Cluster size is zero.
 
Old 06-11-2011, 06:29 AM   #4
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Quote:
Originally Posted by linluvr View Post
Would I use something like:

mount -t vfat -o ro,loop=/dev/loop1 /some/path/sdb2.vfat /mnt/sda2

or some such?
Yes.
 
1 members found this post helpful.
Old 06-11-2011, 06:34 AM   #5
linluvr
LQ Newbie
 
Registered: Dec 2005
Distribution: Linux Mint 9
Posts: 10

Original Poster
Rep: Reputation: Disabled
In reply to my question about mounting the copy of /dev/sda2,

Quote:
Originally Posted by carltm View Post
Yes.
OK. Well, I'm looking a bit more closely at what's in the partition,
and am seeing something that looks far less structured than what's in
the known-good fat32 filesystem after the first couple of dump screens,
so it may be that the filesystem is in fact corrupted. Anyway, I'm
making a copy of it now, as per Carl's suggestion.

So the next question is whether using parted to create a new filesystem
on that partition should take care of the incorrect ID code.

Then I'll have to install Windoze on that partition and find
another way to boot into the Linux system on that drive (which
lives in the encrypted LVM), if I let Windoze install its
loader into the MBR - or else figure out how to use Win GRUB,
or whatever it's called. Any pointers to useful sources of
info on those subjects, and advice on how best to do it would
be gratefully received.

I don't want to repeat the horror story of what I experienced
a while back when another encrypted LVM got made inaccessible
(it's on another drive, and I hope to find time some day to
see if there's any way to recover it - it happened in the
installation of the Debian system - on the new drive, which
shouldn't have touched the other drive - but, again, that's
another story). So I want to think long and hard before I
risk installing anything on this drive - especially Windoze!

Last edited by linluvr; 06-11-2011 at 06:46 AM.
 
Old 06-11-2011, 06:40 AM   #6
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Quote:
Originally Posted by linluvr View Post
I should also mention that parted doesn't see a filesystem on
the partition, but maybe it's because it's also looking for some
sort of Linux filesystem, due to the Id of 83:

> (parted) check 2
> Error: Could not detect file system.

I'm surprised that parted doesn't even show the partition types.

Can someone tell me whether having that code set incorrectly is
enough to explain the facts as I've laid them out, including the
fact that I can't mount the partition using the fstab shown in
my original posting? I also tried "fsck" - which produced:

| # fsck.vfat /dev/sdb2
| dosfsck 3.0.1, 23 Nov 2008, FAT32, LFN
| Cluster size is zero.
I don't know if an incorrect code would cause what you're seeing.
I would tend to think that there is a problem with the filesystem
itself, and not with the metadata for the partition. Once you
have a good backup, you could try changing the code and see if
that makes any difference.

The next thing I would do is create a writeable copy and try
some filesystem recovery tools on it. If you find something
that works on the copy, try running the same on the real
partition.
 
Old 06-11-2011, 06:43 AM   #7
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
Quote:
Originally Posted by linluvr View Post
So the next question is whether using parted to create a new filesystem
on that partition should take care of the incorrect ID code.
I believe that it will. You can always verify that it has the right
code using fdisk. I would just update the code using fdisk before
running parted.
 
Old 06-11-2011, 06:56 AM   #8
linluvr
LQ Newbie
 
Registered: Dec 2005
Distribution: Linux Mint 9
Posts: 10

Original Poster
Rep: Reputation: Disabled
Talking

Quote:
Originally Posted by carltm View Post
...I would just update the code using fdisk before
running parted.
I would too, Carl, but if I could do so, I wouldn't have had to post
my query to this forum! :-)

The trouble is that fdisk complains about the partition lacking a
volume ID, as is indicated in my initial posting above:

| Command (m for help): l
| System types for this disk label type are not available.

That's why I'm hoping the code will get set by parted when it
creates a new FAT32 filesystem in the partition.

BTW, googling for the "System types..." message gets only
three hits - two to the source code for fdisk and one in
Chinese! I'm surprised no one else has encountered this
error message and asked about it somewhere or other.

Last edited by linluvr; 06-11-2011 at 06:58 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
openSolaris hosed the partition table. Why? Changing primary to secondary partition? JZL240I-U Solaris / OpenSolaris 9 10-16-2008 10:48 AM
Adjust partition table (end cylinder) after disk change. noisebleed Linux - General 3 12-30-2007 04:39 PM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM
Linux Partition Table Editor - Need to change "Hidden Sectors" value Ouch_Taser Linux - Newbie 3 02-11-2004 10:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:35 AM.

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