Aligning my sdcard-Sibere’s method

From a ‘mount’, I find that my card is mounted as /dev/sdc1 and /dev/sdc2 (I had Fat32 and ext4).

First, do a umount of both partitions.
Then,

Code:

sudo fdisk -H64 -S32 /dev/sdc

Disk /dev/sdc: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x0000777d

Device Boot      Start         End      Blocks   Id  System

I’d like to have 1.3 GB for ext4

1048576 bytes=1cylinder

i.e 1024 KB or 1 MB = 1 cylinder

1.3 GB=1.3 x 1024 MB, or 1331.2 MB

So, 1.3 GB=1331.2 cylinders->1332 cylinders for Ext4

Since Fat32 is partitioned first, we calculate the remainder for Fat32

Total Cylinders=15193 (From the fdisk report shown above)

Cylinders for Ext4=1332

Cylinders for Fat32=15193-1332=13861 cylinders.

Since we leave 1st cylinder reserved, that leaves us 13860 cylinders for Fat32
Code:

[email protected]:~$ sudo fdisk -H64 -S32 /dev/sdc

The number of cylinders for this disk is set to 15193.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdc: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x0000777d

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               2       14131    14469120    b  W95 FAT32
Partition 1 does not end on cylinder boundary.
/dev/sdc2           14132       15193     1087488   83  Linux
Partition 2 does not end on cylinder boundary.

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

Command (m for help): p

Disk /dev/sdc: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x0000777d

Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15193, default 1): 2
Last cylinder, +cylinders or +size{K,M,G} (2-15193, default 15193): 13860

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-15193, default 1): 13861
Last cylinder, +cylinders or +size{K,M,G} (13861-15193, default 15193):
Using default value 15193

Command (m for help): p

Disk /dev/sdc: 15.9 GB, 15931539456 bytes
64 heads, 32 sectors/track, 15193 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x0000777d

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               2       13860    14191616    c  W95 FAT32 (LBA)
/dev/sdc2           13861       15193     1364992   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

Formatting Fat32
Code:

[email protected]:~$ sudo mkfs.vfat -F 32 -n UserData -s 32 -v /dev/sdc1
mkfs.vfat 3.0.1 (23 Nov 2008)
/dev/sdc1 has 64 heads and 32 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 28383232 sectors;
file system has 2 32-bit FATs and 32 sectors per cluster.
FAT size is 6927 sectors, and provides 886542 clusters.
Volume ID is cb3d9be7, volume label UserData   .
[email protected]:~$

Formatting ext4 for Data2SD

[email protected]:~$ sudo mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O extent,^huge_file -m 0 -L userdata /dev/sdc2
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=userdata
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
85360 inodes, 341248 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=352321536
11 block groups
32768 blocks per group, 32768 fragments per group
7760 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Finally I run a disk check on the ext4 partition since it had been giving me errors:

e2fsck -pfcv /dev/sdd2

 

Other useful syntax reference:

Mounting Fat32:

sudo mkdir /fat32  // Any mount point will do

mount -t vfat /dev/hdd1 /fat32

 

Mounting the ext4 partition

sudo mkdir /ext4

mount -t ext4 -o noatime,nodiratime,nosuid,nodev,nobh,nouser_xattr /dev/block/mmcblk0p2 /data