Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Migrate Debian from one disc to another

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Sk1X1
Posts: 11
Joined: 2018-02-10 10:06

Migrate Debian from one disc to another

#1 Post by Sk1X1 »

I bought new computer with Win 10 preinstalled. I installed Debian on new partition (same disc) a everything goes well. But now I added new disc and I would like to move Debian to this disk.

Is here easy way how to do it?

I tried to use

Code: Select all

dd
to copy Linux partition to new disc, but I'm not sure how to update grub, because `update-grub` didn't add new partition with Debian partition to his menu.

This is

Code: Select all

fdisk -l
output:

Code: Select all

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

Code: Select all

/dev/nvme0n1
is old disc with Win10 and Debian i'm using now

Code: Select all

/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 how to migrate it on /dev/sda?
I can format or change structure of new disk if it is needed.

User avatar
pawRoot
Posts: 603
Joined: 2016-12-28 18:26
Has thanked: 1 time
Been thanked: 1 time

Re: Migrate Debian from one disc to another

#2 Post by pawRoot »

I believe that you will need to create EFI partition on the new drive aswell.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Migrate Debian from one disc to another

#3 Post by bw123 »

I searched the internet with your topic title, "Migrate Debian from one disc to another" and found this... it's a thread about migrating to raid1, but I think steve_v's answer is pretty darn close to what you want to do.

http://forums.debian.net/viewtopic.php? ... 91#p669791
steve_v wrote: make degraded array(s)
copy system
chroot in
install grub
rebuild initramfs
update fstab
reboot
add old disk.
Same as it ever was...
In your case you want to mkfs instead of 'make degraded array' and reclaim/remove the old partition instead of 'add old disk' and I think that 'update fstab' should maybe come before rebuild initramfs like p.H said.

I haven't used dd for this, I'd just use copy with some switches, maybe
copy -ax but look that up for the best way, it's been a long while.

OTOH, if you did use dd and all the UUID's match, I'm not sure why you could not skip a step or two, but I'm not sure which ones...

Good luck.
Last edited by bw123 on 2018-03-29 21:10, edited 1 time in total.
resigned by AI ChatGPT

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Migrate Debian from one disc to another

#4 Post by Segfault »

Tip!
Looking up similar threads is much faster than posting another one and waiting for responses.

Bulkley
Posts: 6386
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Migrate Debian from one disc to another

#5 Post by Bulkley »

I'd use Clonzilla.

Sk1X1
Posts: 11
Joined: 2018-02-10 10:06

Re: Migrate Debian from one disc to another

#6 Post by Sk1X1 »

Thanks for all of you replies.

@Segfault
I search for answer on multiple sites. Even your link doesn't contain answer I was looking for, but thanks anyway

@Bulkley
I tried Clonzilla, but copy failed (probably because new disc is bigger than old one)

At the end I end up with fresh install of system.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Migrate Debian from one disc to another

#7 Post by Segfault »

That's a shame. Simple 'cp -a' never failed me.

Post Reply