Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
6
votes
3
answers
1413
views
Changing HFSPlus UUID from PartedMagic
I needed to make a clone of my hard drive recently (bad blocks FTW). I was using Clonezilla at the time. However, Clonezilla refused to copy the HFS+ partition, so I did it manually. The problem is that the UUIDs are out of sync. What is the command to set a specific UUID for HFS+?
I needed to make a clone of my hard drive recently (bad blocks FTW). I was using Clonezilla at the time.
However, Clonezilla refused to copy the HFS+ partition, so I did it manually. The problem is that the UUIDs are out of sync.
What is the command to set a specific UUID for HFS+?
Kaz Wolfe
(495 rep)
Sep 7, 2014, 05:45 AM
• Last activity: Mar 16, 2025, 06:40 AM
0
votes
1
answers
84
views
I set the cylinder head sector count to 0, how do I undo this?
I was playing around with `testdisk`, `gdisk` and `fdisk`, and I set the cylinder head sector count to zero by mistake, and the system now reports "no medium". I tried opening the drive with `gdisk`, `fdisk`, `cfdisk`, `sfdisk`, `cgdisk`, `sgdisk`, `fixparts`, `testdisk`, `parted`, `gparted`, `partx...
I was playing around with
testdisk
, gdisk
and fdisk
, and I set the cylinder head sector count to zero by mistake, and the system now reports "no medium". I tried opening the drive with gdisk
, fdisk
, cfdisk
, sfdisk
, cgdisk
, sgdisk
, fixparts
, testdisk
, parted
, gparted
, partx
, mkfs. mke2fs
, fsck e2fsck
, and badblocks
and all of those returned "no medium" or simular response as well.
hdparm
and sdparm
seemed to offer hope, but none of the changes I tried worke:
# hdparm /dev/sda
was
4000000/64/32, sectors=8192000008, start=0
is
1024/0/62, sectors=0, start=0
# sdparm /dev/sda warning: mode page seems malformed
The page number field should be 0x01,0x02,etc...
but is 0x00
Hereafter field position exceeds mode page length=2
My OS
# uname -a
Linux debian 5.10.0-22-amd64 #1 SMP Debian 5.10.178-3 (2023-04-22) x86_64 GNU/Linux
My VM environment
# systemd-detect-virt
none
How can I fix this?
As far as how i set my chs to 0/0/0
I don't know.
at the time i was playing around with
testdisk
gdisk
fdisk
I was rearranging the geometry for absolutely no reason.
I was going back and forth from windows to Linux.
Various identifiers changed such as the pid now reads pid:2010.
I can’t remember what it was but it wasn’t that.
size changed while not tinkering, “windows”.
at some point heads read zero.
the disk use to have a “real” name but it kept changing.
went from Disk model: ???
to Disk model: USB Disk
...
now it's Disk model: Generic Flash Disk 2.0
aaron Purifoy
(1 rep)
Feb 1, 2025, 04:47 PM
• Last activity: Feb 10, 2025, 07:19 AM
0
votes
0
answers
79
views
Server stuck with Secure Boot error "problem with revocation key (-74)" after online repartitioning
I tried to resize partitions on a SLES 15 server by using gdisk. No matter what I try to do, I cant get it to work after rebooting the system. Initial situation: I have a boot partition (/dev/sda1), a / partition (/dev/sda2), a /home partition (/dev/sda3) and swap (/dev/sda4). I want to recreate the...
I tried to resize partitions on a SLES 15 server by using gdisk.
No matter what I try to do, I cant get it to work after rebooting the system.
Initial situation:
I have a boot partition (/dev/sda1), a / partition (/dev/sda2), a /home partition (/dev/sda3) and swap (/dev/sda4).
I want to recreate the /home partition with less space and increase space on the / partition.
These are the steps I did:
1.
/home
2. delete and recreate partitions:
SRV01:~ # gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sda: 209715200 sectors, 100.0 GiB
Model: Virtual disk
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): E6F4D731-D49F-4BD7-8AF7-A0EDA544AE8C
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 209715166
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00
2 1050624 84936703 40.0 GiB 8300
3 84936704 143968255 28.1 GiB 8300
4 143968256 209715166 31.3 GiB 8200
Command (? for help): d
Partition number (1-4): 4
Command (? for help): d
Partition number (1-3): 3
Command (? for help): d
Partition number (1-2): 2
Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-209715166, default = 1050624) or {+-}size{KMGTP}:
Last sector (1050624-209715166, default = 209715166) or {+-}size{KMGTP}: +60G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): n
Partition number (3-128, default 3): 3
First sector (34-209715166, default = 126879744) or {+-}size{KMGTP}:
Last sector (126879744-209715166, default = 209715166) or {+-}size{KMGTP}: +8G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): n
Partition number (4-128, default 4): 4
First sector (34-209715166, default = 143656960) or {+-}size{KMGTP}:
Last sector (143656960-209715166, default = 209715166) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): L
Type search string, or to show all codes: swap
8200 Linux swap a502 FreeBSD swap
a582 Midnight BSD swap a901 NetBSD swap
bf02 Solaris swap
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
3. read partition table with
4. create filesystem for /home partition:
SRV01:~ # mkfs.xfs /dev/sda3
meta-data=/dev/sda3 isize=512 agcount=4, agsize=524288 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=0 bigtime=0 inobtcount=0
data = bsize=4096 blocks=2097152, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Discarding blocks...Done.
5. resize the / filesystem
SRV01:~ # btrfs filesystem resize max /
Resize device id 1 (/dev/sda2) from 40.00GiB to max
6. add new device UUIDs into fstab (device UUID for / partition stays the same, otherwise it would be needed to update it in /boot partition in the grub config as well)
7. mount filesystems with -a
At this point everything works without any issue.
But if I reboot the system the Bootloader opens up and then I get the message : Problem with revocation key (-74)
How can this be resolved?
Luke
(21 rep)
Jan 16, 2025, 01:42 PM
• Last activity: Jan 16, 2025, 07:17 PM
39
votes
5
answers
175668
views
Remove GPT - Default back to MBR
I keep receiving this error: > Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted I want to go back to the normal MBR. I found some advice [here](http://lukas.zapletalovi.com/2011/12/how-to-get-rid-of-guid-partition-table.html) and did: parted /dev/sda mklabel msdos quit But w...
I keep receiving this error:
> Warning!! Unsupported GPT (GUID Partition Table) detected. Use GNU Parted
I want to go back to the normal MBR. I found some advice [here](http://lukas.zapletalovi.com/2011/12/how-to-get-rid-of-guid-partition-table.html) and did:
parted /dev/sda
mklabel msdos
quit
But when I get to the
mklabel
option it spits out a warning that I will lose all data on /dev/sda
. Is there a way to get the normal MBR back without formatting the disk?
sayth
(579 rep)
Jan 13, 2013, 02:18 PM
• Last activity: Jan 3, 2025, 11:54 AM
0
votes
2
answers
89
views
Where does the "Physical size" information come from?
I have an embedded Linux device (not a Raspberry Pi) which has two partitions on an eMMC drive. I have used a vendor-provided tool to copy these two partitions onto a USB drive whose size roughly equals the size of the eMMC drive. What I did next was mount the USB drive onto a Linux computer and use...
I have an embedded Linux device (not a Raspberry Pi) which has two partitions on an eMMC drive. I have used a vendor-provided tool to copy these two partitions onto a USB drive whose size roughly equals the size of the eMMC drive.
What I did next was mount the USB drive onto a Linux computer and use tools such as
e2fsck
and resize2fs -M
to resize the second filesystem to a minimum viable size, and finally used gdisk
to resize the partition itself to match.
In all calculations I've been careful to ensure that the partition does not get smaller than the filesystem, even to a point where I've made the partition slightly larger, and then used resize2fs
to enlarge the filesystem to match it.
After these operations I have a 16 GB USB drive with a 118 MiB boot partition and a 3.1 GiB root filesystem partition. I then used dd
to read data directly from the USB drive, utilizing bs=
and count=
parameters to limit the amount of data read to only extend up to where the second partition ends plus an extra sector to accommodate the "zero sector".
The result is that I now have an image file in which the two partitions have exactly the size of their corresponding sources but when I use the "File" -> "Properties" option of the 7-Zip tool it claims that the "Physical size" (circled in red) is larger than these partitions, and larger than what I instructed dd
to copy from the source.
Where does this "Physical size" value come from? Is it part of the partition table? Or does dd
read it from the disk somehow?
Is there any way for me to modify it so as to get rid of the "Unexpected end of data" error?

Antti Keskinen
(3 rep)
Sep 23, 2024, 02:37 PM
• Last activity: Sep 23, 2024, 08:00 PM
0
votes
1
answers
197
views
Error Formatting Disk - Drive Missing
So I had a somewhat faulty HDD (missed partition table) and plugged it in my linux in the SATA port. It was only showing as /dev/sda , no /sda1 whatsoever. In order to reformat its partition table I was following a tutorial and using gdisk, and I did this ``` Command (? for help): n Partition number...
So I had a somewhat faulty HDD (missed partition table) and plugged it in my linux in the SATA port. It was only showing as /dev/sda , no /sda1 whatsoever. In order to reformat its partition table I was following a tutorial and using gdisk, and I did this
Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-1953525134, default = 2048) or {+-}size{KMGTP}: 4096
Last sector (4096-1953525134, default = 1953523711) or {+-}size{KMGTP}: 1953523711
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Afterwards I did v
then w
. And in lsblk
/dev/sda started showing 0B instead of the expected 1Tb. gdisk
said it had no space left on device.
I restarted to see if that would work and then it was gone from the lsblk
output. And now it doesn't appear in anything else (tried gdisk, fdisk, smartctl
and dmesg
). No sd* letter assigned to it.
Is there any way for me to get it back or now it's gone for good?
I really don't know my way around filesystems and whatnot.
Yuri Teixeira Mendes
(1 rep)
Jan 10, 2024, 12:22 AM
• Last activity: Jan 10, 2024, 01:03 AM
0
votes
0
answers
115
views
Problems after migrating drives to HBA-connected disk shelf
I had 4 drives (2x3TB, 1x4TB, 1x18TB) in USB SATA docks connected to my proliant server. I finally got my HBA to recognize my IBM disk array, and managed to get the drives recognized in Ubuntu server 22.04. Problem is, I'm now having filesystem errors when I try to mount the drives. They all have da...
I had 4 drives (2x3TB, 1x4TB, 1x18TB) in USB SATA docks connected to my proliant server. I finally got my HBA to recognize my IBM disk array, and managed to get the drives recognized in Ubuntu server 22.04. Problem is, I'm now having filesystem errors when I try to mount the drives. They all have data on them, and I'd rather not lose it. I've got the entirety of my coding history over the last 4 years on these drives, as well as all of my music production (stems, original Cubase project files, etc.) and my family photos.
I've tried
gdisk /dev/sdb
and then x
and then v
and e
for the experts menu, but to no avail. Below is the -v
output. Any ideas to get these partition tables corrected and remount the drives?
root@ganymede:/home/ubuntu# gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.8
Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help):
Command (? for help): v
Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.
Problem: The secondary header's self-pointer indicates that it doesn't reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.
Problem: Disk is too small to hold all the data!
Disk size is 5860467632 sectors, needs to be 5860533168 sectors.)
The 'e' option on the experts' menu may fix this problem.
Warning: There is a gap between the main partition table (ending sector 33)
and the first usable sector (65535). This is helpful in some exotic configurations,
but is unusual. The util-linux fdisk program often creates disks like this.
Using 'j' on the experts' menu can adjust this gap.
Problem: GPT claims the disk is larger than it is! (Claimed last usable
sector is 5860533134, but backup header is at
5860533167 and disk size is 5860467632 sectors.
The 'e' option on the experts' menu will probably fix this problem
Problem: partition 1 is too big for the disk.
Caution: Partition 1 doesn't begin on a 8-sector boundary. This may
result in degraded performance on some modern (2009 and later) hard disks.
Consult http://www.ibm.com/developerworks/linux/library/l-4kb-sector-disks/
for information on disk alignment.
Identified 5 problems!
Command (? for help):
Trying the listed suggestions (using e
in the experts menu and then using j
in the experts menu) results in the following errors:
Command (? for help): x
Expert command (? for help): e
Relocating backup data structures to the end of the disk
Expert command (? for help): j
Currently, main partition table begins at sector 2 and ends at sector 33
Enter new starting location (2 to 65503; default is 2; 1 to abort): 2
Expert command (? for help): w
Warning! Secondary partition table overlaps the last partition by 131037 blocks!
You will need to delete this partition or resize it in another utility.
Problem: partition 1 is too big for the disk.
Aborting write operation!
Aborting write of new partition table.
Expert command (? for help):
Devin Gardner
(1 rep)
Jul 1, 2023, 05:34 PM
• Last activity: Jul 1, 2023, 05:46 PM
6
votes
3
answers
12830
views
unable to dd, smartmon, fdisk or anything on a working external Western Digital Hard Drive
I bought a WD HD on Amazon used because I wanted one that was exactly like another that I hosed. I can't do anything with the HD. The drive is definitely /dev/sdb, but it also mounts /dev/sr0 ``` ~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 698.7G 0 disk ├─sda1 8:1 0 300M 0 part /boot/...
I bought a WD HD on Amazon used because I wanted one that was exactly like another that I hosed.
I can't do anything with the HD.
The drive is definitely /dev/sdb, but it also mounts /dev/sr0
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 698.7G 0 disk
├─sda1 8:1 0 300M 0 part /boot/efi
├─sda2 8:2 0 900M 0 part
├─sda3 8:3 0 128M 0 part
├─sda4 8:4 0 343.1G 0 part
├─sda5 8:5 0 314.4G 0 part /
├─sda6 8:6 0 19.5G 0 part [SWAP]
├─sda7 8:7 0 350M 0 part
└─sda8 8:8 0 20G 0 part
sdb 8:16 0 2.7T 0 disk
sr0 11:0 1 30M 0 rom
## fdisk
Trying to use fdisk on either device (partition?) gives me the same error
$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
fdisk: cannot open /dev/sdb: Input/output error
## dd
Even dd
won't write zeros to the devices
$ sudo dd if=/dev/zero count=1 of=/dev/sdb
dd: writing to '/dev/sdb': Input/output error
1+0 records in
0+0 records out
0 bytes copied, 0.0011181 s, 0.0 kB/s
$ sudo dd if=/dev/zero count=1 of=/dev/sr0
dd: failed to open '/dev/sr0': Read-only file system
## wipefs and cfdisk
I tried using wipefs and cfdisk, without any success:
$ sudo cfdisk /dev/sdb
cfdisk: cannot open /dev/sdb: Input/output error
$ sudo cfdisk /dev/sr0
cfdisk: cannot open /dev/sr0: Read-only file system
$ sudo wipefs /dev/sr0
offset type
----------------------------------------------------------------
0x0 mac [partition table]
0x8001 udf [filesystem]
LABEL: WD Unlocker
UUID: 50EB4C87
$ sudo wipefs -a /dev/sr0
wipefs: error: /dev/sr0: probing initialization failed: Device or resource busy
$ sudo wipefs -a /dev/sr0
wipefs: error: /dev/sr0: probing initialization failed: Device or resource busy
$ sudo wipefs --all -f /dev/sr0
wipefs: error: /dev/sr0: probing initialization failed: Read-only file system
## gdisk
I tried using gdisk, which I think says that the disk is working, with the v command.
$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.1
Warning! Read error 5; strange behavior now likely!
Warning! Read error 5; strange behavior now likely!
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): v
No problems found. 732558325 free sectors (2.7 TiB) available in 1
segments, the largest of which is 732558325 (2.7 TiB) in size.
Command (? for help): d
No partitions
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sdb.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
I rebooted and nothing was different, so I tried gdisk on the other device.
$ sudo gdisk /dev/sr0
GPT fdisk (gdisk) version 1.0.1
NOTE: Write test failed with error number 30. It will be impossible to save
changes to this disk's partition table!
Partition table scan:
MBR: not present
BSD: not present
APM: present
GPT: not present
*******************************************************************
This disk appears to contain an Apple-format (APM) partition table!
It will be destroyed if you continue!
*******************************************************************
Creating new GPT entries.
Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): Y
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): U
Your option? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sr0.
Unable to open device '/dev/sr0' for writing! Errno is 30! Aborting write!
Command (? for help): v
No problems found. 15341 free sectors (30.0 MiB) available in 1
segments, the largest of which is 15341 (30.0 MiB) in size.
## Long shot password reset attempt with WD-Decrypte
I also tried using what I thought would let me reset the password, if there there is one.
https://github.com/SofianeHamlaoui/WD-Decrypte
I didn't clone the repo, I just copied the python script and ran the following:
$ vi cookpw.py ## copy paste from the github repo
$ chmod u+x cookpw.py
$ ./cookpw.py passwd >password.bin
$ sg_raw -s 40 -i password.bin /dev/sdb c1 e1 00 00 00 00 00 00 28 00
/dev/sdb: Permission denied
$ sudo sg_raw -s 40 -i password.bin /dev/sdb c1 e1 00 00 00 00 00 00 28 00
SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request
Additional sense: Authentication failed
$ stat password.bin
File: 'password.bin'
Size: 40 Blocks: 8 IO Block: 4096 regular file
Device: 805h/2053d Inode: 15205314 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/ xxxx) Gid: ( 1002/ gene)
Access: 2020-08-14 01:03:29.395345709 -0500
Modify: 2020-08-14 01:02:38.939618244 -0500
Change: 2020-08-14 01:02:38.939618244 -0500
Birth: -
$ sudo sg_raw -s 40 -i password.bin /dev/sdb c1 e1 00 00 00 00 00 00 28 00
SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Not Ready
Additional sense: Logical unit is in process of becoming ready
$ sudo sg_raw -s 40 -i password.bin /dev/sdb c1 e1 00 00 00 00 00 00 28 00
SCSI Status: Check Condition
Sense Information:
Fixed format, current; Sense key: Illegal Request
Additional sense: Authentication failed
## Hard drive model
This is the hard drive I ordered:
WD My Book 3TB External Hard Drive Storage USB 3.0 File Backup and Storage
Model Number: WDBACW0030HBK-NESN
## File structure and GUI disk management tools in Windows and Linux
When I load it in disk managers (Windows or Ubuntu), everything useful is grayed out. I can't check the smart status, format, there is no drive letter.
The drive does appear in the Linux file browser, and I can see some default files, and copy them out.
$ tree /media/gene/WD\ Unlocker/
/media/gene/WD Unlocker/
├── autorun.inf
├── Extras
│ └── VCDVersion.xml
├── Unlock.exe
├── WD Quick Formatter.exe
└── WD SmartWare
├── Locale
│ ├── cs_CZ.lproj
│ │ ├── CSS
│ │ │ └── WDSmartWareHelp.css
│ │ ├── EULA.html
│ │ ├── EX_UNLK0.html
│ │ ├── EX_UNLK1B.html
│ │ ├── EX_UNLK1.html
│ │ ├── EX_UNLK3.html
│ │ ├── localizable.strings
│ │ ├── UNLK2.html
│ │ └── VCDF.html
│ ├── de_DE.lproj
... (lots of languages)...
│ │ └── VCDF.html
│ └── zh_TW.lproj
│ ├── CSS
│ │ └── WDSmartWareHelp.css
│ ├── EULA.html
│ ├── EX_UNLK0.html
│ ├── EX_UNLK1B.html
│ ├── EX_UNLK1.html
│ ├── EX_UNLK3.html
│ ├── localizable.strings
│ ├── UNLK2.html
│ └── VCDF.html
└── SmartWare_CD.ico
## Conclusion
I thought this would be pretty easy to format, but I'm at my wit's end. Any ideas?
# EDIT Aug 14, 2020:
I added some headers and punctuation to make the question easier to navigate and am adding the following documentation:
## DMSG OUTPUT
**EDIT: UNFILTERED DMSG BELOW**
When I checked dmsg last night I thought that the "callbacks suppressed" numbers were higher; in the 50's. I have no idea what anything in dmsg means, but the callback part looked strange so I googled it (and still have no idea what it means).
$ dmesg | grep -i scsi
[ 0.304565] SCSI subsystem initialized
[ 1.212532] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 1.414640] scsi host0: ahci
[ 1.414791] scsi host1: ahci
[ 1.414941] scsi host2: ahci
[ 1.415069] scsi host3: ahci
[ 1.764038] scsi 0:0:0:0: Direct-Access ATA TOSHIBA MQ01ABD0 2J PQ: 0 ANSI: 5
[ 1.764616] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 1.877339] sd 0:0:0:0: [sda] Attached SCSI disk
[ 133.590618] scsi host4: usb-storage 2-2:1.0
[ 134.589496] scsi 4:0:0:0: Direct-Access WD My Book 1170 1042 PQ: 0 ANSI: 6
[ 134.590008] scsi 4:0:0:1: CD-ROM WD Virtual CD 1170 1042 PQ: 0 ANSI: 6
[ 134.591206] scsi 4:0:0:2: Enclosure WD SES Device 1042 PQ: 0 ANSI: 6
[ 134.592861] sd 4:0:0:0: Attached scsi generic sg1 type 0
[ 134.594305] sr 4:0:0:1: [sr0] scsi3-mmc drive: 51x/51x caddy
[ 134.594664] sr 4:0:0:1: Attached scsi CD-ROM sr0
[ 134.594971] sr 4:0:0:1: Attached scsi generic sg2 type 5
[ 134.595493] scsi 4:0:0:2: Attached scsi generic sg3 type 13
[ 141.554025] scsi 4:0:0:2: Wrong diagnostic page; asked for 1 got 0
[ 141.554033] scsi 4:0:0:2: Failed to get diagnostic page 0xffffffea
[ 141.554038] scsi 4:0:0:2: Failed to bind enclosure -19
[ 143.664433] sd 4:0:0:0: [sdb] Attached SCSI disk
[ 232.696987] scsi_io_completion: 6 callbacks suppressed
[ 347.602357] scsi_io_completion: 8 callbacks suppressed
[ 363.163922] scsi_io_completion: 7 callbacks suppressed
[ 668.971338] scsi_io_completion: 8 callbacks suppressed
## SMART monitoring
Using smartctl on /dev/sdb doesn't work, I needed to add the -d option.
However, this was interesting:
$ sudo smartctl -a -T verypermissive /dev/sdb
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-184-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
/dev/sdb: Unknown USB bridge [0x1058:0x1170 (0x1042)]
Please specify device type with the -d option.
Use smartctl -h to get a usage summary
I feel like I've seen this USB bridge error before, but I did switch cables in case it was a physical cable issue (it wasn't).
After some research I added the -d scsi option and I get this:
$ sudo smartctl -a -d scsi -T verypermissive /dev/sdb
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-184-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: WD
Product: My Book 1170
Revision: 1042
Compliance: SPC-4
User Capacity: 3,000,558,944,256 bytes [3.00 TB]
Logical block size: 4096 bytes
Form Factor: 3.5 inches
Serial number: WCC1T0867040
Device type: disk
Local Time is: Fri Aug 14 09:19:09 2020 CDT
device Test Unit Ready [unknown error (unexpected sense key)]
SMART support is: Unavailable - device lacks SMART capability.
=== START OF READ SMART DATA SECTION ===
Error Counter logging not supported
No self-tests have been logged
The smartctl command on /dev/sr0 doesn't need the scsi specification, who knows why?
$ sudo smartctl -a -T verypermissive /dev/sr0
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-184-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: WD
Product: Virtual CD 1170
Revision: 1042
Compliance: SPC-4
User Capacity: 31,457,280 bytes [31.4 MB]
Logical block size: 2048 bytes
Serial number: WCC1T0867040
Device type: CD/DVD
Local Time is: Fri Aug 14 09:19:36 2020 CDT
SMART support is: Unavailable - device lacks SMART capability.
=== START OF READ SMART DATA SECTION ===
Error Counter logging not supported
Device does not support Self Test logging
I think these results say that the disk is present, but there is no logging? Do I need to turn on smartctl?
I noticed this in the documentation:
smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda
Enable SMART on drive /dev/sda, enable automatic offline testing every four hours, and enable autosaving of SMART Attributes. This is a good start-up line for your system´s init files. You can
issue this command on a running system.
## READ ONLY - hdparm and physical drive
I neglected to mention that one of the first things I did was issue these commands:
$ sudo hdparm -r0 /dev/sdb
/dev/sdb:
setting readonly to 0 (off)
readonly = 0 (off)
$ sudo hdparm -r0 /dev/sr0
/dev/sr0:
setting readonly to 0 (off)
readonly = 0 (off)
This did nothing to resolve the read only status.
Also, there is no lock switch anywhere on the hard drive, and I've pressed the power button several times over the past couple of weeks since getting the drive.
# Edit Aug 14, 2020 (2)
After reattaching the hard drive these are my messages:
[29847.050551] usb 2-2: USB disconnect, device number 2
[29851.566835] usb 2-2: new SuperSpeed USB device number 3 using xhci_hcd
[29851.583422] usb 2-2: New USB device found, idVendor=1058, idProduct=1170
[29851.583426] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[29851.583430] usb 2-2: Product: My Book 1170
[29851.583433] usb 2-2: Manufacturer: Western Digital
[29851.583435] usb 2-2: SerialNumber: 574343315430383637303430
[29851.584159] usb-storage 2-2:1.0: USB Mass Storage device detected
[29851.584269] scsi host5: usb-storage 2-2:1.0
[29852.583294] scsi 5:0:0:0: Direct-Access WD My Book 1170 1042 PQ: 0 ANSI: 6
[29852.583557] scsi 5:0:0:1: CD-ROM WD Virtual CD 1170 1042 PQ: 0 ANSI: 6
[29852.584436] scsi 5:0:0:2: Enclosure WD SES Device 1042 PQ: 0 ANSI: 6
[29852.586165] sd 5:0:0:0: Attached scsi generic sg1 type 0
[29852.587224] sd 5:0:0:0: [sdb] Spinning up disk...
[29852.587638] sr 5:0:0:1: [sr0] scsi3-mmc drive: 51x/51x caddy
[29852.589827] sr 5:0:0:1: Attached scsi CD-ROM sr0
[29852.590297] sr 5:0:0:1: Attached scsi generic sg2 type 5
[29852.592576] ses 5:0:0:2: Attached Enclosure device
[29852.592932] ses 5:0:0:2: Attached scsi generic sg3 type 13
[29852.593612] ses 5:0:0:2: Wrong diagnostic page; asked for 1 got 0
[29852.593627] ses 5:0:0:2: Failed to get diagnostic page 0xffffffea
[29852.593638] ses 5:0:0:2: Failed to bind enclosure -19
[29853.590968] ..not responding...
[29861.407668] sd 5:0:0:0: [sdb] 732558336 4096-byte logical blocks: (3.00 TB/2.73 TiB)
[29861.429631] sd 5:0:0:0: [sdb] Write Protect is off
[29861.429639] sd 5:0:0:0: [sdb] Mode Sense: 53 00 10 08
[29861.447321] sd 5:0:0:0: [sdb] No Caching mode page found
[29861.447326] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[29861.507569] sd 5:0:0:0: [sdb] Unit Not Ready
[29861.507576] sd 5:0:0:0: [sdb] Sense Key : Data Protect [current]
[29861.507581] sd 5:0:0:0: [sdb] Add. Sense: Logical unit access not authorized
[29861.596816] scsi_io_completion: 7 callbacks suppressed
[29861.596824] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.596828] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.596833] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.596837] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.596840] blk_update_request: 7 callbacks suppressed
[29861.596842] blk_update_request: critical target error, dev sdb, sector 0
[29861.596845] buffer_io_error: 4 callbacks suppressed
[29861.596848] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.618633] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.618639] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.618644] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.618648] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.618651] blk_update_request: critical target error, dev sdb, sector 0
[29861.618654] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.632833] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.632839] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.632844] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.632848] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.632851] blk_update_request: critical target error, dev sdb, sector 0
[29861.632854] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.632872] ldm_validate_partition_table(): Disk read failed.
[29861.651594] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.651599] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.651604] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.651608] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.651610] blk_update_request: critical target error, dev sdb, sector 0
[29861.651613] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.673907] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.673914] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.673919] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.673924] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.673927] blk_update_request: critical target error, dev sdb, sector 0
[29861.673931] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.695989] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.695995] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.696000] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.696004] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.696007] blk_update_request: critical target error, dev sdb, sector 0
[29861.696010] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.715645] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.715653] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.715658] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.715662] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.715665] blk_update_request: critical target error, dev sdb, sector 0
[29861.715668] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.715697] Dev sdb: unable to read RDB block 0
[29861.735908] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.735914] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.735919] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.735923] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.735926] blk_update_request: critical target error, dev sdb, sector 0
[29861.735929] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.736644] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.736649] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.736653] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.736657] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 03 00 00 01 00
[29861.736660] blk_update_request: critical target error, dev sdb, sector 24
[29861.736662] Buffer I/O error on dev sdb, logical block 3, async page read
[29861.737092] sd 5:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[29861.737096] sd 5:0:0:0: [sdb] tag#0 Sense Key : Data Protect [current]
[29861.737100] sd 5:0:0:0: [sdb] tag#0 Add. Sense: Logical unit access not authorized
[29861.737104] sd 5:0:0:0: [sdb] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
[29861.737107] blk_update_request: critical target error, dev sdb, sector 0
[29861.737109] Buffer I/O error on dev sdb, logical block 0, async page read
[29861.737478] sdb: unable to read partition table
[29861.738776] sd 5:0:0:0: [sdb] Unit Not Ready
[29861.738787] sd 5:0:0:0: [sdb] Sense Key : Data Protect [current]
[29861.738793] sd 5:0:0:0: [sdb] Add. Sense: Logical unit access not authorized
[29861.739986] sd 5:0:0:0: [sdb] Attached SCSI disk
I'm not sure what these mean, but I see a lot error messages and something indicating that I'm unauthorized.
# Conclusion Edit: Aug 14, 2020
After taking some advice below (@paul-pedant) I'm taking the very unsatisfying route of reformatting using WD's proprietary software. It's unbelievable that none of these low level utilities could simply format the drive.

geneorama
(161 rep)
Aug 14, 2020, 07:16 AM
• Last activity: Jun 15, 2023, 09:41 PM
2
votes
1
answers
1186
views
KDE Partition Manager not seeing full disk size after cloning Windows 10 (UEFI) to larger SSD: how to move the secondary GPT table?
(Solved. See below) **After having cloned a SSD to a larger one, I want** to move the Recovery partition at the end of the clone, and then expand the Windows partition **to benefit from the additional capacity**. For this, I am using KDE Partition Manager, version 20.12.2, that comes with the [Q4OS...
(Solved. See below)
**After having cloned a SSD to a larger one, I want** to move the Recovery partition at the end of the clone, and then expand the Windows partition **to benefit from the additional capacity**.
For this, I am using KDE Partition Manager, version 20.12.2, that comes with the Q4OS Gemini Plasma distro, booted as a live distro from a flash drive. (Q4OS can be tested in live mode, installing it being optional.).
**KDE Partition Manager** perfectly displays the partitions, but detects the
/dev/nvme0n1
disk as a 500GB storage, i.e. the size of the source SSD, **ignoring the additional capacity available**.
I read that this is caused by the **secondary/backup GPT table being still located at its original location**, in the middle of the disk, after the cloning, and that this could be fixed by running gdisk, which would detect the secondary partition at the wrong place and suggest to correct this by moving it at the end of the drive.
So, I ran gdisk /dev/nvme0n1
, but gdisk (version 1.0.6) did not output any message relatively to the secondary GPT.
Instead, **gdisk's ouput** is:
The protective MBR's 0xEE partition is oversized! Auto-repairing.
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
The message comes back if calling gdisk again, suggesting that the problem has not been fixed.
**How can I move the secondary GPT table to the end of the disk using gdisk** (or other Linux tool) **?**
N.B. After cloning, I had to run bcdboot c:\windows
in Windows console, to make Windows bootable again.
OuzoPower
(241 rep)
Apr 22, 2023, 10:16 AM
• Last activity: Apr 22, 2023, 11:05 AM
2
votes
0
answers
312
views
Recover data from deleted (still intact) raid 5
So through a shell script gone sideways I accidentally deleted my mdadm raid5 (3 HDDs) and the partitions from the disks (so disks still connected according to lsblk as {sdb|sdc|sdd}). I have not tried anything since realizing the raid and partitions are gone to not dig my hole deeper, but come acro...
So through a shell script gone sideways I accidentally deleted my mdadm raid5 (3 HDDs) and the partitions from the disks (so disks still connected according to lsblk as {sdb|sdc|sdd}).
I have not tried anything since realizing the raid and partitions are gone to not dig my hole deeper, but come across tools like "testdisk" for linux recovery in my web search for which I'm not sure how I should go about recovery if the raid is not recoverable.
Is there a way to reassemble the raid or at least make the data on one of the disks accessible so I can copy it to another disk?
50x
(21 rep)
Apr 4, 2023, 07:23 PM
3
votes
3
answers
3323
views
Optimal partition sizes with Gparted and Gdisk
I am trying to chop a 4TB (4,000,225,165,312 bytes) drive up into even partitions of 1TB. I want these partitions to be further dividable to at least 1^3 Byte (~1GB) (1000000000) partitions. Okay, so after hours of distilling, I've found a couple of conflicting conclusions: * with Gparted I cannot m...
I am trying to chop a 4TB (4,000,225,165,312 bytes) drive up into even partitions of 1TB.
I want these partitions to be further dividable to at least 1^3 Byte (~1GB) (1000000000) partitions.
Okay, so after hours of distilling, I've found a couple of conflicting conclusions:
* with Gparted I cannot make a 1000000000 byte (953.67431640625 MB) partition
* with KDEparted I can select bytes 1000000000 byte partition, it ends up 1000341504
* turns out 954MB is 1000341504 Bytes
* this doesn't scale as 1000341504\*1000\*4 (~4TB) is 4001366016000, larger than the drive
* when I make one 1,000,000,000,000 it ends up 1,000,000,716,800
* so there is extra overhead that decreases with increasing total size
* KDEparted uses sfdisk backend which doesn't use sectors
* Gparted uses alignment to MBs
* with Gdisk I can make a 1000000000000 (1000^4) B (~1TB) partition using 1953125000 Sectors (512 bytes each)
That would be acceptable, to have to use Gdisk to create partitions with sectors and then move them around with Gparted. However, when I delete a 1000^4 B partition and create a new one with Gparted just filling available space, it gives extra bytes 1,000,000,716,800 (143 sectors).
This may be related to the Gdisk warning "Partitions will be aligned on 2048-sector boundaries", but I thought I was maximizing space with Gdisk. Now it looks like I would have to use Gdisk then Gparted then Gdisk again..? Is there a more optimal way of going about this?
A big part was understanding which alignment (bytes, cylinder, MiB) was best, and this post helped: "For this reason a lot of modern partitioning tools simply align the entire drive along a 1M[i]B boundary, which neatly does away with the need to detect whether you have any of the many types of drive, be they 512-byte sectors, 4KB sectors, or SSD with some arbitrary block size." https://superuser.com/questions/393914/what-is-partition-alignment-and-why-whould-i-need-it
Apparently 1 MiB was chosen because of recent drives using 4096 byte size sectors, and SSD 512 delete requirements, and OG 512 sector sizes. What mystified me is how much larger a MiB (1,048,576 bytes) is to 4096 bytes. I still don't understand why, but MiB seems to be the dominant alignment. And is working so far. "2048-sector boundaries" does actually mean 2048*512= 1MiB, not just starting at 2048 bytes, ("MiB alignment" would have been more clear). This link is also helpful: https://www.rodsbooks.com/gdisk/advice.html
I need to think in binary. I cant just multiply by 10.. it won't add up to ~1TB. So again, why is MiB alignment used when it is so much larger than the 4K 4096B sector size?? Is this an attempt for future-proofing?
alchemy
(757 rep)
Feb 12, 2023, 08:07 PM
• Last activity: Feb 19, 2023, 03:09 PM
0
votes
1
answers
1052
views
How to mount a sparsed disk image
I have an image of the mSATA SSD disk of a PC. The disk contains the operating system and has a capacity of 512GB. I do not have that free storage, so I have cloned the disk into an image with `dd` compressing it with `gz`, and later according to the answer of [this post][1], I have copied the spars...
I have an image of the mSATA SSD disk of a PC. The disk contains the operating system and has a capacity of 512GB.
I do not have that free storage, so I have cloned the disk into an image with
dd
compressing it with gz
, and later according to the answer of this post , I have copied the sparsed content so that it occupied little.
This has worked correctly, resulting in a 512GB image occupying less than 5GB on disk.
As a summary of what has been done:
# dd bs=64K if=/dev/sdd conv=sync,noerror status=progress | gzip -c > /image.img.gz
# gunzip -c /image.img.gz | cp --sparse=always /dev/stdin mini.img
# ls -lhs
4,8G -rw------- 1 balon users 477G ene 13 10:54 mini.img
2,3G -rw-r--r-- 1 balon users 2,3G ene 11 08:32 minimal-industrial-pc.img.gz
So far, everything is correct. The problem comes when I intend to mount the image (since I want to cage myself in it and make some changes about the file system).
I have tried the following:
1. fdisk
# fdisk -l mini.img
The size mismatch of the primary master boot record (GPT PMBR) (1000215215!= 1000215295) will be corrected by writing.
The backup GPT table is not at the end of the device.
Disk mini.img: 476,94 GiB, 512110231552 bytes, 1000215296 sectors
Units: sectores de 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disc label type: gpt
Disk identifier: 74BC899D-E8BA-4C70-B82D-6F4E8F6343A3
Device Start End Sectors Size Type
mini.img1 2048 2203647 2201600 1G EFI System
mini.img2 2203648 6397951 4194304 2G Linux file system
mini.img3 6397952 1000212479 993814528 473.9G Linux file system
2. kpartx
# kpartx -a -v mini.img
GPT:Primary header thinks Alt. header is not at the end of the disk.
GPT:Alternate GPT header not at the end of the disk.
GPT: Use GNU Parted to correct GPT errors.
add map loop1p1 (254:4): 0 2201600 linear 7:1 2048
add map loop1p2 (254:5): 0 4194304 linear 7:1 2203648
add map loop1p3 (254:6): 0 993814528 linear 7:1 6397952
In this case there seems to be no problems mounting loop1p1
and loop1p2
, but with `loop1p3, which I understand corresponds to the Ubuntu root system, there is no way.
3. gdisk
# gdisk -l mini.img
GPT fdisk (gdisk) version 1.0.9.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk mini.img: 1000215296 sectors, 476.9 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 74BC899D-E8BA-4C70-B82D-6F4E8F6343A3
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 1000215182
Partitions will be aligned on 2048-sector boundaries
Total free space is 4717 sectors (2.3 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2203647 1.0 GiB EF00
2 2203648 6397951 2.0 GiB 8300
3 6397952 1000212479 473.9 GiB 8300
What am I doing wrong?
Francisco de Javier
(1311 rep)
Jan 13, 2023, 10:11 AM
• Last activity: Jan 13, 2023, 05:59 PM
2
votes
1
answers
1317
views
script to gdisk to create a new partition
I'm trying to script to `gdisk` to create a new partition of LVM type (for `pvcreate`) so I typed this but I does not work : diskModelName=yourDiskModel diskSerialNumber=yourDiskSerialNumber lvmPartitionNumber=2 cat<<-EOF | sudo gdisk $disk p n 8E00 c $lvmPartitionNumber $diskModelName-$diskSerialNu...
I'm trying to script to
gdisk
to create a new partition of LVM type (for pvcreate
) so I typed this but I does not work :
diskModelName=yourDiskModel
diskSerialNumber=yourDiskSerialNumber
lvmPartitionNumber=2
cat<<-EOF | sudo gdisk $disk
p
n
8E00
c
$lvmPartitionNumber
$diskModelName-$diskSerialNumber
p
w
y
EOF
Can you help me ?
SebMa
(2433 rep)
Nov 1, 2020, 07:51 PM
• Last activity: Dec 29, 2022, 04:28 PM
11
votes
3
answers
33572
views
Remove all traces of GPT disk label
I've got an USB pen drive and I'd like to turn it into a bootable MBR device. However, at some point in its history, that device had a GPT on it, and I can't seem to get rid of that. Even after I ran `mklabel dos` in `parted`, `grub-install` still complains about Attempting to install GRUB to a disk...
I've got an USB pen drive and I'd like to turn it into a bootable MBR device. However, at some point in its history, that device had a GPT on it, and I can't seem to get rid of that. Even after I ran
mklabel dos
in parted
, grub-install
still complains about
Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
I don't want to preserve any data. I only want to clear all traces of the previous GTP, preferably using some mechanism which works faster than a dd if=/dev/zero of=…
to zero out the whole drive. I'd prefer a termina-based (command line or curses) approach, but some common and free graphical tool would be fine as well.
MvG
(4551 rep)
May 11, 2015, 01:45 PM
• Last activity: Sep 30, 2022, 11:46 AM
3
votes
2
answers
3059
views
Partitioning and formatting a 4k-emulated (512e) HDD
I just plugged into USB A 3.0 / C 3.1 my new external HDD to Debian Buster system. The disk was sold as **LaCie 2.5" Porsche Design P'9227 2TB USB-C**. Here is the output of `fdisk -l /dev/sdc`: Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Disk model: P9227 Slim Units: sectors of...
I just plugged into USB A 3.0 / C 3.1 my new external HDD to Debian Buster system.
The disk was sold as **LaCie 2.5" Porsche Design P'9227 2TB USB-C**.
Here is the output of
fdisk -l /dev/sdc
:
Disk /dev/sdc: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: P9227 Slim
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
I just read some articles about 4k-emulated drives (*512e*), this one should be the case.
I am confused as to how to format it with NTFS.
I tried to use my brain, and here is what I came with:
- Start sector of the partition should probably start on 4096 sector (?)
So I created a partition with gdisk
like this:
Device Start End Sectors Size Type
/dev/sdc1 4096 3907029134 3907025039 1.8T Microsoft basic data
- Sector size should probably be forced with the --sector-size
option like I did (?) issuing:
mkfs.ntfs --no-indexing --verbose --with-uuid --label EXTERNAL_2TB --quick --sector-size 4096 /dev/sdc1
----------------------
**EDIT1:**
Windows 10 fully updated did not recognize the partition and asked me to format, I used my favorite tool for that, and back to Linux here is the output of fdisk -l /dev/sdc
:
Device Start End Sectors Size Type
/dev/sdc1 2048 3907028991 3907026944 1,8T Microsoft basic data
So why it must start at sector 2048, I don't understand.
---------------------
**EDIT2:**
I don't understand what I am doing wrong in terms of compatibility with Windows. Every time I re-partition it / re-format it and boot Windows and plug the drive in, it just offers me to Format it itself.
I am quite positive I tried everything from inside gdisk
+ mkfs.ntfs
.
I would like to know why I am unable to do the same as Windows does from my Linux CLI.
--------------
I will answer all questions tomorrow morning as well as comments.
I am now running:
pv --progress --timer --eta --rate --average-rate --bytes -s 1953314876k /media/vlastimil/LACIE_2TB/zero
with an expected speed of 123 MiB/s.
Vlastimil Burián
(30505 rep)
Jan 27, 2019, 06:36 PM
• Last activity: Mar 2, 2022, 09:48 AM
0
votes
0
answers
79
views
Recovering data from a drive on which a partition table has been created
I have 2 drives on my computer, and was running out of space in one due to 2 OS on the one with smaller capacity. I was trying to partition the larger one(which has data on it), and looking up tutorials, I went with using gdisk and the first step was creating a partition table. Once I did this, the...
I have 2 drives on my computer, and was running out of space in one due to 2 OS on the one with smaller capacity. I was trying to partition the larger one(which has data on it), and looking up tutorials, I went with using gdisk and the first step was creating a partition table. Once I did this, the drive was no longer mounted (I assume because technically no partitions existed on the drive, thus the partition table was empty and therefore there was effectively "nothing") and when trying to make a partition, I was afraid of erasing the data so I decided to check on google for how to proceed. It seems that most tutorials assume that you are working with a fresh drive or at least that you have the intention of formatting it after partitioning, so I have not been able to find a source which helps me save my data. Is there a way for me to do so or is my data toast? Here are some outputs of some commands that might be of interest:
(in gdisk)
Command (? for help): p
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Model: ST1000LM035-1RK1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 092FF04B-CCED-45DA-81B9-7EEA1FD00FF8
[...]
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 1953525101 sectors (931.5 GiB)
Number Start (sector) End (sector) Size Code Name
(empty, as you can see)
user@local:/$ sudo fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 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
Disklabel type: gpt
Disk identifier: 092FF04B-CCED-45DA-81B9-7EEA1FD00FF8
(and other drives were listed that I assumed unnecessary for this discussion)
user@local:/$ sudo blkid
/dev/sda: PTUUID="092ff04b-cced-45da-81b9-7eea1fd00ff8" PTTYPE="gpt"
(No UUID, just PTUUID)
I've tried mounting the drive (as it is clearly a listed block device) but this doesn't seem to work. I get a "bad fs/option/superblock, missing codepage or helper program, or other error" error. Also it seems that creating a filesystem will also wipe my drive. I'm not sure what else to try so I hope someone could point me in a clear direction, thanks in advance!
OhMuzGawd
(1 rep)
Feb 15, 2022, 04:10 PM
1
votes
1
answers
383
views
sas drive i/o error 5 via raid card - sed locked partition table
I am trying to find a better way to access my newly purchased SAS drives (deepdiscountserver 3tb IBM platters(used or refurb i think yes)), using a 2x4 LSI PCIe3 card. I think the card is only half working based on a few things mentioned below. For now, I'm simply trying to put a file system on it,...
I am trying to find a better way to access my newly purchased SAS drives (deepdiscountserver 3tb IBM platters(used or refurb i think yes)), using a 2x4 LSI PCIe3 card. I think the card is only half working based on a few things mentioned below.
For now, I'm simply trying to put a file system on it, running into
error 5
, and i/o errors(need to remove SED encryption?). I worked out a way to do it with dd
, see below.
I don't have options in my SAS/RAID controller card or I would reset it there. When I press the hotkey during boot, it responds says it will load, but never loads. If i understand correctly, this should be where one woud normally turn off the encryption, right?
sedutil-cli
, and hdparm
report this, not helpful.
sedutil-cli --scan
...
/dev/sdf No sdc 8:32 0 2.7T 0 disk
The Kernel flag libata.allow_tpm is not set correctly ├─sdc1 8:33 0 2.7T 0 part
Please see the readme note about setting the libata.allow_tpm
...
hdparm -I /dev/sdd
/dev/sdd:
SG_IO: bad/missing sense data, sb[]: 72 05 20 00 00 00 00 1c 02 06 00 00 cf 00 00 00 03 02 00 01 80 0e 0
0 00 05 20 00 01 ff ff ff ff
SG_IO: bad/missing sense data, sb[]: 72 05 20 00 00 00 00 1c 02 06 00 00 cf 00 00 00 03 02 00 01 80 0e 0
0 00 05 20 00 01 ff ff ff ff
HDIO_DRIVE_CMD(identify) failed: Input/output error
I will do what worked for me last time. These drives are going to be a pain in the ass. See below, and also let me know If I do this a better way;
dd /dev/sdd if=/dev/zero of=/dev/sdd bs=1M
dd: error writing ‘/dev/disk/by-id/scsi-35000c50084889cf3’: No space left on device
2861589+0 records in
2861588+0 records out
3000592982016 bytes (3.0 TB) copied, 21272.1 s, 141 MB/s
SED is gone, should no longer receive I/O errors. Now use gdisk
to lay in a new partition table.
If you run gdisk
before you dd the entire drive, it reports the I/O error, usually that means i didnt DD enough of the drive. usualy I think thats some stuff at the very end of the drive.
(? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.
I've tried parted, fdisk
, etc.. If I don't run dd
at all, or run it just on the beginning, SED takes over I think, and I/O errors, error 5
, and everything points to bad controller card, cabling, or drive. However, trying every other cable, and running through smartctl
says thats a false alarm, that things are fine.
I even have some other IBM drives to compare to on the system, and can tell you, this is normal behaviour, for these drives in their received condition. If I could get into the SAS settings, I would just clear the drive there.
So in the end, dd
is all that's working for me, thankfully at least :-)
is there is a better (quicker) way? Is it normal to not access to sedutil
, and hdparm
for SAS drives? I better be careful when I choose my next RAID controller card based on this.
Brian Thomas
(734 rep)
Oct 10, 2021, 03:27 AM
• Last activity: Feb 13, 2022, 11:11 AM
0
votes
1
answers
1709
views
Does gdisk partition and format it with xfs?
Using CentOS 8.5 I tried this on a new disk with no data or partition tables. ```[root@workstation ~]# gdisk /dev/nvme0n7 GPT fdisk (gdisk) version 1.0.3 Partition table scan: MBR: not present BSD: not present APM: not present GPT: not present Creating new GPT entries. Command (? for help): n Partit...
Using CentOS 8.5
I tried this on a new disk with no data or partition tables.
[root@workstation ~]# gdisk /dev/nvme0n7
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): n
Partition number (1-128, default 1):
First sector (34-4194270, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-4194270, default = 4194270) or {+-}size{KMGTP}: +500M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/nvme0n7.
The operation has completed successfully.
[root@workstation ~]#
[root@workstation ~]# lsblk -fp
NAME FSTYPE LABEL UUID MOUNTPOINT
/dev/sr0
/dev/nvme0n1
├─/dev/nvme0n1p1 xfs c932c155-e3a9-4852-aad1-d545778b46c6 /boot
└─/dev/nvme0n1p2 LVM2_member KwN1Pf-Jf3R-l7HW-Qed3-DLSl-olMr-rVdD3n
├─/dev/mapper/cl-root xfs e6d63656-cd58-40a8-aadf-b0416e36c8d4 /
├─/dev/mapper/cl-swap swap 3b26e208-9846-4c20-8b90-60bb0ce68869 [SWAP]
└─/dev/mapper/cl-home xfs 7cb2b8a0-fe6b-4c6c-9d8f-124780be79c9 /home
/dev/nvme0n2
/dev/nvme0n3
/dev/nvme0n4
/dev/nvme0n5
/dev/nvme0n6
/dev/nvme0n7
└─/dev/nvme0n7p1 xfs 25552944-4b61-44d6-a1bd-ca0ae3cfc89f
/dev/nvme0n8
/dev/nvme0n9
[root@workstation ~]#
As you can see, the partition already has xfs filesystem created on it. I thought I have to use mkfs.xfs
after using fdisk
or gdisk
.
Cruise5
(546 rep)
Jan 30, 2022, 04:42 AM
• Last activity: Jan 31, 2022, 04:15 PM
3
votes
1
answers
1894
views
Recover partitions Mac OS internal HD
I booted to a live Ubuntu USB, wanting to delete partitions on an SD card, and ended up deleting all my partitions on my MacBook Pro's internal HD. I have already tried `gpart` (which gets stuck at "Begin scan...") and `testdisk` (which can't create partitions since "Function write_part_mac not impl...
I booted to a live Ubuntu USB, wanting to delete partitions on an SD card, and ended up deleting all my partitions on my MacBook Pro's internal HD.
I have already tried
gpart
(which gets stuck at "Begin scan...") and testdisk
(which can't create partitions since "Function write_part_mac not implemented"!).
I did try cmd+ R at boot, but gave it up as it was taking a long time. I thought there would be an easier and faster alternative.
Is there a way to recover data with partitions on my hd?
Here's my testdisk
output for the Mac HD:
Partition Start End Size in sectors
> P DOS_FAT_32 40 409639 409600 [EFI]
> P HFS 409640 489972567 489562928
user3490458
(207 rep)
Dec 31, 2014, 10:15 AM
• Last activity: Nov 4, 2021, 06:23 AM
13
votes
4
answers
12260
views
How to renumber GPT partitions on an umounted disk?
I tried to sort (renumber) partitions on `/dev/sdb` via terminal, using `gdisk` from the operating system (running on `/dev/sda`) and none of the `sdb` partitions mounted but the only option I get is `[-l]` which lists options the option I'm trying to use. root@arch-bill /home/bill # lsblk NAME MAJ:...
I tried to sort (renumber) partitions on
/dev/sdb
via terminal, using gdisk
from the operating system (running on /dev/sda
) and none of the sdb
partitions mounted but the only option I get is [-l]
which lists options the option I'm trying to use.
root@arch-bill /home/bill # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
|-sda1 8:1 0 15.6G 0 part /
|-sda2 8:2 0 915.9G 0 part /home
`-sda3 8:3 0 2M 0 part
sdb 8:16 0 1.8T 0 disk
|-sdb1 8:17 0 2M 0 part
|-sdb2 8:18 0 4G 0 part
|-sdb3 8:19 0 16G 0 part
|-sdb4 8:20 0 60G 0 part
`-sdb6 8:22 0 1.8T 0 part
sr0 11:0 1 1024M 0 rom
root@arch-bill /home/bill # blkid
/dev/sdb1: PARTUUID="c1073e4b-fc00-4f02-8b81-6f17b8a188c4"
/dev/sdb2: LABEL="var" UUID="62921c0a-5d34-464d-8a7a-2ff46ad8f12b" TYPE="ext4" PARTUUID="c350316a-0bd8-4e82-8597-123553977f99"
/dev/sdb3: LABEL="rootbkp" UUID="c245c20e-d503-4b61-aaaf-060aae1b21d4" TYPE="ext4" PARTUUID="b1f391db-de37-479c-8b44-ff27f3bd6aa5"
/dev/sdb4: LABEL="snapster" UUID="8fef4e0a-efd4-455b-b484-83bd4500161f" TYPE="ext4" PARTUUID="02801cd9-3fe5-4814-9b92-c4c83b86173d"
/dev/sdb6: LABEL="homebkp" UUID="51d73ac7-fd96-4ac1-b4f3-4abf6bc4936b" TYPE="ext4" PARTUUID="481ae7d0-228f-4979-8949-befbd498534b"
/dev/sda1: UUID="91865df2-0841-42f5-80f3-a5133976e70f" TYPE="ext4" PARTUUID="48dc34cb-e791-4838-b9f2-2fe2b2cced33"
/dev/sda2: UUID="e5743a89-13ed-4c96-b39d-78cb6478fb72" TYPE="ext4" PARTUUID="4156cbf2-2a2d-47ae-87cf-99c14cf8f2c2"
/dev/sda3: PARTUUID="8669392a-663e-4e15-bc63-a6a5e95c97ad"
root@arch-bill /home/bill # gdisk -s /dev/sdb
GPT fdisk (gdisk) version 0.8.10
Usage: gdisk [-l] device_file
1
root@arch-bill /home/bill # gdisk -l /dev/sdb :(
GPT fdisk (gdisk) version 0.8.10
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0645408C-0374-4357-8663-D2A3512E07BD
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3907029134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4204653 sectors (2.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 6143 2.0 MiB EF02
2 8192 8396799 4.0 GiB 0700
3 8398848 41953279 16.0 GiB 0700
4 41955328 167786495 60.0 GiB 0700
6 167788544 3902834687 1.7 TiB 0700
1 root@arch-bill /home/bill #
BillV
(141 rep)
Apr 29, 2014, 06:31 AM
• Last activity: Sep 24, 2021, 08:56 AM
Showing page 1 of 20 total questions