Copying boot sdcard
From WikiWiki
[edit] Copying SD Boot disc to larger device
The following sequence was supplied by Eddie at Technologic Systems. I've followed these instructions to successfully copy the 256MB SD card I purchased with my system to a 1GB SD card.
These commands are executed with the existing SD card in the default location (CPU Side) and the new SD card in the second slot (Altera FPGA side).
Below is the procedure to install Debian on an SD card that is larger the 256 MB. I booted off a 256MB SD card in the sdcard0 slot and placed an empty 512MB(any size larger than 256MB should work) SD card in the sdcard1 slot.
Below is the procedure to install Linux on a card larger than 256MB.
1.) Copy the contents of the SD card we booted from to the blank SD card.
dd if=/dev/sdcard0/disc0/disc of=/dev/sdcard1/disc0/disc bs=1M
Delete the third partition on the new SD card, then recreate it so it uses the entire disk (I attached my fdisk session below).
root@ts7000:root# fdisk /dev/sdcard1/disc0/disc
The number of cylinders for this disk is set to 1935.
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/sdcard1/disc0/disc: 507 MB, 507379712 bytes
16 heads, 32 sectors/track, 1935 cylinders
Units cylinders of 512 * 512 262144 bytes
Device Boot Start End Blocks Id System
/dev/sdcard1/disc0/part1 * 1 4 974+ da Non-FS data
/dev/sdcard1/disc0/part2 5 8 1024 da Non-FS data
/dev/sdcard1/disc0/part3 9 965 244992 83 Linux
Command (m for help): d
Partition number (1-4): 3
Command (m for help): p
Disk /dev/sdcard1/disc0/disc: 507 MB, 507379712 bytes
16 heads, 32 sectors/track, 1935 cylinders
Units cylinders of 512 * 512 262144 bytes
Device Boot Start End Blocks Id System
/dev/sdcard1/disc0/part1 * 1 4 974+ da Non-FS data
/dev/sdcard1/disc0/part2 5 8 1024 da Non-FS data
While copying current (as of now, May 2007) 512MB cards provided with TS-7300, these instructions are not complete. When you are re-creating part3, do not use the default starting cylinder (11) the "fdisk" suggests, but change it to "20" instead. Otherwise the "e2fsck" will complain about missing superblock. For more info, see; <http://tech.groups.yahoo.com/group/ts-7000/message/4879>
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (9-1935, default 9):<RETURN>
Using default value 9
Last cylinder or +size or +sizeM or +sizeK (9-1935, default 1935):<RETURN>
Using default value 1935 - Value depends on size of card.
Command (m for help): p
Disk /dev/sdcard1/disc0/disc: 507 MB, 507379712 bytes
16 heads, 32 sectors/track, 1935 cylinders
Units cylinders of 512 * 512 262144 bytes
Device Boot Start End Blocks Id System
/dev/sdcard1/disc0/part1 * 1 4 974+ da Non-FS data
/dev/sdcard1/disc0/part2 5 8 1024 da Non-FS data
/dev/sdcard1/disc0/part3 9 1935 493312 83 Linux
Command (m for help): w
The partition table has been altered
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
root@ts7000:root#
3.) Reboot to get the new partition table into the kernel.
shutdown -r now
4.) Run a disk check on the third partition then resize the filesystem to use the entire partition.
e2fsck -f /dev/sdcard1/disc0/part3 resize2fs /dev/sdcard1/disc0/part3
5.) Shutdown the board and swap card to verify your new card can boot properly.
You should now have a fully functional copy of the original card on a larger device...
PS. While copying current (as of now, May 2007) 512MB cards provided with TS-7300, these instructions are not complete. When you are re-creating part3, do not use the default starting cylinder (11) the "fdisk" suggests, but change it to "20" instead. Otherwise the "e2fsck" will complain about missing superblock. For more info, see; <http://tech.groups.yahoo.com/group/ts-7000/message/4879>
