3

I had both the boot partition and the operating system partition of Raspbian on an 8GB SD-card, which I was using as a web server. After a few weeks, the SD card slowly died, and is now completely corrupted and unrecoverable.

How would I go about using a small SD card just for booting, then having the OS on a USB HDD? Can I just dd the boot partition to an sd card, and then similarly dd the root partition onto my USB HDD then resizing it to use the entire drive? Will I have to make any changes to the boot partition so it knows where to boot from?

I've searched around but can't find any good instructions, but if this is a dupe, please let me know and I'll close it.

2

2 (or 3) things:

Not an answer but a point - there could be reasons for the SD card corrupting. If the Pi has a unreliable power supply, or you shut it down by just pulling the plug on it, this could cause the SD card corruption. So could other factors, some which are listed here.

Another point - To repair the SD card, you should be able to use GParted on linux or a Live CD to check and repair the card. Using the check option generally seems to work, but might not work if it is seriously corrupted.

And finally, if you search you should be able to find lots of stuff: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=27&t=48021

1

None of the answers helped, so I'm self-answering here.

I dded the boot partition to a 1G SD card, and the root partition to a HDD. After fsck on both partitions and resize2fs on the HDD, all is working as expected.

­

To wilf, the SD card is entirely dead, I already checked, and it's full of bad blocks. The Pi has always been shut down correctly, and has never lost power.

To hildred, I thought it would be obvious from my question, but I'm doing this from another system since as I mentioned, the RPi was dead at the time, and I only had a backup.

0

dd probably would not work well because of different size media. the basic steps to do what you want are:

  1. partition disk: gpartd was mentioned and would work fine, but other tools are available including the classic fdisk.
  2. create filesystem: mkfs and friends. you probably want mkfs.ext3 to create an ext3 filesystem. ext2, ext4, riserfs, jfs, and xfs could also be used.
  3. mount new filesystem. the traditional place to for temporary mounts is /mnt but any empty directory will work.
  4. shut down all unnecessary processes: single user mode is recomended. (see the man page for shutdown)
  5. copy files: as superuser copy all files from the source file system to the target filesystem preserving all attriubutes (uid, times, etc.)
  6. if this is just part of a filesystem, you need to empty the target directory (rm -rf target/{,.??}, and skip next two steps.
  7. if this is a fliesystem other than root unmount the old file system, and skip next step
  8. for the root file system you need to either change your boot options, or your initrd, or use your existing root as an initrd and do a pivot root. the rest of these directions do not apply to this scenario.
  9. mount the new filesystem on the mountpoint
  10. edit your fstab to automaticly mount the new filesystem.
  11. restart
this answer was off the top of my head, so I probably missed something, or made some assumptions. let me know And I will fix them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.