如何使用adb 修改分区

如何使用adb 修改分区,第1张

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 recoverya6 OpenBSD

6 FAT16 41 PPC PReP Boot a8 Darwin UFS

7 HPFS/NTFS 42 SFSa9 NetBSD

a OS/2 Boot Manager 63 GNU HURD or SysV ab Darwin boot

b Win95 FAT3280 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 setf0 Linux/PA-RISC boot

16 Hidden FAT16 87 NTFS volume setf2 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

FilesystemSize Used Available Use% Mounted on

tmpfs 153.4M 32.0K153.4M 0% /dev

tmpfs 153.4M 0153.4M 0% /mnt/asec

tmpfs 153.4M 0153.4M 0% /mnt/obb

/dev/block/system 504.4M257.9M246.5M 51% /system

/dev/block/data 504.4M 57.7M446.7M 11% /data

/dev/block/cache252.1M 4.3M247.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.5M435.2G 0% /mnt/sata

出来啦,激动吧!

看adb使用说明刷。

解锁手机,解锁BL还是之前的 *** 作,使用常规的解锁命令fastbootoemunlock。

刷入ROOT权限或者刷入TWRP_recovery中文版,其实两者都是一样的,具体选择哪一个看自己喜好。

使用ADB命令刷入persist分区,首先我们把下载的persist分区文件放到手机内部存储,再输入以下命令回车修复文件下载。

1、进入shell模式,执行adb shell 进入

2、执行mount 命令

命令格式:

mount [-t vfstype] [-o options] device dir

其中:

1.-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。常用类型有:

光盘或光盘镜像:iso9660

DOS fat16文件系统:msdos

Windows 9x fat32文件系统:vfat

Windows NT ntfs文件系统:ntfs

Mount Windows文件网络共享:smbfs

UNIX(LINUX) 文件网络共享:nfs

2.-o options 主要用来描述设备或档案的挂接方式。常用的参数有:

loop:用来把一个文件当成硬盘分区挂接上系统

ro:采用只读方式挂接设备

rw:采用读写方式挂接设备

iocharset:指定访问文件系统所用字符集

3.device 要挂接(mount)的设备。

4.dir设备在系统上的挂接点(mount point)。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/bake/11637960.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存