Ask Your Question
1

How to change disk without reinstalling?

asked 2018-11-08 05:31:39 -0600

tim.landscheidt gravatar image

Currently, I have a 1 TByte spinning disk with encrypted LVM on top (NB: the partitions do not add up to 1 TByte and sda4 is unused):

NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                             8:0    0 931,5G  0 disk
├─sda1                                          8:1    0   200M  0 part  /boot/efi
├─sda2                                          8:2    0   500M  0 part  /boot
├─sda3                                          8:3    0   400G  0 part
│ └─luks-$UUID                                253:0    0   400G  0 crypt
│   ├─fedora_passepartout-root                253:1    0    35G  0 lvm   /
│   ├─fedora_passepartout-swap                253:2    0    16G  0 lvm   [SWAP]
│   ├─fedora_passepartout-home$USER           253:3    0   194G  0 lvm   /home/$USER
│   └─fedora_passepartout-$DATA               253:4    0    19G  0 lvm   $DATA
└─sda4                                          8:4    0   100G  0 part
sr0                                            11:0    1  1024M  0 rom

I want to replace the spinning disk with a 500 GByte SSD and I would like to avoid having to reinstall Fedora. Ideally, I would like to set up LVM on the new disk, plug in the old disk via USB, move the volumes with pvmove and boot from the new disk.

I am wondering where Fedora stores references to UUIDs, etc. that need to be updated after moving (or copying) the volumes. I see UUID references to partitions in /etc/fstab for /boot and /boot/efi and UUID references to the LUKS container in /boot/efi/EFI/fedora/grub.cfg (and /etc/default/grub) and /etc/crypttab.

Are there other references that I would need to update besides /etc/fstab, /boot/efi/EFI/fedora/grub.cfg and /etc/crypttab?

edit retag flag offensive close merge delete

Comments

What you need to do is to use fdisk or similar tool to create partitions of the same size as the ones on the 1T disk, the use dd to copy each partition to new drive, after that try to book. I have used dd to copy full drive and that works, but not like this. In theory should works.

aeperezt gravatar imageaeperezt ( 2018-11-08 07:06:44 -0600 )edit

I think it's much fast to reinstall Fedora and restore your data from the existing 1 TB HDD.

florian gravatar imageflorian ( 2018-11-08 09:38:40 -0600 )edit

I second that absolutely, much faster to reinstall. In order to see UUIDs you can use gnome-disks. From terminal, as root, use blkid /dev/sda1 or whatever partition you want to see.

ed209 gravatar imageed209 ( 2018-11-08 09:56:02 -0600 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2018-11-10 20:30:41 -0600

tim.landscheidt gravatar image

Amending /etc/fstab, /boot/efi/EFI/fedora/grub.cfg and /etc/crypttab was sufficient. As I had copied the /boot and /boot/EFI partitions with dd, they had retained the same UUIDs, so no change was needed here, leaving only the LUKS's UUID to be updated in /boot/efi/EFI/fedora/grub.cfg and /etc/crypttab.

edit flag offensive delete link more
0

answered 2018-11-08 11:40:00 -0600

ed209 gravatar image

If you really don't want to reinstall, mount the new disk, partition it, and then as root do a

cp -a

of all relevant directories, exception made for /proc and /tmp . You should also modify /etc/fstab with correct uuids for new disk and reinstall grub from a live distribution. Not worth the effort.

If reinstalling just copy somewhere the contents of your old /etc directory and modify the new one as needed in order to keep the old settings.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-11-08 05:30:45 -0600

Seen: 59 times

Last updated: Nov 08