imx6q nand flash use fdisk can't partition:rereading partition table failed, kernel still uses old table: Invalid argument

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx6q nand flash use fdisk can't partition:rereading partition table failed, kernel still uses old table: Invalid argument

1,563 Views
alexjiang
Contributor II

Platform:IMX6Q.

ISSUE: boot from SD card, "fdisk -l "can find nand flash.but when i use "fdisk /dev/mtdblock0" to partition nand flash, it's fail. log: fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument

do you have any idea of the issue?

log:

root@imx6qsabresd:/dev# fdisk -l

Disk /dev/mtdblock0: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/mtdblock0 doesn't contain a valid partition table

Disk /dev/mmcblk1: 32.0 GB, 32010928128 bytes
4 heads, 16 sectors/track, 976896 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

Device Boot Start End Blocks Id System
/dev/mmcblk1p1 321 16001 501760+ 83 Linux
Partition 1 does not end on cylinder boundary
/dev/mmcblk1p2 19201 976896 30646272 83 Linux
Partition 2 does not end on cylinder boundary
root@imx6qsabresd:/dev# fdisk /dev/mtdblock0
Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won't be recoverable.


Command (m for help): m
Command Action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit

Command (m for help): o
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won't be recoverable.


Command (m for help): p

Disk /dev/mtdblock0: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): Using default value 130

Command (m for help): p

Disk /dev/mtdblock0: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/mtdblock0p1 1 130 1044193+ 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Invalid argument
root@imx6qsabresd:/dev# mkfs.ext4 /dev/mtd
mtd0 mtd0ro mtdblock0
root@imx6qsabresd:/dev# mkfs.ext4 /dev/mtdblock0p1
mke2fs 1.42.9 (28-Dec-2013)
Could not stat /dev/mtdblock0p1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?

Labels (2)
0 Kudos
1 Reply

1,261 Views
igorpadykov
NXP Employee
NXP Employee

Hi Alex

usually fdisk is used for sd/mmc, difference with nand is described in

embedded - Nand partitioning in u-boot - Stack Overflow 

In linux NAND flash partitions are created in the board file, also

"mtdparts" parameter can be used in the Linux boot command as described

in sect.4.6 Flash memory maps attached Linux Guide.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos