Quote:
Originally Posted by virilo
Code:
fdisk -l -u=sectors
Disk /dev/sdd: 9,1 TiB, 10000797794304 bytes, 19532808192 sectors
Disk model: Elements 25A3
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
Device Start End Sectors Size Type
/dev/sdd1 2048 9766436863 9766434816 4,6T Linux filesystem
/dev/sdd2 9766436864 19532871679 9766434816 4,6T Linux filesystem
|
Simpler arithmetic, same result:
(19532871679+1) - 19532808192 = 63488
It's fairly straightforward to make an empty file of size 63488*512 and use dmsetup to create a virtual drive appending that file to the end of /dev/sdd2. That virtual drive could then be checked, mounted, and even shrunk to fit in the available space on the physical disk. The problem here with that is that xfs probably won't let you mount the drive without first running
xfsrepair, that repair operation has the potential to cause unrecoverable data loss, and an xfs filesystem cannot be shrunk in place.
Should you want to try it anyway:
Code:
truncate --size=$((63488*512)) /var/tmp/padfile
losetup -vf /var/tmp/padfile
echo -e "0 9766434816 /dev/sdd2 0 \n 9766434816 63488 /dev/loop0 0" | dmsetup create padded
If the device returned by
losetup is other than "
/dev/loop0", use that instead in the
echo command. You can now use "/dev/mapper/padded" as the device name in
mount,
xfsrepair, etc. commands.
To unwind:
Code:
dmsetup remove padded
losetup -d /dev/loop0
rm /var/tmp/padfile
But, you really shouldn't be attempting that repair on your only copy of the data. If you're going to need a new drive with sufficient capacity to hold that data, you might as well just get a drive at least as large as the original and just "dd" this slightly-too-small drive to it. Way simpler, a lot safer.