I bought new computer with Win 10 pre-installed. I installed Debian on a new partition (same disc) and everything went well. But now I added new disc and I would like to move Debian to this disk.
Is there an easy way to do it?
I tried to use dd
to copy the Linux partition to the new disc, but I'm not sure how to update grub, because update-grub
didn't add the new partition with Debian partition to its menu.
This is fdisk -l
output:
Disk /dev/nvme0n1: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0F8FCBCA-F7B2-429C-B02B-4A420C815CB7
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 739327 737280 360M EFI System
/dev/nvme0n1p2 739328 1001471 262144 128M Microsoft reserved
---------Win 10 partition-----------
/dev/nvme0n1p3 1001472 405315583 404314112 192.8G Microsoft basic data
---------Old Debian partition-----------
/dev/nvme0n1p4 405315584 484538367 79222784 37.8G Linux filesystem
/dev/nvme0n1p5 484538368 500117503 15579136 7.4G Linux swap
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 77489E99-4F1D-4E2A-A984-6BE441B8A849
Device Start End Sectors Size Type
/dev/sda1 2048 15626239 15624192 7.5G Linux swap
---------New Debian partition-----------
/dev/sda2 15626240 488397134 472770895 225.4G Linux filesystem
/dev/nvme0n1
is old disc with Win10 and Debian I'm using now
/dev/sda
is new disc, where I would like to migrate my current Debian
For now, I can safely boot into old Debian. Any advice on how to migrate it on /dev/sda?
I can format or change structure of the new disk if it is needed.
Best Answer
#You can update grub following this guide.
However if you want to know more about how to move your current operating system to a new drive, there are a few different ways you can accomplish this task. I will be referencing this post as it is very much related to your question.
1. Use Clonezilla
You can create a Live Boot of Clonezilla to clone or create an image of your Linux installation and then migrate that to the new disk. The Clonezilla site has documentation on how to restore an image to a larger disk. Please make sure you read through their FAQ/Q&A first. Then you will need to install grub to your new drive.
2. Use Rsync
With this option you do not have to create a live boot. You can boot into your original Debian install and run rsync to back up your current install to the new disk. After which you will have to resize your partitions to fill the rest of the unallocated disk space. This step is best done using a live boot however.
The rsync command that should work in most cases is this:
After that completes you will want to run
mkdir sys proc dev tmp media mnt run
inside of the new root directory to recreate the missing elements. You do not want to include them in the rsync command because at least one of them will contain the file system and mount points for your new disk causing a few issues as you would backup your backup in the process. Please reference the rsync documentation to learn more about the process before you complete the task. Again once completed you will have to update grub on the new drive.Conclusion
Please reference all of the posts and links I have included before you take any action. If there is any misinformation in this post, I would really appreciate corrections. Best of Luck!