On 01/01/21 11:34, Chris Bell via GLLUG wrote:
On Friday, 1 January 2021 01:01:11 GMT Mark Preston via GLLUG wrote:
Hi all and I wish you all a happy New Year,

I was trying to create a bootable persistent Linux Mint 20 USB stick
with EFI support from a linux mint20 .iso downloaded from the internet.
but something went wrong and...now I get an unallocated hard drive message.

I would like to know how to repair / fix an unallocated hard drive, if
possible, preferably without losing the data on it.

The computer was was purchased in 2015 from dnuk.com and came as follows:

Deskstar D540 R3
sda1 100GB ext4 /
sda2 8 GB swap
sda3 1700 ext4 /home
Raw capacity 2000 GB
Intel core i5-4430
GFX Controller NVIDIA GT 610
I might have reduced / to 10 GB, but I can't remember for sure. It was
running Linux Mint 19.0 and originally Debian 7.7
I've also had the following:
Bad magic number in super block error

I'm hoping to make it bootable again and return to using it as before,
if possible. It seeems to be advisable to copy the dev/sda disk to
another hard drive using GNU ddrescue. Something like ddrescue
--no-split /dev/sda /media/usbdrive/image /media/usbdrive/logfile onto a
4 TB portable drive maybe. Just in case anything else goes wrong and so
I'll have a copy of what's on the hard drive.

Then maybe use parted rescue START END to rescue lost partitions one at
a time near START and END.

Any suggestions as to how to proceed and hopefully restore the existing
data on the "unallocated space" would be welcome.

I've used a Knoppix 8.6 USB stick to boot the computer and had the
following:

knoppix@Microknoppix:~$ df
Filesystem               1K-blocks    Used Available Use% Mounted on
rootfs                     1980020      52   1979968   1% /
/dev/sdb1                  4916840 4521048    395792  92% /mnt-system
tmpfs                      3170304       0   3170304   0% /ramdisk
/dev/cloop                 9459128 9459128         0 100% /KNOPPIX
/dev/cloop1                2262876 2262876         0 100% /KNOPPIX1
/dev/cloop2                 148074  148074         0 100% /KNOPPIX2
/dev/mapper/KNOPPIX-DATA  25545968   43032  25502936   1% /KNOPPIX-DATA
unionfs                   25545968   43032  25502936   1% /UNIONFS
tmpfs                        20480    3240     17240  16% /run
tmpfs                        10240       4     10236   1% /UNIONFS/var/lock
tmpfs                       102400      76    102324   1% /UNIONFS/var/log
tmpfs                      2097152       4   2097148   1% /tmp
cgroup                          12       0        12   0% /sys/fs/cgroup
udev                         20480       0     20480   0% /dev
tmpfs                      2097152       0   2097152   0% /dev/shm
knoppix@Microknoppix:~$ fdisk -l
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/cloop0: 9 GiB, 9686220800 bytes, 18918400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/cloop1: 2.2 GiB, 2317352960 bytes, 4526080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/cloop2: 144.8 MiB, 151781376 bytes, 296448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/zram0: 2.9 GiB, 3046658048 bytes, 743813 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000DX001-1CM1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 855C35AB-DF58-4AD0-A242-58BC6E6BD581




Disk /dev/sdb: 29.1 GiB, 31205621760 bytes, 60948480 sectors
Disk model: Cruzer Glide 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1661d69a

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdb1  *       2048  9854975  9852928  4.7G  c W95 FAT32 (LBA)
/dev/sdb2       9854976 60948479 51093504 24.4G 83 Linux


Disk /dev/mapper/KNOPPIX-DATA: 24.4 GiB, 26159874048 bytes, 51093504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
knoppix@Microknoppix:~$ fsck -y /dev/sda
fsck from util-linux 2.33.1
e2fsck 1.44.5 (15-Dec-2018)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an
ext2/ext3/ext4 filesystem (and not swap or ufs or something else), then the
superblock is corrupt, and you might try running e2fsck with an alternate
superblock: e2fsck -b 8193 <device>
   or
      e2fsck -b 32768 <device>

Found a gpt partition table in /dev/sda
knoppix@Microknoppix:~$ mke2fs -n /dev/sda
mke2fs 1.44.5 (15-Dec-2018)
Found a gpt partition table in /dev/sda
Proceed anyway? (y,N) N

knoppix@Microknoppix:~$ fixparts /dev/sda
FixParts 1.0.3

Loading MBR data from /dev/sda

This disk appears to be a GPT disk. Use GNU Parted or GPT fdisk on it!
Exiting!

knoppix@Microknoppix:~$ gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): ?
b    back up GPT data to a file
c    change a partition's name
d    delete a partition
i    show detailed information on a partition
l    list known partition types
n    add a new partition
o    create a new empty GUID partition table (GPT)
p    print the partition table
q    quit without saving changes
r    recovery and transformation options (experts only)
s    sort partitions
t    change a partition's type code
v    verify disk
w    write table to disk and exit
x    extra functionality (experts only)
?    print this menu

Command (? for help): p
Disk /dev/sda: 3907029168 sectors, 1.8 TiB
Model: ST2000DX001-1CM1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 855C35AB-DF58-4AD0-A242-58BC6E6BD581
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3907029101 sectors (1.8 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name

Command (? for help): i
No partitions

Command (? for help): b
Enter backup filename to save: /home/knoppix/Desktop/KNOPPIX/gptData
The operation has completed successfully.

Command (? for help): ^C
knoppix@Microknoppix:~$ swapoff -a
swapoff: Not superuser.
knoppix@Microknoppix:~$ sudo swapoff -a
knoppix@Microknoppix:~$ sudo parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help
    align-check TYPE N                        check partition N for
TYPE(min|opt)
          alignment
    help [COMMAND]                           print general help, or help on
          COMMAND
    mklabel,mktable LABEL-TYPE               create a new disklabel
(partition
          table)
    mkpart PART-TYPE [FS-TYPE] START END     make a partition
    name NUMBER NAME                         name partition NUMBER as NAME
    print [devices|free|list,all|NUMBER]     display the partition table,
          available devices, free space, all found partitions, or a
particular
          partition
    quit                                     exit program
    rescue START END                         rescue a lost partition near
START
          and END
    resizepart NUMBER END                    resize partition NUMBER
    rm NUMBER                                delete partition NUMBER
    select DEVICE                            choose the device to edit
    disk_set FLAG STATE                      change the FLAG on selected
device
    disk_toggle [FLAG]                       toggle the state of FLAG on
selected
          device
    set NUMBER FLAG STATE                    change the FLAG on partition
NUMBER
    toggle [NUMBER [FLAG]]                   toggle the state of FLAG on
partition
          NUMBER
    unit UNIT                                set the default unit to UNIT
    version                                  display the version number and
          copyright information of GNU Parted
(parted) ^C

knoppix@Microknoppix:~$ ddrescue --version
GNU ddrescue 1.23
Copyright (C) 2018 Antonio Diaz Diaz.
License GPLv2+: GNU GPL version 2 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
knoppix@Microknoppix:~$

Thank you,
--
Regards,
Mark Preston
Hello Mark Preston,
Would it help to use "lsblk" to list all block devices and "blkid" to list all
UUID's then edit /etc/fstab to include the drive? (man fstab)

I use Debian and prefer to allocate partition space on a HDD for installation
of a later distribution, giving it any name such as "/next", plus a shared
"/srv", then when I use the "/next" partition I will include both "/srv" and
the previous (as "/old") to be used without reformatting.
Both the original "/next" and the "swap" will be re-formatted and given new
UUID's but I am able to edit /old/etc/fstab to the new values as read from the
new /etc/fstab. I am able to create folders/directories on /srv symlinked from
/home/user as /2ndhome, and grub should show both installations as bootable.

Hello Chris Bell,
Thank you very much for your reply. I couldn't get the lsblk command to work on Knoppix 8.6 for some reason, but one of my less successful Mint 20 usb sticks produces the following:

lsblk -a
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0   1.8G  1 loop /rofs
loop1    7:1    0         0 loop
loop2    7:2    0         0 loop
loop3    7:3    0         0 loop
loop4    7:4    0         0 loop
loop5    7:5    0         0 loop
loop6    7:6    0         0 loop
loop7    7:7    0         0 loop
sda      8:0    0   1.8T  0 disk
sdb      8:16   1 119.1G  0 disk
├─sdb1   8:17   1  23.4G  0 part /media/mint/usbdata
├─sdb2   8:18   1     1M  0 part
├─sdb3   8:19   1   122M  0 part
├─sdb4   8:20   1   1.9G  0 part /cdrom
└─sdb5   8:21   1  93.7G  0 part /media/mint/casper-rw1
sdc      8:32   1    29G  0 disk
└─sdc1   8:33   1    29G  0 part /media/mint/USB STICK
sr0     11:0    1  1024M  0 rom

I hope this helps,
Regards,
Mark

--
GLLUG mailing list
GLLUG@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/gllug

Reply via email to