Linux (Ubuntu) partition and format SD card __linux

Source: Internet
Author: User
Tags hex code
My cell phone SD card needs to be divided into two partitions, under the WINDOWXP.
The main problem is that Windows only knows the first partition of the SD card.
Someone used to modify the driver, let Windows recognize SD card as Hitachi's Microdisk, partition and format can also be completed. But in my notebook, the SD card reader is brought by the notebook, not connected to the USB interface, this method is not workable.

Under Linux to partition the SD card, formatting is very easy.
The system I installed is ubuntu10.04.
When the SD card is plugged in, it automatically mount.
So, the first step, Umount.
Enter your own password to obtain root permissions.
# mount
You can see the last line of the device number
/dev/mmcblk0 on/media/60c5-3ec0 type VFAT (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask= 0077,utf8=1,flush)
Umount this SD card
# umount/dev/mmcblk0
The next game is the Fdisk tool.
# fdisk/dev/mmcblk0
The Fdisk command is very simple.
Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off "mode" (Command ' C ') and change display units to
Sectors (Command ' u ').

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)
First p, look at the SD card partition status.
Then D, delete the original partition
n, creating a partition

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
Partition number (1-4): 1
Cylinder (1-62528, default 1): 1
Last cylinder, +cylinders or +size{k,m,g} (1-62528, default 62528): +1500m

T, specify the partition type,
Command (M for help): t
Selected partition 1
Hex code (type L to list codes): L

0 Empty NEC DOS bayi minix/old Lin BF Solaris
1 FAT12 9 swap/so Linux C1 drdos/sec (fat-
2 Xenix root 3c partitionmagic c4 drdos/sec (fat-
3 Xenix usr Venix 80286 os/2 hidden c:c6 drdos/sec (fat-
4 FAT16 <32m PPC PReP Boot Linux Extended C7 Syrinx
5 Extended SFS NTFS volume set da non-fs data
6 FAT16 4d qnx4.x NTFS Volume set db cp/m/CTOs/.
7 Hpfs/ntfs 4e qnx4.x 2nd part Linux plaintext de Dell Utility
8 AIX 4f qnx4.x 3rd part 8e Linux LVM DF bootit
9 AIX bootable Ontrack DM Amoeba E1 DOS Access
A os/2 Boot manag wuyi ontrack DM6 Aux Amoeba BBT e3 DOS r/o
b W95 FAT32 cp/m 9f bsd/os e4 speedstor
C W95 FAT32 (LBA) Ontrack DM6 Aux A0 IBM Thinkpad hi EB BeOS FS
E W95 FAT16 (LBA) OnTrackDM6 a5 FreeBSD ee GPT
F W95 Ext ' d (LBA) ez-drive a6 OpenBSD ef EFI (fat-12/16/
OPUS Golden Bow A7 NeXTSTEP f0 linux/pa-risc b
One Hidden FAT12 5c Priam edisk A8 Darwin UFS F1 SpeedStor
Compaq diagnost speedstor A9 NetBSD f4 SpeedStor
Hidden FAT16 <3 The GNU HURD or Sys ab Darwin boot F2 DOS Secondary
Hidden FAT16 Novell Netware af hfs/hfs+ fb VMware VMFS
Hidden hpfs/ntf Novell Netware b7 BSDI FS FC VMware Vmkcore
The AST smartsleep disksecure mult b8 bsdi swap fd Linux RAID auto
1b Hidden W95 FAT3 pc/ix bb Boot Wizard hid Fe lanstep
1c Hidden W95 FAT3 Minix be Solaris boot ff BBT
1e Hidden W95 FAT1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)

This gives you the first partition and specifies the partition as FAT16.
The second one, I try to do partitioning for Linux partitions

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
Partition number (1-4): 2
The cylinder (48002-62528, default 48002):
Using Default Value 48002
Last cylinder, +cylinders or +size{k,m,g} (48002-62528, default 62528):
Using Default Value 62528

Command (M for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 83

Well, look at the results.

Command (M for help): P

disk/dev/mmcblk0:2048 MB, 2048917504 bytes
4 heads, Sectors/track, 62528 cylinders
Units = Cylinders of 32768 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x6f20736b

Device Boot Start End Blocks Id System
/DEV/MMCBLK0P1 1 48001 1536024 6 FAT16
/DEV/MMCBLK0P2 48002 62528 464864 Linux

OK, write the partition information to disk.

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 to the Fdisk manual page for additional
Syncing disks.

The formatting begins below.
First, the FAT16 partition.
Then the Linux partition
#mkfs. ext3/dev/mmcblk0p2

After the completion, take out the SD card, and then install it, the Linux system has automatically identified two partitions, you can use.
Put it in the phone.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.