Configure Linux kernel and grub on external drive

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm moving my system from an old drive to a new one.



I could boot from a live CD/USB stick and install the system there, but for some weird reason the bios seems unable to do so.



So, how can I change from the old to the new drive and install GRUB and Linux there? Additionally, I would to setup-up this new drive with LUKS and LVM.







share|improve this question
























    up vote
    0
    down vote

    favorite












    I'm moving my system from an old drive to a new one.



    I could boot from a live CD/USB stick and install the system there, but for some weird reason the bios seems unable to do so.



    So, how can I change from the old to the new drive and install GRUB and Linux there? Additionally, I would to setup-up this new drive with LUKS and LVM.







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm moving my system from an old drive to a new one.



      I could boot from a live CD/USB stick and install the system there, but for some weird reason the bios seems unable to do so.



      So, how can I change from the old to the new drive and install GRUB and Linux there? Additionally, I would to setup-up this new drive with LUKS and LVM.







      share|improve this question












      I'm moving my system from an old drive to a new one.



      I could boot from a live CD/USB stick and install the system there, but for some weird reason the bios seems unable to do so.



      So, how can I change from the old to the new drive and install GRUB and Linux there? Additionally, I would to setup-up this new drive with LUKS and LVM.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 30 at 14:25









      random_user

      1266




      1266




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system



          It basically boils down to:



          • Create a boot partition on /dev/sdb1

          • Create a crypt-luks partion enc on /dev/sdb2

          • Create a LVM enc_my_lv logical volume on top of the luks partition.

          • Create a btrfs (or ext4) on enc_my_lv.

          • Fsync system and user data from old drive to enc_my_lv.

          • Edit fstab and cryptsetup to fit your new system.

          Now the additional part not covered there is to manually install Grub and Linux on the boot partition:



          Mount enc_my_lv on /mnt:



          mount /dev/your_vg/enc_my_lv /mnt


          Mount boot on /mnt/boot:



          mkdir /mnt/boot
          mount /dev/sdb1 /mnt/boot


          Mount additional devices:



          for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done #(credits: see https://askubuntu.com/a/88432/232047)


          Chroot to /mnt and run configs:



          chroot /mnt
          dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk 'system ("sudo apt-get install --reinstall " $2)' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
          update-initramfs -u
          grub-install /dev/sdb
          update-grub





          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420685%2fconfigure-linux-kernel-and-grub-on-external-drive%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system



            It basically boils down to:



            • Create a boot partition on /dev/sdb1

            • Create a crypt-luks partion enc on /dev/sdb2

            • Create a LVM enc_my_lv logical volume on top of the luks partition.

            • Create a btrfs (or ext4) on enc_my_lv.

            • Fsync system and user data from old drive to enc_my_lv.

            • Edit fstab and cryptsetup to fit your new system.

            Now the additional part not covered there is to manually install Grub and Linux on the boot partition:



            Mount enc_my_lv on /mnt:



            mount /dev/your_vg/enc_my_lv /mnt


            Mount boot on /mnt/boot:



            mkdir /mnt/boot
            mount /dev/sdb1 /mnt/boot


            Mount additional devices:



            for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done #(credits: see https://askubuntu.com/a/88432/232047)


            Chroot to /mnt and run configs:



            chroot /mnt
            dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk 'system ("sudo apt-get install --reinstall " $2)' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
            update-initramfs -u
            grub-install /dev/sdb
            update-grub





            share|improve this answer


























              up vote
              1
              down vote













              For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system



              It basically boils down to:



              • Create a boot partition on /dev/sdb1

              • Create a crypt-luks partion enc on /dev/sdb2

              • Create a LVM enc_my_lv logical volume on top of the luks partition.

              • Create a btrfs (or ext4) on enc_my_lv.

              • Fsync system and user data from old drive to enc_my_lv.

              • Edit fstab and cryptsetup to fit your new system.

              Now the additional part not covered there is to manually install Grub and Linux on the boot partition:



              Mount enc_my_lv on /mnt:



              mount /dev/your_vg/enc_my_lv /mnt


              Mount boot on /mnt/boot:



              mkdir /mnt/boot
              mount /dev/sdb1 /mnt/boot


              Mount additional devices:



              for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done #(credits: see https://askubuntu.com/a/88432/232047)


              Chroot to /mnt and run configs:



              chroot /mnt
              dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk 'system ("sudo apt-get install --reinstall " $2)' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
              update-initramfs -u
              grub-install /dev/sdb
              update-grub





              share|improve this answer
























                up vote
                1
                down vote










                up vote
                1
                down vote









                For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system



                It basically boils down to:



                • Create a boot partition on /dev/sdb1

                • Create a crypt-luks partion enc on /dev/sdb2

                • Create a LVM enc_my_lv logical volume on top of the luks partition.

                • Create a btrfs (or ext4) on enc_my_lv.

                • Fsync system and user data from old drive to enc_my_lv.

                • Edit fstab and cryptsetup to fit your new system.

                Now the additional part not covered there is to manually install Grub and Linux on the boot partition:



                Mount enc_my_lv on /mnt:



                mount /dev/your_vg/enc_my_lv /mnt


                Mount boot on /mnt/boot:



                mkdir /mnt/boot
                mount /dev/sdb1 /mnt/boot


                Mount additional devices:



                for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done #(credits: see https://askubuntu.com/a/88432/232047)


                Chroot to /mnt and run configs:



                chroot /mnt
                dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk 'system ("sudo apt-get install --reinstall " $2)' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
                update-initramfs -u
                grub-install /dev/sdb
                update-grub





                share|improve this answer














                For the first part, you can find the details at: https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system



                It basically boils down to:



                • Create a boot partition on /dev/sdb1

                • Create a crypt-luks partion enc on /dev/sdb2

                • Create a LVM enc_my_lv logical volume on top of the luks partition.

                • Create a btrfs (or ext4) on enc_my_lv.

                • Fsync system and user data from old drive to enc_my_lv.

                • Edit fstab and cryptsetup to fit your new system.

                Now the additional part not covered there is to manually install Grub and Linux on the boot partition:



                Mount enc_my_lv on /mnt:



                mount /dev/your_vg/enc_my_lv /mnt


                Mount boot on /mnt/boot:



                mkdir /mnt/boot
                mount /dev/sdb1 /mnt/boot


                Mount additional devices:



                for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done #(credits: see https://askubuntu.com/a/88432/232047)


                Chroot to /mnt and run configs:



                chroot /mnt
                dpkg -l | grep linux-image-.*-generic | sort -k3 | tail -n1 | awk 'system ("sudo apt-get install --reinstall " $2)' #Reinstall Linux kernel packages there (credits: see https://askubuntu.com/a/298855/232047)
                update-initramfs -u
                grub-install /dev/sdb
                update-grub






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 30 at 17:04

























                answered Jan 30 at 14:25









                random_user

                1266




                1266






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420685%2fconfigure-linux-kernel-and-grub-on-external-drive%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?