0

I have rooted china N101-II tablet with CyanogenMod after flashing custom ROM.

Internal MTD storage is 32 GiB large and custom ROM flashing make different layout to internal partitioning. Thus /data near 12 GiB instead of original 1 GiB (so thera are no longer need to move packages to external flash!!):

130|root@android:/system # df
Filesystem               Size     Used     Free   Blksize
/system                595.4M   549.8M    45.6M   1024
/data                   11.8G   449.8M    11.4G   4096
/cache                 126M     4.1M   121.9M   4096

Rest space left to /mnt/sdcard:

root@android:/ # cat /system/etc/vold.fstab
dev_mount flash /mnt/sdcard auto /devices/virtual/mtd/mtd9/mtdblock9 nonremovable

but custom ROM flashing process left mtdblock9 unformatted.

Under PATH available commands: mkfs.ext2 and tune2fs so I can format myself.

mkfs.ext2 support:

130|root@android:/system # mkfs.ext2 --help
mkfs.ext2 --help
BusyBox v1.21.1-jb bionic (2013-07-01 01:04 +0200) multi-call binary.

Usage: mkfs.ext2 [-Fn] [-b BLK_SIZE] [-i INODE_RATIO] [-I INODE_SIZE] [-m RESERVED_PERCENT] [-L LABEL] BLOCKDEV [KBYTES]

        -b BLK_SIZE Block size, bytes

According to:

root@android:/ # cat /proc/mtd 
cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00400000 00004000 "misc"
mtd1: 00800000 00004000 "kernel"
mtd2: 01000000 00004000 "boot"
mtd3: 01000000 00004000 "recovery"
mtd4: 18000000 00004000 "backup"
mtd5: 08000000 00004000 "cache"
mtd6: 300000000 00004000 "userdata"
mtd7: 00400000 00004000 "kpanic"
mtd8: 28000000 00004000 "system"
mtd9: 46fa00000 00004000 "user"

seems that I need to select block size as 16384 (16KiB). Am I right?

UPDATE Seems that mkfs.ext2 from busybox and doesn't properly functioning:

android# mkfs.ext2 /dev/block/mtdblock9
mkfs.ext2: lseek: Value too large for defined data type

But I found mke2fs:

android# mke2fs -I 16384 /dev/block/mtdblock9
mke2fs 1.41.14 (22-Dec-2010)
mke2fs: invalid inode size 16384 (min 128/max 4096)

In order to reduce fragmentation I try to select larger block size (which make lesser amount of erase operation on flash I hope):

android# mke2fs -I 4096 /dev/block/mtdblock9
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1162128 inodes, 4651520 blocks
232576 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
142 block groups
32768 blocks per group, 32768 fragments per group
8184 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
0

I select largest possible block size for mke2fs to avoid block fractioning as erase operation on that MTD memory performed by 16 KiB chanks:

android# /sbin/mke2fs -t ext4 -I 4096 -O ^huge_file -m 0 /dev/block/mtdblock9
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1162128 inodes, 4651520 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
142 block groups
32768 blocks per group, 32768 fragments per group
8184 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

then:

android# tune2fs -c 0 -i 0 /dev/block/mtdblock9
tune2fs -c 0 -i 0 /dev/block/mtdblock9
tune2fs 1.41.14 (22-Dec-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

NOTE There is no need to format /data and /cache partitions. That can be done automatically in wipe data of recovery menu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.