LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2021, 06:08 PM   #1
spaceship
LQ Newbie
 
Registered: Mar 2021
Posts: 1

Rep: Reputation: Disabled
Cloning Fully Encrypted Disk to New Larger SSD


Hi all,

Hope you are well. I am using Debian and have 320GB SATA disk. I decided to buy a new SSD 500GB and want to clone my current disk to the new one.

I did lots of research on the forums, IRC channels, etc. but no luck there is no enough information about this issue. All of them are saying you need partitioning the disk before, copying data with dd and resize/extend disk with starting/ending sectors. I am really confused.

My goal is clone current disk to a new one. I know installing a fresh OS and moving all data to the new OS but this is not in my options.

lsblk:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 298.1G 0 disk
├─sda1 8:1 0 953M 0 part
│ └─boot_crypt 254:3 0 951M 0 crypt /boot
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 297.2G 0 part
└─sda5_crypt 254:0 0 297.1G 0 crypt
├─debian--vg-root 254:1 0 287.8G 0 lvm /
└─debian--vg-swap 254:2 0 9.3G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom


Any help would be appreciated..

Thanks in advance.
 
Old 03-28-2021, 06:44 PM   #2
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
It don't hurt to write to the new SSD, if first attempt fails, clean off the new drive's partition table and try something else. I'm not LVM experienced, but you should be able to simply dd if=/old/drive of=/new/drive bs=4k conv=notrunc from a running Linux live session. The new drive will only be 320GB like the original, remove or disable the old drive, set BIOS to boot the new drive, boot it and see if it works.

Now from either Linux live or while in the new running Debian you run fdisk /dev/<whatever> (the drive, not partitions), select "x" to go into expert mode, select "p" to print current drive structure, select "f" to fix partition order, select "p" to see what the proposed changes are, if you like what you see, select "r" to return to main menu, select "w" to write the changes. If you are doing it from the new running Debian you'll get errors because the kernel is running on the old configuration, just reboot and hopefully you have the full drive which you can now expand the LVM.
 
Old 03-28-2021, 06:58 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
It makes no sense to clone that configuration. The extended partition, the LUKS partition, the container, the PV, the vg and the lv's will all need attention. In that order, and no mistakes.

If you have to, pre-allocate the partitions, takes that out of consideration later. Personally I would copy, not clone.
 
Old 03-29-2021, 07:20 AM   #4
biker_rat
Member
 
Registered: Feb 2010
Posts: 369

Rep: Reputation: 220Reputation: 220Reputation: 220
syg00 advice sounds right. I would boot off of a live usb with both source and target drives installed. Then encrypt/format/mount the target drive partitions and then open(decrypt) & mount (read only might be good) the source partitions, and then copy all of your data from source to target with rsync. Then do whatever needs to be done with your bootloader on the target drive. You are never writing to the source, so, if at first you don't succeed, try, try again.
 
Old 03-29-2021, 07:26 AM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
rsync is often called advanced copy, for this job plain 'cp -a' will do just fine, no extra features of rsync are needed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Will cloning one hdd (not ssd) to another encrypted hdd work on a cloning device? hddfsck Linux - Newbie 16 09-05-2019 07:02 AM
[SOLVED] Tips/warnings for cloning OS disk from HDD to SSD? penyuan Linux - Hardware 11 08-13-2017 08:00 PM
Access To Encrypted SSD Partition With Native Password in SSD>SATA Enclosure skidvicious Linux - Hardware 5 12-03-2015 04:40 PM
[SOLVED] I need to resize r create a new partition after cloning to larger drive tokerau Linux - Hardware 3 10-14-2012 07:14 PM
dd cloning to a larger disk partition question ciarlatano Linux - General 1 04-23-2007 03:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration