Caveats About Restoring Linux Root Partition From TAR Archive

Recently I had to create a new partition on my laptop’s hdd to install OS X (I wanted to have a dual boot of Gentoo and OS X). I had no free space on the disk so the only way to create a new partition was to shrink the existing root partition with Gentoo. Since it was formatted as JFS and JFS doesn’t allow shrinking I had to back up all the data on the root partition, delete it, create a new (smaller) one and format it as JFS. So the steps were:

  1. Create a backup of the root partition with tar -cvpjf --sparse --one-file-system backup_of_root.tar.bz2 /
    Note
    : only the contents of the root partition will be archived since –one-file-system option is specified (no dev, proc, …) WARNING! If your filesystem is mounted with extended attributes support (see /etc/fstab) and you use programs utilizing this feature (such as SELinux) you shouldn’t use tar since it won’t store any extended attributes. Use sta, pax or cpio
  2. Boot with a live CD and delete the partition as well as create a new one with fdisk
  3. jfs_mkfs /dev/sdaN (where N is the partition number)
  4. Extract the backup with tar -xvpjf  backup_of_root.tar.bz2
  5. Reboot and … a kernel panic :)   On my system it was “Kernel panic – not syncing: Attempted to kill init!”

After a week of kernel debugging, initrd debugging and browsing of forums I have finally found out that init script is missing character files in /dev filesystem: /dev/console and /dev/null. Without these two your Gentoo installation (and some other distributions as well) just won’t boot without telling you why!

So all you need to do to make your restored system boot again are two commands:
mknod /dev/null c 3 1
mknod /dev/console c 5 1

Happy fixing! :)

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Furl
  • Reddit
  • Technorati
  • Ma.gnolia
  • Add to favorites
  • MySpace
  • Slashdot
  • Twitter

Comments 2

  1. solshark wrote:

    А чем дело с OS X закончилось?
    Я только в vmware заводил, на реальном железе не пробовал.

    Posted Sunday February 1st, 2009 at 02:13 AM
  2. Andrew wrote:

    Есть проблема с дровами под ATI Radeon Mobility x1400 – полноценно работающих просто не существует пока.
    Еще звук не пашет. А так – и Gentoo и Leopart на одном ноуте отлично уживаются. Grub рулит

    Posted Wednesday February 4th, 2009 at 07:51 PM

Post a Comment

Your email is never published nor shared. Required fields are marked *