Membagi Partisi USB Flashdisk

Ada kondisi/kebutuhan di mana kita perlu membagi partisi flashdisk menjadi beberapa bagian, contohnya: saya membutuhkan 3 partisi untuk digunakan usb.storage pada OpenWrt.
sda1 – swap – 100MB
sda2 – system – 100MB (Ext2)
sda3 – data – ~MB sisanya (Ext3)

CLI pada Linux:

gatoti@bunglon:/dev> su
Password:
bunglon:/dev # fdisk /dev/sdb

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
m   print this menu
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
x   extra functionality (experts only)

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   83  Linux

Command (m for help): d
Selected partition 1

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): 1
First sector (2048-15644911, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15644911, default 15644911): +150M

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 (309248-15644911, default 309248):
Using default value 309248
Last sector, +sectors or +size{K,M,G} (309248-15644911, default 15644911): +150M

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 (616448-15644911, default 616448):
Using default value 616448
Last sector, +sectors or +size{K,M,G} (616448-15644911, default 15644911):
Using default value 15644911

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      309247      153600   83  Linux
/dev/sdb2          309248      616447      153600   83  Linux
/dev/sdb3          616448    15644911     7514232   83  Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
bunglon:/dev # mkswap -L satu /dev/sdb1
Setting up swapspace version 1, size = 153596 KiB
LABEL=satu, UUID=89e7ed6b-d636-41a5-b4cd-8823902befb5
bunglon:/dev # mkfs.ext2 -L dua /dev/sdb2
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=dua
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
38456 inodes, 153600 blocks
7680 blocks (5.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

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

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
bunglon:/dev # mkfs.ext3 -L tiga /dev/sdb3
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=tiga
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
470496 inodes, 1878558 blocks
93927 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1925185536
58 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

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

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
bunglon:/dev # exit
gatoti@bunglon:/dev>

Minitool Partition pada Windows

Pada contoh ini, USB Flashdisk ter-detect pada Disk 2:

  • Klik kanan pada partisi pertama (8GB) –> Delete
  • Klik kanan pada Unallocated Partition –> Create
  • Resize partisi menjadi 100MB –> Create as: Primary –> File System: Linux Swap –> OK
  • Klik kanan pada Unallocated Partition — > Create
  • Resize partisi menjadi 100MB –> Create as: Primary –> File System: Ext2 –> OK
  • Klik kanan pada Unallocated Partition –> Create
  • Dengan ukuran sisanya –> Create as: Primary –> File System: Ext3 –> OK
  • Lalu pada main window klik icon Apply