Wednesday, February 17, 2010

SD partitions

Here is a SD card with one Fat32 partition and another one ext2 partition.
Windows 5.x machine reports only about the first Fat32 and of course does not recognize the ext2. Using an utility called dskwipe, we can see the list of partitions as Window sees them:

C:\>dskwipe.exe -l
one of the lines will be the SD device name (0 here - the whole device, 1 - the first partition):
\Device\Harddisk1\Partition0

To access to the ext2 partition from CoLinux running atop the Windows we need to do the following:
  1. Add to the colinux.conf the following line
    cobd1="\Device\Harddisk1\Partition0"
  2. Load CoLinux and run fdisk /dev/cobd1
  3. Press 'u' to switch to block counting mode
  4. Press 'p' to output the partitions
  5. Write down the starting point of the ext2 partition multiplied by 512, say it will be 17754534912
  6. Setup a loop device:
    losetup -o 17754534912 /dev/loop1 /dev/cobd1
  7. Check the file system integrity:
    e2fsck /dev/loop1
  8. Mount the partition:
    mount /dev/loop1 /media/sd_ext2