Repair grub on sdcard

    • OMV 4.x
    • Repair grub on sdcard

      Hello Forum,

      some days ago I installed Arakis on a microserver system. With a 32GB SDCard as root file system. All worked fine. Because of the omv extra flashmemory plugin, I removed the swap partition from the fstab file. But now 4GB space are unused (the swap partition). So I started fdisk and I used the old jedi trick:
      -- Delete the swap partition and then
      -- Delete the root partition and then
      -- Re-Create the root partition with fdisk beginning with the same sector and add the extra space. reboot+resize2fs+e2fsck
      -- (I left 100MB space unused at the end of the SDCard for a second primary partition.)

      But now the system does not start anymore. (Non-System disk or disk error). I started a linux live system. I checked the filesystem with force. I checked the bios and its not uefi. So I tried this manual.

      Shell-Script

      1. > /dev/sda1 is the sdcard and not the linux live system.
      2. mount /dev/sda1 /mnt
      3. mount --bind /dev /mnt/dev
      4. mount --bind /dev/pts /mnt/dev/pts
      5. mount --bind /proc /mnt/proc
      6. mount --bind /sys /mnt/sys
      7. chroot /mnt
      8. grub-install /dev/sda
      9. grub-install --recheck /dev/sda
      10. > Installation finished. No error reported.
      11. update-grub
      12. > Generating grub configuration file ...
      13. > Found linux image: /boot/vmlinuz-4.19.0-0.bpo.4-amd64
      14. > Found initrd image: /boot/initrd.img-4.19.0-0.bpo.4-amd64
      15. > done
      Display All
      All seems fine, but after a reboot the error is still 'Non-System disk or disk error'

      Can someone give me a hint what I'm doing wrong?


      Thanks

      Peter

      Edit: After sending this posting to the forum, I got a message that an error occurs and that I have to send a ticket to the admin. So I posted it again. Sorry for the double posting. :(

      The post was edited 4 times, last by peterfarge ().

    • But this is the reason we are here. To alter, tune, optimize and finally crash a running system. This is what we do!

      I removed the swap partition by putting the sdcard into my laptop and resizing with gparted. Now I have my 4GB extra space. The flashmemory plugin tells me in the web gui to remove the swap partition from fstab. Because I removed it completely I got some errors in dmesg. I had to remove the swap partition uuid also from '/etc/initramfs-tools/conf.d/resume'.
    • peterfarge wrote:

      I had to remove the swap partition uuid also from '/etc/initramfs-tools/conf.d/resume'
      Fair point.

      @ryecoaaron: should the comment on the flashmemory page mention this as well?

      Source Code

      1. echo "RESUME=none" >/etc/initramfs-tools/conf.d/resume
      2. update-initramfs -u
      BTW: especially for newbies I consider the recommendation to alter fstab a bit problematic since syntax errors might result in a bricked system, there shouldn't be much difference between Debian's relatime default and adding noatime,nodiratime manually. Also leaving swap configured but adjusting vm.swappiness to the minimum might be a better idea. So the whole comment could be reduced to a recommendation to do this: echo vm.swappiness=0 >>/etc/sysctl.conf. Or plugin installation could add this single line to the config file and execute the needed sysctl call? What do you think?
    • I would rather remove all of the info because people worry too much about these completely optional steps. I would probably add a checkbox that would
      echo 'vm.swappiness=0' > /etc/sysctl.d/swap.conf -or- rm /etc/sysctl.d/swap.conf (since I like using the .d directories for config files)
      and then execute
      sysctl --system
      omv 4.1.22 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.15
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • @ryecoaaron sounds both like a great idea to me :)

      With OMV5 (or Buster to be more precise) at least on x86 due to kernel 4.19 and a usually already existing swap partition another nice adjustment would be to set up zram instead and use the former swap partition as writeback device. This would need a systemd unit that sets up one zram device and also sets echo $former-swap-partition >/sys/block/zram0/backing_dev. Could be combined with reworking the flashmemory plugin to use another zram device instead of tmpfs.
    • tkaiser wrote:

      Could be combined with reworking the flashmemory plugin to use another zram device instead of tmpfs.
      I like that idea and I looked into this a little bit. folder2ram would have to changed to use zram instead of tmpfs unless the plugin did the zram stuff itself. Trying not to reinvent the wheel, is there something from armbian we could start with?
      omv 4.1.22 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.15
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!