歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> SHELL編程

A20 adb shell命令實現硬盤分區

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   出來啦,激動吧!
Copyright © Linux教程網 All Rights Reserved