Is grub needed when copying Ubuntu to a new 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 have a machine with one drive, and 2 OSs installed in 2 partitions, one windows and one Ubuntu 16.04. Grub is installed.



I just got a new physical drive. After I assemble it in the machine, I would like to:



  • Copy the exact same Ubuntu that I have in one partition of the current drive to the new drive


  • Have a grub in place that allows me to choose to boot from windows, from the original Ubuntu, or from the new Ubuntu in the new drive


I have done research and I found a very similar thread (link here). In that thread, this is one of the solutions suggested:



  • Create an ext4 partition and a swap partition on the new drive.


  • Boot from LiveUSB.


  • Mount the old Ubuntu partition to some directory, mount the new one to some other directory.


  • Copy all files from the old one to the new one using cp -a command


  • Install grub to the new drive.


  • Update /etc/fstab with new UUIDs


Given that I already have a grub in the current drive, and that I will copy the Ubuntu which is there exactly the same as it is to the new drive, do I need to install it on the new drive?



Thanks







share|improve this question




















  • I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
    – user68186
    May 12 at 23:38











  • Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
    – Paul Benson
    May 13 at 6:38















up vote
0
down vote

favorite












I have a machine with one drive, and 2 OSs installed in 2 partitions, one windows and one Ubuntu 16.04. Grub is installed.



I just got a new physical drive. After I assemble it in the machine, I would like to:



  • Copy the exact same Ubuntu that I have in one partition of the current drive to the new drive


  • Have a grub in place that allows me to choose to boot from windows, from the original Ubuntu, or from the new Ubuntu in the new drive


I have done research and I found a very similar thread (link here). In that thread, this is one of the solutions suggested:



  • Create an ext4 partition and a swap partition on the new drive.


  • Boot from LiveUSB.


  • Mount the old Ubuntu partition to some directory, mount the new one to some other directory.


  • Copy all files from the old one to the new one using cp -a command


  • Install grub to the new drive.


  • Update /etc/fstab with new UUIDs


Given that I already have a grub in the current drive, and that I will copy the Ubuntu which is there exactly the same as it is to the new drive, do I need to install it on the new drive?



Thanks







share|improve this question




















  • I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
    – user68186
    May 12 at 23:38











  • Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
    – Paul Benson
    May 13 at 6:38













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a machine with one drive, and 2 OSs installed in 2 partitions, one windows and one Ubuntu 16.04. Grub is installed.



I just got a new physical drive. After I assemble it in the machine, I would like to:



  • Copy the exact same Ubuntu that I have in one partition of the current drive to the new drive


  • Have a grub in place that allows me to choose to boot from windows, from the original Ubuntu, or from the new Ubuntu in the new drive


I have done research and I found a very similar thread (link here). In that thread, this is one of the solutions suggested:



  • Create an ext4 partition and a swap partition on the new drive.


  • Boot from LiveUSB.


  • Mount the old Ubuntu partition to some directory, mount the new one to some other directory.


  • Copy all files from the old one to the new one using cp -a command


  • Install grub to the new drive.


  • Update /etc/fstab with new UUIDs


Given that I already have a grub in the current drive, and that I will copy the Ubuntu which is there exactly the same as it is to the new drive, do I need to install it on the new drive?



Thanks







share|improve this question












I have a machine with one drive, and 2 OSs installed in 2 partitions, one windows and one Ubuntu 16.04. Grub is installed.



I just got a new physical drive. After I assemble it in the machine, I would like to:



  • Copy the exact same Ubuntu that I have in one partition of the current drive to the new drive


  • Have a grub in place that allows me to choose to boot from windows, from the original Ubuntu, or from the new Ubuntu in the new drive


I have done research and I found a very similar thread (link here). In that thread, this is one of the solutions suggested:



  • Create an ext4 partition and a swap partition on the new drive.


  • Boot from LiveUSB.


  • Mount the old Ubuntu partition to some directory, mount the new one to some other directory.


  • Copy all files from the old one to the new one using cp -a command


  • Install grub to the new drive.


  • Update /etc/fstab with new UUIDs


Given that I already have a grub in the current drive, and that I will copy the Ubuntu which is there exactly the same as it is to the new drive, do I need to install it on the new drive?



Thanks









share|improve this question











share|improve this question




share|improve this question










asked May 12 at 23:09









Joe

276




276











  • I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
    – user68186
    May 12 at 23:38











  • Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
    – Paul Benson
    May 13 at 6:38

















  • I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
    – user68186
    May 12 at 23:38











  • Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
    – Paul Benson
    May 13 at 6:38
















I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
– user68186
May 12 at 23:38





I think you don't need to install grub again. Just run sudo update-grub once the new OS is ready.
– user68186
May 12 at 23:38













Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
– Paul Benson
May 13 at 6:38





Basically, I agree with the 2nd answer, but not sure whether a boot-repair is necessary. If you were restoring an image back onto the same drive, then you should not need a new grub, everything should be the same as before. But using a different drive to restore an image as in this case may make a different UUID for your '/' root partition, which would then require a corresponding change in grub.cfg and fstab files.
– Paul Benson
May 13 at 6:38











2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










First of all, cp -a is not appropriate in this situation. What you want to do is CLONE the partition. Here we will use the 'dd' tool but there are others available with GUI etc if you prefer eg Clonezilla.



Connect both drives to your computer. Make sure the new drive is the same size or larger than the partition you want to copy. It does not need to be formatted or anything, just leave it raw.



Boot a live DVD/USB and run:



sudo blkid


This will list all the drives and partitions on your computer. Make a careful note of the partition you want to copy, eg. /dev/sda1 and the new blank drive eg. /dev/sdb (no number).



Use dd to clone your partition to the new drive - be very careful, this can destroy your data if you type the wrong command! 'if' is the (old) partition you want to copy. 'of' is the new (blank) drive. Don't get these mixed up! So for example:



sudo dd if=/dev/sda1 of=/dev/sdb status=progress


You can add bs=4096 if you want it to go faster, but I prefer not to. Now go away and do something else because it will take a while.



When it's done (you are still in the live session at this point) you can add a swap partition to the new drive if you want to, using gparted, then install/run Boot Repair as below - this will install a nice fresh Grub onto the drive of your choice (overwriting any existing one) and find any OS on any drive connected:



sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair


Reboot and enjoy. Note: you will want to make sure your BIOS is booting the drive with the fresh Grub on it.



~~~~~~~~~~



UPDATE: Sorry for the late reply. So yes, if you haven't already done it by now, what you said before is what you want to do. Create an empty ext4 partition of about 20Gb on the new drive, to install the new Ubuntu system. Clone the /home partition from your old drive onto the new one (make sure you have enough space), then finally add the swap partition. You will then be ready to install the system on the new drive from your USB session - select the 'something else' option during install, choose to install / on the empty 20Gb partition WITH formatting, select the new cloned partition for /home WITHOUT formatting and place Grub on the new drive (see the dropdown selection at the bottom, the new drive should already be selected by default) and that should do the trick.



Bear in mind that when you're done, Grub should show Ubuntu x2 and Windows x1 so make sure you're booting the correct one.






share|improve this answer






















  • I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
    – Joe
    May 13 at 8:38










  • Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
    – JimDeadlock
    May 13 at 16:39










  • Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
    – Joe
    May 13 at 23:25

















up vote
0
down vote













Grub access it's config files before drives/filesystems are mounted. Unless you duplicate the original drive, you will likely get a grub command prompt.



You will need to boot into the new OS and update grub. I have done the following in the same situation:



  • copy your files to the new drive, and edit the new /etc/fstab to reflect the new UUID's.

  • Update grub so that you get a grub entry for the new drive in the old grub.

  • boot into the new drive. Reinstall grub, update grub, and update initramfs. Be sure to target the new drive with the grub install.

  • remove the old drive, and you should be good with the new drive.

  • once booted with the new drive only, update grub again to remove the entry for the old drive.





share|improve this answer




















  • What exactly would I need to update in initramfs?
    – Joe
    Jul 4 at 22:57










  • updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
    – ravery
    Jul 4 at 23:06










  • Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
    – Joe
    Jul 5 at 0:00










  • I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
    – Joe
    Jul 5 at 0:39










  • if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
    – ravery
    Jul 5 at 1:07










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1035510%2fis-grub-needed-when-copying-ubuntu-to-a-new-drive%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










First of all, cp -a is not appropriate in this situation. What you want to do is CLONE the partition. Here we will use the 'dd' tool but there are others available with GUI etc if you prefer eg Clonezilla.



Connect both drives to your computer. Make sure the new drive is the same size or larger than the partition you want to copy. It does not need to be formatted or anything, just leave it raw.



Boot a live DVD/USB and run:



sudo blkid


This will list all the drives and partitions on your computer. Make a careful note of the partition you want to copy, eg. /dev/sda1 and the new blank drive eg. /dev/sdb (no number).



Use dd to clone your partition to the new drive - be very careful, this can destroy your data if you type the wrong command! 'if' is the (old) partition you want to copy. 'of' is the new (blank) drive. Don't get these mixed up! So for example:



sudo dd if=/dev/sda1 of=/dev/sdb status=progress


You can add bs=4096 if you want it to go faster, but I prefer not to. Now go away and do something else because it will take a while.



When it's done (you are still in the live session at this point) you can add a swap partition to the new drive if you want to, using gparted, then install/run Boot Repair as below - this will install a nice fresh Grub onto the drive of your choice (overwriting any existing one) and find any OS on any drive connected:



sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair


Reboot and enjoy. Note: you will want to make sure your BIOS is booting the drive with the fresh Grub on it.



~~~~~~~~~~



UPDATE: Sorry for the late reply. So yes, if you haven't already done it by now, what you said before is what you want to do. Create an empty ext4 partition of about 20Gb on the new drive, to install the new Ubuntu system. Clone the /home partition from your old drive onto the new one (make sure you have enough space), then finally add the swap partition. You will then be ready to install the system on the new drive from your USB session - select the 'something else' option during install, choose to install / on the empty 20Gb partition WITH formatting, select the new cloned partition for /home WITHOUT formatting and place Grub on the new drive (see the dropdown selection at the bottom, the new drive should already be selected by default) and that should do the trick.



Bear in mind that when you're done, Grub should show Ubuntu x2 and Windows x1 so make sure you're booting the correct one.






share|improve this answer






















  • I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
    – Joe
    May 13 at 8:38










  • Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
    – JimDeadlock
    May 13 at 16:39










  • Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
    – Joe
    May 13 at 23:25














up vote
0
down vote



accepted










First of all, cp -a is not appropriate in this situation. What you want to do is CLONE the partition. Here we will use the 'dd' tool but there are others available with GUI etc if you prefer eg Clonezilla.



Connect both drives to your computer. Make sure the new drive is the same size or larger than the partition you want to copy. It does not need to be formatted or anything, just leave it raw.



Boot a live DVD/USB and run:



sudo blkid


This will list all the drives and partitions on your computer. Make a careful note of the partition you want to copy, eg. /dev/sda1 and the new blank drive eg. /dev/sdb (no number).



Use dd to clone your partition to the new drive - be very careful, this can destroy your data if you type the wrong command! 'if' is the (old) partition you want to copy. 'of' is the new (blank) drive. Don't get these mixed up! So for example:



sudo dd if=/dev/sda1 of=/dev/sdb status=progress


You can add bs=4096 if you want it to go faster, but I prefer not to. Now go away and do something else because it will take a while.



When it's done (you are still in the live session at this point) you can add a swap partition to the new drive if you want to, using gparted, then install/run Boot Repair as below - this will install a nice fresh Grub onto the drive of your choice (overwriting any existing one) and find any OS on any drive connected:



sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair


Reboot and enjoy. Note: you will want to make sure your BIOS is booting the drive with the fresh Grub on it.



~~~~~~~~~~



UPDATE: Sorry for the late reply. So yes, if you haven't already done it by now, what you said before is what you want to do. Create an empty ext4 partition of about 20Gb on the new drive, to install the new Ubuntu system. Clone the /home partition from your old drive onto the new one (make sure you have enough space), then finally add the swap partition. You will then be ready to install the system on the new drive from your USB session - select the 'something else' option during install, choose to install / on the empty 20Gb partition WITH formatting, select the new cloned partition for /home WITHOUT formatting and place Grub on the new drive (see the dropdown selection at the bottom, the new drive should already be selected by default) and that should do the trick.



Bear in mind that when you're done, Grub should show Ubuntu x2 and Windows x1 so make sure you're booting the correct one.






share|improve this answer






















  • I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
    – Joe
    May 13 at 8:38










  • Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
    – JimDeadlock
    May 13 at 16:39










  • Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
    – Joe
    May 13 at 23:25












up vote
0
down vote



accepted







up vote
0
down vote



accepted






First of all, cp -a is not appropriate in this situation. What you want to do is CLONE the partition. Here we will use the 'dd' tool but there are others available with GUI etc if you prefer eg Clonezilla.



Connect both drives to your computer. Make sure the new drive is the same size or larger than the partition you want to copy. It does not need to be formatted or anything, just leave it raw.



Boot a live DVD/USB and run:



sudo blkid


This will list all the drives and partitions on your computer. Make a careful note of the partition you want to copy, eg. /dev/sda1 and the new blank drive eg. /dev/sdb (no number).



Use dd to clone your partition to the new drive - be very careful, this can destroy your data if you type the wrong command! 'if' is the (old) partition you want to copy. 'of' is the new (blank) drive. Don't get these mixed up! So for example:



sudo dd if=/dev/sda1 of=/dev/sdb status=progress


You can add bs=4096 if you want it to go faster, but I prefer not to. Now go away and do something else because it will take a while.



When it's done (you are still in the live session at this point) you can add a swap partition to the new drive if you want to, using gparted, then install/run Boot Repair as below - this will install a nice fresh Grub onto the drive of your choice (overwriting any existing one) and find any OS on any drive connected:



sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair


Reboot and enjoy. Note: you will want to make sure your BIOS is booting the drive with the fresh Grub on it.



~~~~~~~~~~



UPDATE: Sorry for the late reply. So yes, if you haven't already done it by now, what you said before is what you want to do. Create an empty ext4 partition of about 20Gb on the new drive, to install the new Ubuntu system. Clone the /home partition from your old drive onto the new one (make sure you have enough space), then finally add the swap partition. You will then be ready to install the system on the new drive from your USB session - select the 'something else' option during install, choose to install / on the empty 20Gb partition WITH formatting, select the new cloned partition for /home WITHOUT formatting and place Grub on the new drive (see the dropdown selection at the bottom, the new drive should already be selected by default) and that should do the trick.



Bear in mind that when you're done, Grub should show Ubuntu x2 and Windows x1 so make sure you're booting the correct one.






share|improve this answer














First of all, cp -a is not appropriate in this situation. What you want to do is CLONE the partition. Here we will use the 'dd' tool but there are others available with GUI etc if you prefer eg Clonezilla.



Connect both drives to your computer. Make sure the new drive is the same size or larger than the partition you want to copy. It does not need to be formatted or anything, just leave it raw.



Boot a live DVD/USB and run:



sudo blkid


This will list all the drives and partitions on your computer. Make a careful note of the partition you want to copy, eg. /dev/sda1 and the new blank drive eg. /dev/sdb (no number).



Use dd to clone your partition to the new drive - be very careful, this can destroy your data if you type the wrong command! 'if' is the (old) partition you want to copy. 'of' is the new (blank) drive. Don't get these mixed up! So for example:



sudo dd if=/dev/sda1 of=/dev/sdb status=progress


You can add bs=4096 if you want it to go faster, but I prefer not to. Now go away and do something else because it will take a while.



When it's done (you are still in the live session at this point) you can add a swap partition to the new drive if you want to, using gparted, then install/run Boot Repair as below - this will install a nice fresh Grub onto the drive of your choice (overwriting any existing one) and find any OS on any drive connected:



sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair


Reboot and enjoy. Note: you will want to make sure your BIOS is booting the drive with the fresh Grub on it.



~~~~~~~~~~



UPDATE: Sorry for the late reply. So yes, if you haven't already done it by now, what you said before is what you want to do. Create an empty ext4 partition of about 20Gb on the new drive, to install the new Ubuntu system. Clone the /home partition from your old drive onto the new one (make sure you have enough space), then finally add the swap partition. You will then be ready to install the system on the new drive from your USB session - select the 'something else' option during install, choose to install / on the empty 20Gb partition WITH formatting, select the new cloned partition for /home WITHOUT formatting and place Grub on the new drive (see the dropdown selection at the bottom, the new drive should already be selected by default) and that should do the trick.



Bear in mind that when you're done, Grub should show Ubuntu x2 and Windows x1 so make sure you're booting the correct one.







share|improve this answer














share|improve this answer



share|improve this answer








edited May 22 at 1:12

























answered May 13 at 3:27









JimDeadlock

1528




1528











  • I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
    – Joe
    May 13 at 8:38










  • Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
    – JimDeadlock
    May 13 at 16:39










  • Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
    – Joe
    May 13 at 23:25
















  • I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
    – Joe
    May 13 at 8:38










  • Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
    – JimDeadlock
    May 13 at 16:39










  • Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
    – Joe
    May 13 at 23:25















I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
– Joe
May 13 at 8:38




I took a look at my current system carefully, and the situation is more complex than initially described. In the current drive, I have 4 partitions. 1 Windows, 1 swap, 2 for Ubuntu. In 1 of those, I have the OS itself, with "/" as the mount point. In the other, I have the data, with "/home" as mount point. I would like to have in the new drive both the OS and the data. Should I do the following? i) boot a live USB, ii) create 3 partitions in the new drive, 1 for the OS (/), 1 for the data (/home), and 1 for the swap, iii) clone the OS as described using dd, iv) clone the data using dd
– Joe
May 13 at 8:38












Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
– JimDeadlock
May 13 at 16:39




Having separate / and /home partitions is actually the best way to do it. Let me hazard a guess that you want to run your system on the new drive (it's a SSD right?) but you want to keep all your data and app settings, and your Windows system on the old drive? Tell me if this is the case and then I'll give you the answer you're really looking for.
– JimDeadlock
May 13 at 16:39












Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
– Joe
May 13 at 23:25




Mostly yes. I want to keep in my old drive windows (I believe that if I move it to another drive it will not work bc of license), and the exact Ubuntu and data as I have. Then in the new drive again the same exact Ubuntu and data (I know it is duplicated). The new drive is a nvme ssd. The workloads I have in my current Ubuntu read and write huge files constantly, so I hope the new drive will help. But the system I have in place is so complex to set up that I want to duplicate everything 1st, and ensure it works in the new drive. If sthg goes wrong, I still have the system in the current drive
– Joe
May 13 at 23:25












up vote
0
down vote













Grub access it's config files before drives/filesystems are mounted. Unless you duplicate the original drive, you will likely get a grub command prompt.



You will need to boot into the new OS and update grub. I have done the following in the same situation:



  • copy your files to the new drive, and edit the new /etc/fstab to reflect the new UUID's.

  • Update grub so that you get a grub entry for the new drive in the old grub.

  • boot into the new drive. Reinstall grub, update grub, and update initramfs. Be sure to target the new drive with the grub install.

  • remove the old drive, and you should be good with the new drive.

  • once booted with the new drive only, update grub again to remove the entry for the old drive.





share|improve this answer




















  • What exactly would I need to update in initramfs?
    – Joe
    Jul 4 at 22:57










  • updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
    – ravery
    Jul 4 at 23:06










  • Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
    – Joe
    Jul 5 at 0:00










  • I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
    – Joe
    Jul 5 at 0:39










  • if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
    – ravery
    Jul 5 at 1:07














up vote
0
down vote













Grub access it's config files before drives/filesystems are mounted. Unless you duplicate the original drive, you will likely get a grub command prompt.



You will need to boot into the new OS and update grub. I have done the following in the same situation:



  • copy your files to the new drive, and edit the new /etc/fstab to reflect the new UUID's.

  • Update grub so that you get a grub entry for the new drive in the old grub.

  • boot into the new drive. Reinstall grub, update grub, and update initramfs. Be sure to target the new drive with the grub install.

  • remove the old drive, and you should be good with the new drive.

  • once booted with the new drive only, update grub again to remove the entry for the old drive.





share|improve this answer




















  • What exactly would I need to update in initramfs?
    – Joe
    Jul 4 at 22:57










  • updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
    – ravery
    Jul 4 at 23:06










  • Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
    – Joe
    Jul 5 at 0:00










  • I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
    – Joe
    Jul 5 at 0:39










  • if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
    – ravery
    Jul 5 at 1:07












up vote
0
down vote










up vote
0
down vote









Grub access it's config files before drives/filesystems are mounted. Unless you duplicate the original drive, you will likely get a grub command prompt.



You will need to boot into the new OS and update grub. I have done the following in the same situation:



  • copy your files to the new drive, and edit the new /etc/fstab to reflect the new UUID's.

  • Update grub so that you get a grub entry for the new drive in the old grub.

  • boot into the new drive. Reinstall grub, update grub, and update initramfs. Be sure to target the new drive with the grub install.

  • remove the old drive, and you should be good with the new drive.

  • once booted with the new drive only, update grub again to remove the entry for the old drive.





share|improve this answer












Grub access it's config files before drives/filesystems are mounted. Unless you duplicate the original drive, you will likely get a grub command prompt.



You will need to boot into the new OS and update grub. I have done the following in the same situation:



  • copy your files to the new drive, and edit the new /etc/fstab to reflect the new UUID's.

  • Update grub so that you get a grub entry for the new drive in the old grub.

  • boot into the new drive. Reinstall grub, update grub, and update initramfs. Be sure to target the new drive with the grub install.

  • remove the old drive, and you should be good with the new drive.

  • once booted with the new drive only, update grub again to remove the entry for the old drive.






share|improve this answer












share|improve this answer



share|improve this answer










answered May 13 at 1:16









ravery

5,26151131




5,26151131











  • What exactly would I need to update in initramfs?
    – Joe
    Jul 4 at 22:57










  • updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
    – ravery
    Jul 4 at 23:06










  • Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
    – Joe
    Jul 5 at 0:00










  • I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
    – Joe
    Jul 5 at 0:39










  • if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
    – ravery
    Jul 5 at 1:07
















  • What exactly would I need to update in initramfs?
    – Joe
    Jul 4 at 22:57










  • updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
    – ravery
    Jul 4 at 23:06










  • Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
    – Joe
    Jul 5 at 0:00










  • I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
    – Joe
    Jul 5 at 0:39










  • if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
    – ravery
    Jul 5 at 1:07















What exactly would I need to update in initramfs?
– Joe
Jul 4 at 22:57




What exactly would I need to update in initramfs?
– Joe
Jul 4 at 22:57












updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
– ravery
Jul 4 at 23:06




updating initramfs, creates the system map and the boot image. Since both are accessed before drives are mounted, they reference files by physical location, and have to be created by the system not copied from another drive
– ravery
Jul 4 at 23:06












Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
– Joe
Jul 5 at 0:00




Thanks ravery. How do I do that? Do I run update-initframfs after booting with the new drive?
– Joe
Jul 5 at 0:00












I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
– Joe
Jul 5 at 0:39




I am trying the approach you described, but I am having dune trouble. What I did: ceated 3 partitions in new drive, 1 for /, 1 for /home, 1 for swap. All the partitions are bigger than the corresponding in the old drive. Then cloned the partitions for / and /home using the dd command in a live session. Updated fstab. Only updated the swap partition UUID given the other 2 partitions had the same UUID than the initial drive (were cloned). Turned off computer. Physically disconnected the old drive. Switched on computer. Gets stuck immediately after motherboard screen. What I am doing wrong?
– Joe
Jul 5 at 0:39












if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
– ravery
Jul 5 at 1:07




if you are cloning, then clone the entire drive not individual partitions, updating initramfs will not be needed
– ravery
Jul 5 at 1:07












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1035510%2fis-grub-needed-when-copying-ubuntu-to-a-new-drive%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491