[slint] Re: Is there a way...?

  • From: Didier Spaier <didier@xxxxxxxx>
  • To: slint@xxxxxxxxxxxxx
  • Date: Sat, 3 Jun 2023 20:38:16 +0000

I have started a test. As the target is an USB stick (so slow...) it can take a
long time, so please be patient and wait until I give you a "go" before applying
the instructions below.

Meanwhile you can already prepare the internal drive.

All commands below should be typed as root or using sudo.

First as recommended by Forza here:
https://wiki.tnonline.net/w/Btrfs/Replacing_a_disk
issue blkdiscard to clear the internal disk (assuming it's an SSD):

blkdiscard /dev/sda -v

Then make at least two partitions on /dev/sda using gdisk or cgdisk
1. a partition of size 100M, type EFI system (code ef00)
2. a partition use the remaining space, type Linux (thios is the default)

Then format the first partition:
mkfs.fat /dev/sda

Do *not* format the second partition.

Tell us if you need help to use the commands cgdisk or gdisk
For cgdisk type "cgdisk -a /dev/sda" which makes this utility more accessible
(for the records, fulfilling a request from Philippe Delavalade many years ago).

Notes :
a. You may choose to create other partitions on /dev/sda, but the partition
/dev/sda2 should be at least as big as the partition mounted as / on the
external drive (but you can easily shrink the latter first if you want. I will
tell you how if that is the case).
b. I assume that this machine will only boot on EFI mode. Else a not formatted
partition of type BIOS Boot (code ef02) size 4M is also needed to make GRUB 
happy.

Once /dev/sda has been prepared, do this after I give you the "go":

1. Remount the partition hosting / as /mnt
As you installed in auto mode I assume that this is /dev/sdb3, which you can
check with this command:
findmnt -no source /|cut -d[ -f 1

2. Then just type:
mount /dev/sdb3 /mnt

3. To replace (move) the root file system (from) /dev/sdb3 by (to) /dev/sda2 
type:

btrfs replace start 1 /dev/sda2 /mnt

In this command 1 is the device number (should be 1 as this is file system on a
single device), /dev/sda2 the new partition (new location of the file system)
and /mnt the mount point of the current one.

This will take a long time.

You can check the progress typing:
btrs replace status /mnt

You can do that several times (type Ctrl+C get back the prompt)

When the replacement will be completed just reinstall and update grub:

grub-install /dev/sda
update-grub

After that you can check the layout of the new GRUB boot menu typing:
list-boot-entries

You should not have to edit /etc/fstab as the UUID of the root file system will
not have changed.

Here the replacement is done at 77.9%, so expect a "go" or a "no go" in less
than one hour ;)

Meanwhile, questions?

Cheers,
Didier


Le 03/06/2023 à 18:09, Pawel Loba a écrit :

The output of your command is:
/dev/sda
/dev/sdb
where sda i the internal and sdb is the external hard drive.
Thank you,
Pawel

On 6/3/23, Didier Spaier <didier@xxxxxxxx> wrote:
I meant the drive name, as listed in the output of:
lsblk -lpo name,type|grep disk|cut -d" " -f1

Le 03/06/2023 à 19:29, Pawel Loba a écrit :
Machine name on the external drive is deimos.

On 6/3/23, Didier Spaier <appartement.cdm@xxxxxxx> wrote:
Then that will be easy.

I just chatted with btrfs experts to find the simplest way. I will try
locally
before sending a detailed how-to. Meanwhile please tell how the external
internal drive is named.

Cheers,

Didier

Le 03/06/2023 à 18:39, Pawel Loba a écrit :
The internal drive is completely empty with 2 TB space.
The external one was created with auto mode and its size is close to 1
TB.
Thanks,
Pawel

On 6/3/23, Didier Spaier <appartement.cdm@xxxxxxx> wrote:
Probably. Did you install it in auto mode? And do you have an ESP (EFI
System partition) in the internal drive as well as a big enough unused
partition or free space on this drive?
===============================================================================
The Slint mailing list.
Archive: https://www.freelists.org/archive/slint
To subscribe or unsubscribe, email slint-request@xxxxxxxxxxxxx with the subject
'subscribe' or 'unsubscribe', then answer the email you will receive.
More: email slint-request@xxxxxxxxxxxxx with as subject 'help' or 'commands'.

Other related posts: