I have a 2 TB HDD which only contains my /home ext4 partion. Now I want to replace the 2 TB HDD by a new 1 TB SSD with a btfs filesystem. So I created the btrfs filesystem using GParted on the SDD and copied the home folder from the HDD to the SSD.

Now I need to switch the old HDD by the new SDD on the SATA port.

sudo fdisk -l                                                                                                                                                                                     
Festplatte /dev/sda: 238,49 GiB, 256060514304 Bytes, 500118192 Sektoren
Festplattenmodell: MTFDDAK256MBF-1A
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: gpt
Festplattenbezeichner: 0BB30CF9-B0AC-40F8-A7B1-AA96C26099E6

Gerät        Anfang      Ende  Sektoren  Größe Typ
/dev/sda1      2048  39064547  39062500  18,6G Linux-Dateisystem
/dev/sda2  39064548  68361422  29296875    14G Linux-Dateisystem
/dev/sda3  68361423 500118158 431756736 205,9G Linux-Dateisystem

Festplatte /dev/sdb: 1,84 TiB, 2000398934016 Bytes, 3907029168 Sektoren
Festplattenmodell: ST2000DM001-1ER1
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 4096 Bytes
E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes
Festplattenbezeichnungstyp: gpt
Festplattenbezeichner: 48E2A6D3-3F36-4836-B852-ABFF4421AA55

Gerät      Anfang       Ende   Sektoren Größe Typ
/dev/sdb1    2048 3907029134 3907027087  1,8T Linux-Dateisystem

Festplatte /dev/sdc: 931,53 GiB, 1000204886016 Bytes, 1953525168 Sektoren
Festplattenmodell: SSD 860 EVO 1TB 
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 4096 Bytes
E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes
Festplattenbezeichnungstyp: gpt
Festplattenbezeichner: EEEF5142-6A96-47E9-BFA5-A8BC04C2E241

Gerät          Anfang       Ende   Sektoren Größe Typ
/dev/sdc1        2048 1916661759 1916659712  914G Linux-Dateisystem
/dev/sdc2  1916661760 1953523711   36861952 17,6G Linux Swap

lsblk -f                                                                                                                                                                                                ~ 
├─sda1 swap   1     swap   851fe218-deb7-4afb-a445-93006e7dd335                [SWAP]
├─sda2 vfat   FAT32 efi    51A5-8449                                14G     0% /boot/efi
└─sda3 ext4   1.0   system 25546b7f-72b3-4f73-b790-a383ae90330c   23,1G    88% /
└─sdb1 ext4   1.0   home   4d37b9c6-2d26-420c-be46-78c1f9c66c42    1,2T    30% /home
├─sdc1 btrfs        home   2b16c066-cb0b-4b56-84ef-1b5abf54958f  353,1G    61% /run/media/username/home
└─sdc2 swap   1     swap   18990bb8-3d26-4310-88c8-232a27e4b895                

cat /etc/fstab                                                                                                                                                                                         
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=25546b7f-72b3-4f73-b790-a383ae90330c / ext4 defaults,rw,noatime,discard 0 1
UUID=4d37b9c6-2d26-420c-be46-78c1f9c66c42 /home ext4 defaults,rw,relatime,data=ordered 0 0
UUID=851fe218-deb7-4afb-a445-93006e7dd335 swap swap defaults 0 0
UUID=51A5-8449 /boot/efi vfat defaults,rw,noatime 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 

sudo blkid                                                                                                                                                                                             
/dev/sda1: LABEL="swap" UUID="851fe218-deb7-4afb-a445-93006e7dd335" TYPE="swap" PARTUUID="d72c4a74-fcd6-498a-913e-b78f28327169"
/dev/sda2: LABEL_FATBOOT="efi" LABEL="efi" UUID="51A5-8449" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="937471ed-55b5-409c-ba3e-ff7728d7a2e2"
/dev/sda3: LABEL="system" UUID="25546b7f-72b3-4f73-b790-a383ae90330c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="811a594b-c86d-4189-b632-7bcfd3383b6e"
/dev/sdb1: LABEL="home" UUID="4d37b9c6-2d26-420c-be46-78c1f9c66c42" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="110eb793-5ea2-49ad-8bcf-555bf1265874"
/dev/sdc1: LABEL="home" UUID="2b16c066-cb0b-4b56-84ef-1b5abf54958f" UUID_SUB="1b2aa75c-3b7e-415d-973a-8a8fb668a6b3" BLOCK_SIZE="4096" TYPE="btrfs" PARTLABEL="samsung_evo_ssd" PARTUUID="a920880d-0dfd-4157-8bfd-136dfc553996"
/dev/sdc2: LABEL="swap" UUID="18990bb8-3d26-4310-88c8-232a27e4b895" TYPE="swap" PARTLABEL="samsung_evo_swap" PARTUUID="fd3644a3-8edb-4179-8b4b-80796e298231"

I want to switch /dev/sdb (HDD) with /dev/sdc (SSD), so that the SSD will become /dev/sdb.

Can I just replace:

UUID=4d37b9c6-2d26-420c-be46-78c1f9c66c42 /home ext4 defaults,rw,relatime,data=ordered 0 0


UUID=2b16c066-cb0b-4b56-84ef-1b5abf54958f /home btrfs defaults,rw,relatime,data=ordered 0 0

in file /etc/fstab?


Yes, you can just replace the line in /etc/fstab file, but you have to remove data=ordered for the btrfs file system.

UID=2b16c066-cb0b-4b56-84ef-1b5abf54958f /home btrfs defaults,rw,relatime 0 0

because of the error:

failed to mount home dependency failed for local file systems

I found the problem using journalctl -xb:

BTRFS unrecognized mount option 'data=ordered'

| improve this answer | |
  • I think you could have found out directly by mount /home after changing /etc/fstab, and unmountng it first. I.e. you don't even have to reboot. (Except for testing if it will boot :-) – rastafile Apr 8 at 16:31

The first step is to copy the contents of the home folder to the new drive. It's an important distinction. The root of the new partition on the new drive should contain the individual folders for each user... not a single home folder. Additionally, you need to be extra sure that hidden files were also copied and that permissions were preserved during the copy. Just making sure there's no confusion there.

You cannot simply change /dev/sdc1 to be /dev/sdb1 and doing so wouldn't accomplish what you want anyway. Instead, as you guessed, you need to change the UUID of the partition set to be mounted as /home in your fstab. So yes, replace UUID="4d37b9c6-2d26-420c-be46-78c1f9c66c42" with UUID="2b16c066-cb0b-4b56-84ef-1b5abf54958f" in your fstab.

Then reboot.

| improve this answer | |
  • I would also change relatime for HDD to noatime for SSD. – oldfred Apr 8 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.