Pages

Get it free, Try now

Free Cell Phones

Friday, November 19, 2010

Android - Manual SD Card partions vfat and ext2

we will first check if there are any partitions on the sdcard,if there any we will set it to unpartitioned state...
below steps are command base you may use the GUI software Gparted to do the same.

Disclaimer: I AM NOT RESPONSIBLE FOR WHAT YOU DO WITH YOUR DEVICE


1. Read the sdcard partions(shows devices connected)
#cat /proc/partitions
major minor #blocks name


8 0 156290904 sda
8 1 102400 sda1
8 2 104985600 sda2
8 32 312571224 sdc
8 33 226298554 sdc1
8 34 1 sdc2
8 37 82715648 sdc5
8 38 3555328 sdc6
8 16 488386584 sdb
8 17 102398278 sdb1
8 18 1 sdb2
8 21 20482843 sdb5
8 48 1921024 sdd // see some hardware connected
8 49 1920000 sdd1 // ID of the HW

2. Very again, if they are mounted using mount command and we see that there is a Linux partition of type ext2
# mount
blah ...
....
/dev/sdd1 on /media/61de92d5-99ae-48e7-9c14-0fa3f86c2d93 type ext2 (rw,nosuid,nodev,uhelper=udisks)

3. unmount the drive
# umount /dev/sdd1
#

4.Now we will remove the already available partitions and create two new partition of type FAT32 and ext2. follow the warning from command to get rid any unknown issues



#fdisk /dev/sdd

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

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/sdd: 1967 MB, 1967128576 bytes
54 heads, 32 sectors/track, 2223 cylinders, total 3842048 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: 0x00026cc2

Device Boot Start End Blocks Id System
/dev/sdd1 * 2048 3842047 1920000 83 Linux

Command (m for help): d // delete 1st partition
Selected partition 1

ommand (m for help): n // type n for new partition
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (32-3842047, default 32):
Using default value 32 // 1st partition starts after 32 till 3842047
Last sector, +sectors or +size{K,M,G} (32-3842047, default 3842047): 2000000 // we use only half of the value

Command (m for help): p

Disk /dev/sdd: 1967 MB, 1967128576 bytes
54 heads, 32 sectors/track, 2223 cylinders, total 3842048 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: 0x00026cc2

Device Boot Start End Blocks Id System
/dev/sdd1 * 32 2000000 999984+ c W95 FAT32 (LBA)

Command (m for help): t // change type of partitions
Selected partition 1 // apply for 1st partition
Hex code (type L to list codes): 83 // 83 corresponds to Linux id
Changed system type of partition 1 to 83 (Linux)

Command (m for help): p // type p, shall results in partition of type Linux

Disk /dev/sdd: 1967 MB, 1967128576 bytes
54 heads, 32 sectors/track, 2223 cylinders, total 3842048 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: 0x00026cc2

Device Boot Start End Blocks Id System
/dev/sdd1 * 32 2000000 999984+ 83 Linux
//repeat steps to create new partions
//
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2 // 2nd partition
First sector (2000001-3842047, default 2000001):
Using default value 2000001 // allocation start here and ends at 3842047
Last sector, +sectors or +size{K,M,G} (2000001-3842047, default 3842047):
Using default value 3842047

Command (m for help): p

Disk /dev/sdd: 1967 MB, 1967128576 bytes
54 heads, 32 sectors/track, 2223 cylinders, total 3842048 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: 0x00026cc2

Device Boot Start End Blocks Id System
/dev/sdd1 * 32 2000000 999984+ 83 Linux
/dev/sdd2 2000001 3842047 921023+ 83 Linux

Command (m for help): t // type t to change 2nd partitio to windows type
Partition number (1-4): c // typeo err
Partition number (1-4): 2 //
Hex code (type L to list codes): c // ID for windows type
Changed system type of partition 2 to c (W95 FAT32 (LBA))

Command (m for help): p // type p

Disk /dev/sdd: 1967 MB, 1967128576 bytes
54 heads, 32 sectors/track, 2223 cylinders, total 3842048 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: 0x00026cc2

Device Boot Start End Blocks Id System
/dev/sdd1 * 32 2000000 999984+ 83 Linux
/dev/sdd2 2000001 3842047 921023+ c W95 FAT32 (LBA)

// finally, we created two partions 1st linux and 2nd windows
// now we need to write the table to disk and exit
// type w
Command (m for help): w
The partition table has been altered!


Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

~???#

now we need to format tables inthe disk, i;e make filesystem
#mkfs.vfat /dev/sdd2
mkfs.vfat /dev/sdd2
#
#root@br-desktop:/home/br# mkfs.ext2 /dev/sdd1
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
62592 inodes, 249996 blocks
12499 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
7824 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376


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

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
// now unplug and plugin the sdcard and type Mount on the terminal, shall show you this
#
#
#mount
....
...
/dev/sdd1 on /media/2b3f5798-9c5f-4ce3-8275-c7c987b0764c type ext2 (rw,nosuid,nodev,uhelper=udisks)
/dev/sdd2 on /media/79BF-0782 type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)

No comments:

Post a Comment