LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fdisk shows wrong partition type (https://www.linuxquestions.org/questions/linux-newbie-8/fdisk-shows-wrong-partition-type-4175452852/)

BlackTornado 03-05-2013 05:28 PM

fdisk shows wrong partition type
 
Hello

I just formatted a disk from terminal: I deleted the old partitions, created the new ones and saved the changes.

In the end, I got the following warning, which I guess is pretty normal:

Quote:

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
To be sure, I rebooted and I've been able to format the disk with mkfs.ext4, apparently without any problem, since the disk mounts correctly as ext4 and seems to work fine.

What bothers me is this:
Code:

root@Sheevaplug:~# fdisk -l /dev/sda1

Disk /dev/sda1: 1500.3 GB, 1500299395072 bytes
4 heads, 2 sectors/track, 366284032 cylinders, total 2930272256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb7bfec12

    Device Boot      Start        End      Blocks  Id  System
/dev/sda1p1            2048  2930272255  1465135104  83  Linux
root@Sheevaplug:~# fdisk /dev/sda1

Command (m for help): p

Disk /dev/sda1: 1500.3 GB, 1500299395072 bytes
4 heads, 2 sectors/track, 366284032 cylinders, total 2930272256 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb7bfec12

    Device Boot      Start        End      Blocks  Id  System
/dev/sda1p1            2048  2930272255  1465135104  83  Linux

Command (m for help): q

For some reason, fdisk -l still shows the old file system, while printing the partition table shows the correct one.

I guess is because the kernel doesn't use the new partition table, but rebooting didn't help and neither did giving partprobe. If I give partprobe /dev/sda1, I get this:
Code:

root@Sheevaplug:~# partprobe /dev/sda1
Error: Error informing the kernel about modifications to partition /dev/sda1p1 -- Invalid argument.  This means Linux won't know about any changes you made to /dev/sda1p1 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Error: Failed to add partition 1 (Invalid argument)

If I run partprobe without arguments, it doesn't give any error, but still doesn't solve the problem.

What is wrong?
The system is actually an external hard drive connected through eSata and no operative systems are on it.

michaelk 03-05-2013 06:01 PM

Basically you created a partition table on the first partition /dev/sda1p1 vs the MBR. When using fdisk make sure you use the drive device ID i.e. /dev/sda vs /dev/sda1.

Since you just formatted the drive you can recreate the partition table on the MBR and reformat sda1.

syg00 03-06-2013 02:17 AM

Unless you have been particularly diligent in building /dev/sda1 (the partition) as a block device, none of the above commands are valid.

Try
Code:

fdisk /dev/sda
partprobe /dev/sda


BlackTornado 03-06-2013 02:39 AM

using fdisk on /dev/sda made everything work like a charm.
Thank you!


All times are GMT -5. The time now is 06:53 AM.