A20 adb shell命令实现硬盘分区
1'输入busybox fdisk /dev/block/sda ;
2'在Command (m for help):后输入m,查看帮助;
Command (m for help): m
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
x extra functionality (experts only)
3'输入查看p,若如果之前用过就会有显示,
Command (m for help): p
p
Disk /dev/block/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
4'选择删除d,
Command (m for help): d
d
No partition is defined yet!
5'新建分区n,
Command (m for help): n
n
Command action
e extended
p primary partition (1-4)
6'选择p,
P
P
Partition number (1-4):
7'选择分区的数目,我选择1,
Partition number (1-4): 1
1
First cylinder (1-60801, default 1):
8‘ 直接回车(主分区的起始位置);默认为1,默认就好;
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
9’这个是定义分区大小的,+499000M 就是大小为+499000M ;当然您也可以根据p提示的单位cylinder的大小来算,然后来指定 End的数值。回头看看是怎么算的;还是用+499000M这个办法来添加,这样能直观一点。我硬盘是500G,所以就是499G,如果您想添加一个10G左右大小的分区,请输入 +10000M ;
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801): +499000M
+499000M
10‘通过t来指定分区类型t;
Command (m for help): t
t
Selected partition 1
Hex code (type L to list codes):
11'在这里输入L,就可以查看分区类型的id了
Hex code (type L to list codes): L
L
0 Empty 1b Hidden Win95 FAT32 9f BSD/OS
1 FAT12 1c Hidden W95 FAT32 (LBA) a0 Thinkpad hibernation
4 FAT16 <32M 1e Hidden W95 FAT16 (LBA) a5 FreeBSD
5 Extended 3c Part.Magic recovery a6 OpenBSD
6 FAT16 41 PPC PReP Boot a8 Darwin UFS
7 HPFS/NTFS 42 SFS a9 NetBSD
a OS/2 Boot Manager 63 GNU HURD or SysV ab Darwin boot
b Win95 FAT32 80 Old Minix b7 BSDI fs
c Win95 FAT32 (LBA) 81 Minix / old Linux b8 BSDI swap
e Win95 FAT16 (LBA) 82 Linux swap be Solaris boot
f Win95 Ext'd (LBA) 83 Linux eb BeOS fs
11 Hidden FAT12 84 OS/2 hidden C: drive ee EFI GPT
12 Compaq diagnostics 85 Linux extended ef EFI (FAT-12/16/32)
14 Hidden FAT16 <32M 86 NTFS volume set f0 Linux/PA-RISC boot
16 Hidden FAT16 87 NTFS volume set f2 DOS secondary
17 Hidden HPFS/NTFS 8e Linux LVM fd Linux raid autodetect
Hex code (type L to list codes):
12'选择83,
Hex code (type L to list codes): 83
83
14’在看一下p
Command (m for help): p
p
Disk /dev/block/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/sda1 1 60668 487315678+ 83 Linux
确实出来啦!
15‘创建w
Command (m for help): w
w
The partition table has been altered!
Calling ioctl() to re-read partition table
16’对分区进行格式化,以及加载;
输入busybox mkfs.ext2 /dev/block/sda
root@android :/ # busybox mkfs.ext2 /dev/block/sda
busybox mkfs.ext2 /dev/block/sda
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
30531584 inodes, 122096646 blocks
6104832 blocks (5%) reserved for the super user
First data block=0
Maximum filesystem blocks=125829120
3727 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000
...........
(需要注意如果之前mount过,一定要Umount掉 --busybox unmount /dev/block/sda否则会出错
busybox mkfs.ext2 /dev/block/sda
mkfs.ext2: can't format mounted filesystem)
17‘挂载mount -t ext2 /dev/block/sda /mnt/sata
OK ,buysybox df -h一下 :
root@android :/ # busybox df -h
busybox df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 153.4M 32.0K 153.4M 0% /dev
tmpfs 153.4M 0 153.4M 0% /mnt/asec
tmpfs 153.4M 0 153.4M 0% /mnt/obb
/dev/block/system 504.4M 257.9M 246.5M 51% /system
/dev/block/data 504.4M 57.7M 446.7M 11% /data
/dev/block/cache 252.1M 4.3M 247.8M 2% /cache
/dev/block/vold/93:72
2.1G 48.0K 2.1G 0% /mnt/sdcard
/dev/block/vold/93:72
2.1G 48.0K 2.1G 0% /mnt/secure/asec
/dev/block/sda 458.5G 62.5M 435.2G 0% /mnt/sata
出来啦,激动吧!