Changing the FS Type of the Root Partition

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 07:25, 7 October 2007 by Eac (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here's the overview. (Done while logged in as root):

  1. backup /dev/sda6
  2. format sda6 as EXT3 (to use as a staging area)
  3. boot into EM
  4. copy sda2 partition to a file on sda6
  5. boot normally
  6. copy the sda2 image file to a remote machine
  7. on the remote machine, loop mount the image
  8. create a tar copy of the contents of that image
  9. copy the tar file back to the LS-Pro (to sda6)
  10. boot into EM
  11. format sda2 as EXT3
  12. mount sda6 and sda2
  13. untar the tar file on top of sda2
  14. boot normally
  15. put the new kernel in place in /boot
  16. reboot
  17. format sda6 as JFS
  18. restore the contents of sda6 saved in step 1


And the details. (Done as root):


  1. backup /dev/sda6. (Use whatever technique you prefer.)
    1. scp -pr /mnt/disk1 remotehost:/temp-dir1
  2. format sda6 as EXT3 (to use as a staging area)
    1. umount /mnt/disk1
    2. mkfs.ext3 /dev/sda6
    3. change the /etc/fstab entry for /dev/sda6 to ext3
    4. /dev/sda6 /mnt/disk1 ext3 defaults,noatime,nodiratime 0 0
      (I don't know if noatime and nodiratime are appropriate for ext3)
    5. mount -t ext3 /mnt/disk1 (to make sure it works)
  3. boot into EM. (I did this rather than manually rebooting 3 times.)
    1. cd /boot
    2. mv rootfs_ok rootfs_booting
    3. echo '****' > rootfs_booting
    4. reboot
  4. copy sda2 partition to a file on sda6
    1. telnet into LS-Pro (using login 'root')
    2. mkdir temp1
    3. mount -t ext3 /dev/sda6 temp1
    4. dd if=/dev/sda2 of=temp1/part.image
  5. boot normally
    1. cd /boot
    2. mv rootfs_booting rootfs_ok
    3. echo `date` > rootfs_ok
    4. reboot
  6. copy the sda2 image file to a remote machine
    1. scp /mnt/disk1/part.image remotehost:/temp-dir2
    2. (this may take a while if the image size is large)

  7. on the remote machine, loop mount the image
    1. cd /temp-dir2
    2. mkdir temp3
    3. mount -t xfs -o loop part.image temp3
  8. create a tar copy of the contents of that image
    1. cd temp3
    2. tar pzcvf ../part.tgz .
  9. copy the tar file back to the LS-Pro (back on the LS-Pro)
    1. scp remotehost:/temp-dir2/part.tgz /mnt/disk1
  10. boot into EM
    1. cd /boot
    2. mv rootfs_ok rootfs_booting
    3. echo '****' > rootfs_booting
    4. reboot
  11. format sda2 as EXT3 (the scary part)
    1. mkfs.ext3 /dev/sda2
  12. mount sda6 and sda2
    1. mkdir temp-dir1
    2. mount -t ext3 /dev/sda6 temp-dir1
    3. mkdir temp-dir2
    4. mount -t ext3 /dev/sda2 temp-dir2
  13. untar the tar file on top of sda2
    1. cd temp-dir1
    2. gunzip part.tgz
    3. (I had to explicitly gunzip the file as the busybox tar available in EM can't do it inline)

    4. cd ../temp-dir2
    5. tar pxvf ../temp-dir1/part.tar
  14. boot normally
    1. cd /boot
    2. mv rootfs_booting rootfs_ok
    3. echo `date` > rootfs_ok
    4. reboot
  15. put the new kernel in place in /boot
    1. cd /boot
    2. cp uImage.buffalo uImage.buffalo-2.6.12.6
    3. (I left the old kernel in /boot in case I need to boot back to it)

    4. scp remotehost:/where/the/new/kernel/is uImage.buffalo-2.6.22
    5. cp uImage.buffalo-2.6.22 uImage.buffalo
    6. (Also bring over any modules you may have cross built)

    7. cd /lib/modules
    8. scp -r remotehost:/where/the/modules/are 2.6.22
  16. reboot
    1. make any offerings deemed necessary and cross fingers
    2. reboot
    3.            (Ideally you are up on the new kernel at this point)
      
  17. format sda6 as JFS
    1. apt-get install jfsutils (if the utils are not already installed)
    2. umount /mnt/disk1
    3. mkfs.jfs -c /dev/sda6
    4. (using the '-c' option made this step take several hours)

    5. modify the partition type for /dev/sda6 line in /etc/fstab
    6. /dev/sda6 /mnt/disk1 jfs defaults,noatime,nodiratime 0 2
      (here too, I'm not sure if noatime and nodiratime are appropriate for JFS)
    7. mount -t jfs /mnt/disk1 (to make sure it works)
  18. restore the contents of sda6 saved in step 1
      (use your favorite technique)
    1. scp -pr remotehost:/temp-dir1 /mnt/disk1