Format FlashDisk untuk Extroot pada OpenWrt – Backfire 10.03.1

Setelah sebelumnya router TL-WR741ND saya mengalami beberapa kali  error, dan anehnya, saya selalu lupa untuk mencatat pesan error-nya (dmesg), keburu main reboot ajah🙂 Tapi kira-kira yang saya pahami adalah extroot pada USB Flashdisk dengan file system Ext3 yang bermasalah dengan journaling-nya. Saya coba browsing sana-sini, dan saya menemukan salah satu tutorial bagaimana mem-format flashdisk/microsd dengan OpenWrt, fs-Ext2 (non-journaling) diubah ke fs-Ext4. Tapi pada tutorial ini saya praktekkan di mesin OpenSuSE.

Bagi yang memerlukan firmwarre mod OpenWrt TP-LINK TL-WR741ND ver 1.x, bisa diambil di:

https://drive.google.com/folderview?id=0B1Aj8bC-AJMKb0xtVjFuMkpmR0k&usp=sharing

Flashdisk yang akan saya jadikan extroot, saya bagi menjadi 3 partisi:
1. Swap — 100MB
2. Extroot — 150MB (Ext4) –> Ext2 diubah jadi Ext4
3. Data — ~ sisanya (Ext4) –> Ext2 diubah jadi Ext4

Berikut langkah-langkahnya:
1. Hapus partisi USB Flashdisk

bunglon:/dev # fdisk /dev/sdb
Welcome to fdisk (util-linux 2.21.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p

Disk /dev/sdb: 8010 MB, 8010194944 bytes
151 heads, 18 sectors/track, 5756 cylinders, total 15644912 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: 0x575d702e

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    15644911     7821432    b  W95 FAT32

Command (m for help): d
Selected partition 1
Partition 1 is deleted

2. Buat partisi swap

Command (m for help): n
Partition type:
p   primary (0 primary, 0 extended, 4 free)
e   extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-15644911, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15644911, default 15644911): +100M
Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 82
Changed system type of partition 1 to 82 (Linux swap / Solaris)

3. Buat Partisi untuk Extroot

Command (m for help): n
Partition type:
p   primary (1 primary, 0 extended, 3 free)
e   extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (206848-15644911, default 206848):
Using default value 206848
Last sector, +sectors or +size{K,M,G} (206848-15644911, default 15644911): +150M
Partition 2 of type Linux and of size 150 MiB is set

4. Buat partisi data

Command (m for help): n
Partition type:
p   primary (2 primary, 0 extended, 2 free)
e   extended
Select (default p): p
Partition number (1-4, default 3):
Using default value 3
First sector (514048-15644911, default 514048):
Using default value 514048
Last sector, +sectors or +size{K,M,G} (514048-15644911, default 15644911):
Using default value 15644911
Partition 3 of type Linux and of size 7.2 GiB is set

5. Cek partisi

Command (m for help): p

Disk /dev/sdb: 8010 MB, 8010194944 bytes
247 heads, 62 sectors/track, 1021 cylinders, total 15644912 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: 0x575d702e

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      206847      102400   82  Linux swap / Solaris
/dev/sdb2          206848      514047      153600   83  Linux
/dev/sdb3          514048    15644911     7565432   83  Linux

6. Save and exit (dari fdisk)

Command (m for help): w
The partition table has been altered!

7. Format partisi 1 untuk swap

bunglon:/dev # mkswap -L satu /dev/sdb1
Setting up swapspace version 1, size = 102396 KiB
LABEL=satu, UUID=078830af-e056-4466-8fe6-11ef9014d616

8. Format partisi 2 untuk extroot

bunglon:/dev # mke2fs -m 0 /dev/sdb2
mke2fs 1.42.4 (12-June-2012)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
38456 inodes, 153600 blocks
0 blocks (0.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
19 block groups
8192 blocks per group, 8192 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

9. Format partisi 3 untuk data

bunglon:/dev # mke2fs -m 0 /dev/sdb3
mke2fs 1.42.4 (12-June-2012)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
473280 inodes, 1891358 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1937768448
58 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

10. Cek file system

bunglon:/dev # blkid
/dev/sdb1: LABEL="satu" UUID="078830af-e056-4466-8fe6-11ef9014d616" TYPE="swap"
/dev/sdb2: UUID="b3d37d51-6a85-45c7-8f2a-5b1d6c736a25" TYPE="ext2"
/dev/sdb3: UUID="02720b23-7fe4-45ec-a2ff-7fc3099108d7" TYPE="ext2"

11. Merubah file system Ext2 ke Ext4

bunglon:/dev # tune2fs -O extent,uninit_bg,dir_index,^has_journal -L dua /dev/sdb2
tune2fs 1.42.4 (12-June-2012)
Creating journal inode: done
bunglon:/dev # tune2fs -O extent,uninit_bg,dir_index,^has_journal -L tiga /dev/sdb3
tune2fs 1.42.4 (12-June-2012)
Creating journal inode: done

12. Cek file system

bunglon:/dev # blkid
/dev/sdb1: LABEL="satu" UUID="078830af-e056-4466-8fe6-11ef9014d616" TYPE="swap"
/dev/sdb2: LABEL="dua" UUID="b3d37d51-6a85-45c7-8f2a-5b1d6c736a25" TYPE="ext4"
/dev/sdb3: LABEL="tiga" UUID="02720b23-7fe4-45ec-a2ff-7fc3099108d7" TYPE="ext4"

Untuk penjelasan penggunaan opsi-opsi pada perintah fdisk, mke2fs, tune2fs, silahken merujuk pada man-page pada masing-masing perintah tersebut. Dan selanjutnya bisa langsung pada tahap extroot, dan disesuaikan pada kebutuhan.

Catatan:
Cara/tutorial ini baru saya coba selama 1 bulan ini, dan belum ada masalah lagi, jadi masih tahap uji coba sampai beberapa waktu ke depan.

Referensi:
https://www.facebook.com/groups/openwrt/doc/383993888308308/