Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have devices which use Compact Flash for storage. They work OK, but we recently got industrial-grade CF cards to start using.

One of the major problems we get is corruption on the flash card. As it is now, these flash cards run Debian with everything in a single partition. We want to have multiple partitions on the new industrial CF cards to help avoid some of the corruption problems.

I booted up the device, and attached a USB CF reader. I then used fdisk to partition the CF card in the USB reader.

How can I move the data to these partitions so that it works? I have a partition for each of these directories:

  • /lib
  • /var
  • /root
  • /boot
  • /tmp
  • /home
  • /etc
  • /
  • swap space

I imagine I can't just use rsync - do I need to attach a second CF reader with a copy of the CF card, so that it's not active and in-use - and then copy from the first reader to the second? How will the system know where to find its files?

I know I'd have to change fstab, but that resides in /etc, which will be on a separate partition...how will it find the fstab file if it can't find /etc? And what about grub?

I'm at a loss, perhaps its just because I'm under the weather, or I'm just missing a piece of logic here...

Any help is greatly appreciated, this is somewhat urgent as our existing stock is nearing its end and we don't want to purchase anything but these industrial cards, but need to get it working with partitions.

share|improve this question
add comment

1 Answer 1

You can't move /lib or /etc out of the root partition. You might be able to move selected pieces off, but generally speaking, programs that are kept out of /usr and their dependencies (such as libraries in /lib and configuration files in /etc) are the ones that tend to be necessary early in the system boot, before /usr can be mounted.

For /root, /var, /home, /usr and /boot, you can just move the data to the new partition with mv, then add the proper entry to /etc/fstab. I recommend doing that from a rescue system; especially for /var, moving files on a live system requires experience of an if-you-need-to-ask-you-don't-have-it kind.

For /tmp, make it live entirely in memory (that's virtual memory, so in a sense its storage backend is the swap space, if this becomes necessary due to lack of RAM). Add the following line in /etc/fstab:

tmpfs /tmp tmpfs mode=1777

I wonder if you're really going in the right direction. I just don't see how making multiple partitions could help avoid corruption. Maybe what you need is some form of RAID (this requires that the devices have multiple CF readers, unless you're willing to sacrifice a lot of performance and disk space for a chance of detecting corruption), or a filesystem with some corruption detection (something which Linux doesn't support well — I think your best bet is btrfs).

share|improve this answer
    
I'll give it a go leaving /lib and /etc in the root partition. I attached a second CF reader so I'm not copying from the filesystem I'm booted from. Fingers crossed it works :) –  Mistiry Oct 19 '10 at 21:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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