Rescuing drive with home partition

I am one of those dummies that linux pros think should avoid linux. Before you tell me to read man pages let me tell you I find them written by pros for pros, not for dummies like me.
Problem I got myself into. Got a new SSD created GPT except instead of my backup external drive entered drive with my home partition on it.
Testdisk can find the partitions. Advice I saw said to backup to a backup disk. OK going into live usb I go into partition manager and it has a copy partition option which I than copy onto my new backup SSD when it finishes it throws up a corrupt superblock error. I check fdisk it says damaged gpt. I fix it with gdisk, fdisk says everything fine and go back into manager which shows the copied partition as unknown. It is ext4 partition. Going into Dolphin I can get into original partitions fine (although only 4 at a time as gpt for those partitions is lost.
Are the errors the result I did something that destroyed the SSD?
Or is it because the partition cannot be copied intact?
Do have an external HD on order because I am finding SSDs can be destroyed too easily.
Can I get that unknown partition to show as ext4 and save everything in it?

PS I know I jumped around alot, unfortunately that is the only way my brain functions.

Hi @LRC1962,

Let’s first make sure the problem is understood correctly:

  • You have an SSD and a normal HDD.
  • The SSD’s has an ext4 partition that you can’t see.
  • There was an error on the SSD that you fixed using gparted, but you are still unable to see the ext4 partition, or the data.

You’d like to know if there is any way you can retrieve the data?

Firstly, how much free space do you have on the HDD? Please provide the output of:

lsblk

…as well as:

mount

Tip:

When posting terminal output, copy the output and paste it here, wrapped in three (3) backticks, before AND after the pasted text. Like this:

```
pasted text
```

This will just cause it to be rendered like this:

Sed
sollicitudin dolor
eget nisl elit id
condimentum
arcu erat varius
cursus sem quis eros.

Instead of like this:

Sed sollicitudin dolor eget nisl elit id condimentum arcu erat varius cursus sem quis eros.

Alternatively, paste the text you wish to format as terminal output, select all pasted text, and click the </> button on the taskbar. This will indent the whole pasted section with one TAB, causing it to render the same way as described above.

Thereby increasing legibility thus making it easier for those trying to provide assistance.

1 Like
lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  18.9M  1 loop /run/miso/sfs/livefs
loop1         7:1    0 692.7M  1 loop /run/miso/sfs/mhwdfs
loop2         7:2    0   1.9G  1 loop /run/miso/sfs/desktopfs
loop3         7:3    0 643.7M  1 loop /run/miso/sfs/rootfs
**sda           8:0    0 931.5G  0 disk **
**├─sda1        8:1    0 117.3G  0 part **
**├─sda2        8:2    0 117.3G  0 part **
**├─sda3        8:3    0 117.3G  0 part **
**└─sda4        8:4    0 117.3G  0 part** 
sdb           8:16   1  14.5G  0 disk 
├─sdb1        8:17   1  14.5G  0 part 
│ └─ventoy  254:0    0   3.3G  1 dm   /run/miso/bootmnt
└─sdb2        8:18   1    32M  0 part 
**sdc           8:32   0     2T  0 disk **
**├─sdc1        8:33   0 117.3G  0 part **
**└─sdc2        8:34   0 117.3G  0 part** 
nvme1n1     259:0    0 238.5G  0 disk 
├─nvme1n1p1 259:1    0   300M  0 part 
├─nvme1n1p2 259:2    0 221.2G  0 part 
└─nvme1n1p3 259:3    0    17G  0 part 
nvme0n1     259:4    0 238.5G  0 disk 
├─nvme0n1p1 259:5    0   260M  0 part 
├─nvme0n1p2 259:6    0    16M  0 part 
├─nvme0n1p3 259:7    0 237.7G  0 part 
└─nvme0n1p4 259:8    0   531M  0 part

 
mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8078744k,nr_inodes=2019686,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/mapper/ventoy on /run/miso/bootmnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
cowspace on /run/miso/cowspace type tmpfs (rw,relatime,size=262144k,mode=755,inode64)
overlay_root on /run/miso/overlay_root type tmpfs (rw,relatime,size=12163200k,mode=755,inode64)
/dev/loop0 on /run/miso/sfs/livefs type squashfs (ro,relatime,errors=continue)
/dev/loop1 on /run/miso/sfs/mhwdfs type squashfs (ro,relatime,errors=continue)
/dev/loop2 on /run/miso/sfs/desktopfs type squashfs (ro,relatime,errors=continue)
/dev/loop3 on /run/miso/sfs/rootfs type squashfs (ro,relatime,errors=continue)
overlay on / type overlay (rw,relatime,lowerdir=/run/miso/sfs/livefs:/run/miso/sfs/mhwdfs:/run/miso/sfs/desktopfs:/run/miso/sfs/rootfs,upperdir=/run/miso/overlay_root/upper,workdir=/run/miso/overlay_root/work,index=off,xino=off)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=20445)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,size=8108800k,nr_inodes=1048576,inode64)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /etc/pacman.d/gnupg type tmpfs (rw,relatime,mode=755,inode64)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1621756k,nr_inodes=405439,mode=700,uid=1000,gid=1000,inode64)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

I intended to make it strong but within <> it just came out as **. This was to point to the 2 drives in play. sda is a HD and that was the one I accidentally GPTed losing the file system journals.
sdc is the SSD which I am trying to copy the 4 seen partitions from sda into and keeps throwing corrupted superblocks when partition manager is finishing up coping the partition. This results in damaged GPT which I can fix temporarily (reboot returns the GPT to damaged state. The manager shows 1 partition that was copied, but unknown state.
Thought this may help:

lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT
NAME        FSTYPE     SIZE MOUNTPOINT
sda                  931.5G 
├─sda1      ext4     117.3G 
├─sda2      ext4     117.3G 
├─sda3      ext4     117.3G 
└─sda4      ext4     117.3G 
sdc                      2T 
├─sdc1               117.3G 
└─sdc2               117.3G 

sda1->sdc1. sda2->sdc2

The 4 sda partitions come from using testdisk.

Is this home - partition on SSD or HDD ?

  1. It may be advisable to NOT use graphical tools to rescue the damaged partition
  2. Please do not alter the HD in any way before you have proof that your saved data is usable.

Good luck

The HD is the home partition drive and other than the GPT goof and using testdisk to find partitions, I have not touched it.
Unless given step by step instructions to using terminal I can not figure out how to get a partition copy from one drive to another. Part of the reason is I can find a hundred examples all different and maybe actually one example is the one I need. Like I said trying to decipher man pages is really beyond my brain capabilities. Copying examples is easy. That is why I tend to use graphical tools more.

PS I stopped using Windows decades ago because it was getting too costly and hardware wore out too fast. linux (other than when I goof up has been great. Reason I really would like to recover drive is because setups are just like I want them from decades of use.

Note: sdb is my live usb that I am running now.

So which of these disks is the ONE where the home has been ? (look for the size)

Since you have overwritten the partition table, the information about existing partitions shown above is useless!

Restoring a partition without a valid partition table is out of my league. You need someone who has done this (several times) before, to help you.

What you want to do before you fiddle with your original drive is:
you want to make a bit by bit exact copy of the whole drive! (not just a partition - they are messed up anyway …)
so you’ll have the option to go back and start again
when something during your recovery procedure does not go to plan.

For that you need another drive - at least equally large as the original.

Then you copy from your defunct drive to that backup drive.

The command to use is

sudo dd if=/dev/sdX of=/dev/sdY

you can add more options to the command to perhaps speed up the process

to find the names (as in /dev/sdX or /dev/sdY …)
use the lsblk -f command
or watch the system log while you connect the drives
sudo dmesg -w

This will show you, live, what the drives are called …

as you can imagine - it is absolutely crucial that you get the input and output correct :wink:

if= (input file) in that command
(if=/dev/sdX) is the drive you are copying from - this is your bad drive

of= (output file)
(of=/dev/sdY) is the drive you are transferring that data to - the target, your rescue copy

sda has my home partition which I would like to recover. It is an HD.
sdc is the SSD which I am trying to copy my old partitions to so that I can save them. That is the drive that keeps giving me superblock and GPT errors. Question is: is the SSD basically dead or is the original partition corrupted in some way. I can get into the partition that way, but I know from past experience no matter the claims, that copying that way, keeping the original permissions intact is almost impossible.

I think the answer to that is clear - you said yourself that the original got messed up when you put a GPT partition table on it

You want an exact copy (see above).
Then you can try and recover your original.

Do yourself a favor and do not try to work with the copy - this is just your backup.

Once you have your backup made (see above) - you can try fixing the original

I’m not sure at all
that what you have now is indeed an exact copy.
The method you used is unfamiliar to me - I only know for sure that and how dd works

… I do not know how to operate testdisk - but since you know that just the partition format was changed, the options it presents should be … understandable

Good luck!


I would rather not doubt the SSD right now - but if you do:
it is, for that reason alone, not a good choice as a backup medium

choose another drive which you do trust to be in working order

1 Like

using a new HD external drive, the dd command

sudo dd if=/dev/sdX of=/dev/sdY

appears to be successful as the drive shows up. Am unpluging it to save what I did.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.