1 (edited by chatnoir 2021-11-10 12:05:48)

Topic: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Hello,

I've read about this in this Forum and others too but my problem looks different because so far Ive seen from others they have had problems with the sectors...
For me the sectors don't look "oversized", or?

My problematic partition is part of a RAID 6 which finished to sync etc. today...

These are the infos:

root@N5550:/home/xyz# sudo parted /dev/sde unit s print
Error: Can't have a partition outside the disk!
Ignore/Cancel? i
Model: ATA Hitachi HUA72202 (scsi)
Disk /dev/sde: 3907029168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End          Size         Type     File system  Flags
 1      2048s  3907031039s  3907028992s  primary  ext4         boot

root@N5550:/home/xyz# sudo fdisk -l -u /dev/sde
Festplatte /dev/sde: 1,8 TiB, 2000398934016 Bytes, 3907029168 Sektoren
Disk model: Hitachi HUA72202
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: dos
Festplattenbezeichner: 0x6c44162d

Gerät      Boot Anfang       Ende   Sektoren Größe Kn Typ
/dev/sde1  *      2048 3907031039 3907028992  1,8T 83 Linux

I moved from RAID 5 to now RAID 6 and dont have had problems before.
Also Ive tried testdisk which shows no errors on the partition...

What Im wondering...
Im not 100% sure but so far I can remember my RAid 5 dont have had an /dev/sde1 but the new RAID 6 have...
Is this normal?

Beside that error gparted and parted gives me, the RAID 6 works normal so far.
Im not really a Linux specialist so that's why Im here to ask. smile

Many thanks in advance,
Chris

2

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Partition 1 on sde ends beyond the end of the disk!
disk size: 3907029168 sectors
sde1 end:  3907031039 sectors

I am getting mixed messages about your disk configuration.  You say you have RAID6 (converted from RAID5) but the output from fdisk and parted says you have an ext4 file system in a partition with ID 84 (Linux file system).

Is the RAID array created in the BIOS, or using the Linux command mdadm?

Lets look at your disk layout before starting to recommend corrective actions.

sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint
sudo mdadm -Esv
sudo dmraid --sets
sudo dmraid --raid_devices

3

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Many many thanks for your response!

Oops... I don't know why I haven't seen that its beyond...

Well, it was a RAID 5 and I copied all Files to externals and created a RAID 6 via Webmin.
->Wiping Partition aso...

Here now the requested informations:

sudo lsblk -o name,maj:min,rm,size,ro,type,fstype,label,mountpoint

NAME    MAJ:MIN RM  SIZE RO TYPE  FSTYPE            LABEL   MOUNTPOINT
sda       8:0    0  1,8T  0 disk
├─sda1    8:1    0 17,3G  0 part  ext4                      /
├─sda2    8:2    0    1K  0 part
├─sda5    8:5    0  6,1G  0 part  ext4                      /var
├─sda6    8:6    0  976M  0 part  swap                      [SWAP]
├─sda7    8:7    0  1,1G  0 part  ext4                      /tmp
└─sda8    8:8    0 66,3G  0 part  ext4                      /home
sdb       8:16   0  1,8T  0 disk  linux_raid_member N5550:0
└─md0     9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sdc       8:32   0  1,8T  0 disk  linux_raid_member N5550:0
└─md0     9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sdd       8:48   0  1,8T  0 disk
└─sdd1    8:49   0  1,8T  0 part  linux_raid_member N5550:0
  └─md0   9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sde       8:64   0  1,8T  0 disk  linux_raid_member N5550:0
└─md0     9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sdf       8:80   0  1,8T  0 disk  linux_raid_member N5550:0
└─md0     9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sdg       8:96   0  1,8T  0 disk
└─sdg1    8:97   0  1,8T  0 part  linux_raid_member N5550:0
  └─md0   9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550
sdh       8:112  0  1,8T  0 disk
└─sdh1    8:113  0  1,8T  0 part  linux_raid_member N5550:0
  └─md0   9:0    0  9,1T  0 raid6 ext4                      /mnt/N5550

sudo mdadm -Esv

ARRAY /dev/md/0  level=raid6 metadata=1.2 num-devices=7 UUID=e866cf54:90d5c74e:fe00b6e7:d25c82f4 name=N5550:0
   devices=/dev/sdh1,/dev/sdc,/dev/sdg1,/dev/sdd1,/dev/sdf,/dev/sde,/dev/sdb

sudo dmraid --sets
no raid disks

sudo dmraid --raid_devices
no raid disks

4 (edited by mfleetwo 2021-11-02 20:54:28)

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

You've got a mixture of partitions (sdd1, sdg1, sdh1) and whole disks (sdb, sdc, sde, sdf) in that array.  In particular the whole of disk sde in the array, yet it also contains an MSDOS partition table.

Lets check the raid header on that disk.

sudo mdadm -E /dev/sde

5

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Thank you again for your time!!!

Sorry about my late answer but here it is:

sudo mdadm -E /dev/sde

/dev/sde:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : e866cf54:90d5c74e:fe00b6e7:d25c82f4
           Name : N5550:0  (local to host N5550)
  Creation Time : Fri Oct 29 14:43:58 2021
     Raid Level : raid6
   Raid Devices : 7

 Avail Dev Size : 3906770096 (1862.89 GiB 2000.27 GB)
     Array Size : 9766906880 (9314.45 GiB 10001.31 GB)
  Used Dev Size : 3906762752 (1862.89 GiB 2000.26 GB)
    Data Offset : 259072 sectors
   Super Offset : 8 sectors
   Unused Space : before=258992 sectors, after=7344 sectors
          State : clean
    Device UUID : 34198042:3d4c802b:36727b02:fdf65808

Internal Bitmap : 8 sectors from superblock
    Update Time : Wed Nov  3 22:02:45 2021
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : f83c7570 - correct
         Events : 17154

         Layout : left-symmetric
     Chunk Size : 512K

   Device Role : Active device 3
   Array State : AAAAAAA ('A' == active, '.' == missing, 'R' == replacing)

Is it positive? smile
Building up the RAID 6 again would costs me days...
It works flawlessly so far so I hope it's nothing important...

Best regards, Chris

(I wonder, that I don't got a mail, telling me about your answer... )
Oh and here I've learned many new commands!
Many thanks for this too! smile

6

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

It's good news.

MSDOS partition table occupies sector 0.  Linux software RAID is using metadata version 1.2 which has it's superblock at sector 8 and unused space before that.  It is a simple matter to erase the unwanted MSDOS partition table.

First, write zeros to sector 0 of sde to erase the MSDOS partition table.

sudo dd if=/dev/zero bs=512 count=1 of=/dev/sde

second, tell the kernel that all partitions on sde have gone.

sudo partx --delete --verbose /dev/sde

----
I have no idea how partition sde1 happened to end beyond the end of the disk.  It is almost certain that you had sde partitioned first and created the RAID array on it afterwards.  I just wish mdadm (the tool webmin would have used to create and modify the RAID array) cleared clashing signatures to avoid the disk being left with both a partition table and RAID array member of the whole drive.

7 (edited by chatnoir 2021-11-04 13:21:50)

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

At the moment im "rsyncing" and don't want to interrupt it but after this I'll try.

Can I backup somehow the old settings in case something will went wrong?

I thrust you because you are a real Guru!!! smile

I'm just anxious as a "Partition Noob" wink

I just wish mdadm (the tool webmin would have used to create and modify the RAID array) cleared clashing signatures to avoid the disk being left with both a partition table and RAID array member of the whole drive.

The RAID 5 I've created "by hand" with mdadm but the Tutorial I was following was not 100% correct (I don't remember the Website) so I needed to investigate how to solve some errors.
After I decided to switch to RAID 6 I was investigating for how to do it with Webmin and as it looked easier I did it with it.
Wiped all old Linux Raids and created new Linux Raid ones.
Why Webmin made a DOS-Partition is unknown for me...

I'll report back in some hours and again: Many many thanks!!! smile


[EDIT]: Just for my curiosity: My NAS have RAID too as Hardware RAID but I thought of if I switch to a newer NAS I could use the RAID 6 from the old one...
I've read about that a Software RAID can do this but a Hardware RAID will depend on the Hardware used...
That's correct?

8

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

It isn't necessary to backup the MSDOS partition table in sector 0 on sde.  It is not used, not wanted.  (Look at the lsblk and mdadm -Esv output from earlier.  Partition sde1 is not mentioned and not used.  Only the whole drive is used).  And it is contradictory to using the whole drive as a member in your RAID array.

On the other hand writing directly to disks using dd is open to mistakes and doing untold damage.  Write to the wrong disk, the wrong location or too much and wanted data is lost.  To fully mitigate this risk you would have to be able to completely rebuild your your NAS from empty drives and restore all wanted data from backup.

All I can offer to avoid mistakes is this advice and a description of what dd is doing to provide you with full understanding.  In the carpentry world the saying is "measure twice, cut once".  The equivalent for computing would be to double check the command for mistakes and understand what it is going to do before pressing return.

sudo dd if=/dev/zero bs=512 count=1 of=/dev/sde

* if=/dev/zero - (In File) read from /dev/zero, source of an infinite about of zero bytes.
* bs=512 - (Block Size) read and write in blocks of 512 bytes, matches drive sector size.
* count=1 - Read and write 1 block only.
* of=/dev/sde - (Out file) write to /dev/sde.

Having said all that, the MSDOS partition table on sde can be backed up like this:

sudo dd if=/dev/sde bs=512 count=1 of=/tmp/sde-sector-0-backup

Yes, all the drives containing a Linux Software RAID array can just be re-attached to any new Linux computer with mdadm installed and used.  All the needed metadata describing the array is stored on the members in the RAID superblock / metadata area.

For hardware RAID, yes you need a compatible hardware RAID controller to be able to move the drives to a new machine and successfully access the data again.  Plus you also need to confirm moving drives like this is supported (because the metadata describing the array is stored on the drives too, rather than on a small amount of NVRAM (Non-volatile RAM) on the old RAID controller itself).

9

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Sorry for my late reply but my NAS stopped working atm and don't boot...
I think I can repair it tomorrow...
I have a Backup so it should work again.

Well... its a self build Olidata aká Thecus N5550 I run with RaspiOS.

Oh and big thanks for your detailed explanation!

I'll report back when it works again. smile

10

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Puh... what a torture with my NAS...
First one HDD died so I needed to replace it (Never again Hitachis so called Server HDDs!!!).
Then somehow my RaspiOS died...
Then something went wrong with syncing the RAID...
After 3x syncing now it's back to work and I was able to try your commands (the sde is now sdd):
sudo dd if=/dev/zero bs=512 count=1 of=/dev/sdd
worked without errors.

sudo partx --delete --verbose /dev/sdd
Gives me an error:
root@N5550:/home/xyz# sudo partx --delete --verbose /dev/sdd
Partition: none, Festplatte: /dev/sdd, untere: 0, obere: 0
partx: /dev/sdd: Löschen der Partition #1 fehlgeschlagen: Das Gerät oder die Ressource ist belegt
partx: /dev/sdd: Fehler beim Löschen der Partition 1

I'll try to translate:

root@N5550:/home/xyz# sudo partx --delete --verbose /dev/sdd
Partition: none, HDD: /dev/sdd, untere: 0, obere: 0
partx: /dev/sdd: Deleting of Partition #1 Failed: The Device is locked
partx: /dev/sdd: Failed to delete Partition 1

Do I just have to unmount it?
I better ask before... smile

11

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

The partx command is only to inform the running kernel that all the partitions have been deleted from the drive.  Since partx failed with "The device or resource is busy", reboot instead.

12 (edited by chatnoir 2021-11-10 16:59:42)

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

So I rebooted and happily Gparted don't show the error anymore but....

Now my RAID 6 is gone and sudo mdadm --detail /dev/md0 shows:

/dev/md0:
           Version : 1.2
        Raid Level : raid0
     Total Devices : 6
       Persistence : Superblock is persistent

             State : inactive
   Working Devices : 6

              Name : N5550:0  (local to host N5550)
              UUID : e866cf54:90d5c74e:fe00b6e7:d25c82f4
            Events : 33411

    Number   Major   Minor   RaidDevice

       -       8       64        -        /dev/sde
       -       8       32        -        /dev/sdc
       -       8       80        -        /dev/sdf
       -       8       16        -        /dev/sdb
       -       8      113        -        /dev/sdh1
       -       8       96        -        /dev/sdg

and cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : inactive sdh1[5](S) sdb[0](S) sdg[7](S) sdf[4](S) sdc[1](S) sde[3](S)
      11720309176 blocks super 1.2

unused devices: <none>

I would prepare the sdd now as "Linux Raid Disk" but before I do that I better ask... smile

[EDIT]: I used testdisk to get the old partition back and so the RAID 6 is back again but, no wonder, the error too... wink

So I can at least continue the "rsyncing" I have to do until I'm getting an answer.
Sounds like its now only a small step to have it acting normaly, or? smile

Best regards,
Chris

13

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

In the above details I think you have listed needing to resync 4 times.  Once after a failed drive, once after a reboot and 2 other times.  After replacing a failed drive is expected.  After a reboot, definitely not.  It is as if something is corrupting the array members (overwriting or otherwise damaging the superblock in some way).  I have no idea what that could be.

At the top of this discussion your array had 4 whole drives and 3 parition members.  Now from the mdadm -D and cat /proc/mdstat output your array has 5 whole drives, 1 partition and 1 missing member.  I assume this is as a result of adding whole drives rather than partitions back into the array when resyncing.

At the moment all I can suggest is to resync what is needed to restore all members to the array.

14

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Maybe it have had something to do with the broken HDD because since I've replaced and synced the RAID its working fine. *happy* smile

Only the partition error is still present and I can't solve it because of the locked drive.
I would not notice it if GParted would not tell me... big_smile
Should I try to boot from a recovery USB Stick and try to fix it from there?
If so, which ISO you would suggest?

15

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Yes using some alternative boot media would be a good idea.

Assuming your NAS is an Intel PC compatible machine try using either GParted Live or SystemRescue.

16

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Well.. I fear I'll make something wrong and my RAID will be gone...
Also I found out something new and somehow strange...
sdd don't have a partition anymore:

sudo parted /dev/sdd unit s print
Error: Can't have a partition outside the disk!

                                                                         
Model: ATA Hitachi HUA72202 (scsi)
Disk /dev/sdd: 3907029168s
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

How can the partition be outside the disk if there is none?
I don't get it... big_smile

Also I found out only sdh have somehow got a partition and is a part of the RAID.
Will this be problematic?

Oh and...
What if I just wipe the sdd and create a new Linux RAID disk and sync it again?
In hope it will be the last RAID syncing for now... wink

Have a nice start in the week, mfleettwo! smile

17

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

chatnoir wrote:

Also I found out something new and somehow strange...
sdd don't have a partition anymore:

sudo parted /dev/sdd unit s print
Error: Can't have a partition outside the disk!

Model: ATA Hitachi HUA72202 (scsi)
Disk /dev/sdd: 3907029168s
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

How can the partition be outside the disk if there is none?
I don't get it... big_smile

That is exactly what happens when "c" is pressed at the Ignore/Cancel? prompt instead of "i".  Cancel means don't load the partition table from disk, but then still goes to print it.  Ignore means ignore the fact that the partition table is inconsistent, load it anyway, and then go on to print it.


Having one partition (sdh1) in the array is not a problem for mdadm and the Linux kernel.  However there were unexplained loss of drives in the array earlier, which lead you to resync the array using whole drives.

18

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Ohhh...
I need to say, as I just wanted a quick check I used ALT+K in Webmin for the Command Shell Overlay and I found out right now that there is no Question about Ignore/Cancel?
In the normal SSH there is and yes, its present.

So long story short.. wink
Will it work to just wipe and make a new Linux RAID disk of it?
I don't mind about another RAID syncing over night... smile

I hope then everything will be as it should be smile

19

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

By wipe I assume you mean something like this:
1. Instruct mdadm to mark a drive as failed
2. Instruct mdadm to remove a drive from the array
3. Write zeros to the first 1 MiB of a drive

https://www.ducea.com/2009/03/08/mdadm-cheat-sheet/

Yes that would be OK.

20

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

Its solved! smile
Looks like you don't like Webmin... hihihi
I did it with Webmin:

  • - I removed the faulty Partition
    - I wiped the Partition and
    - Created a Linux RAID Partition and
    - Resynched the RAID

Now everything looks fine. *happyyyy* smile
Many many thanks for your advice!

Now I know many more commands to check HDDs or the RAID! smile
I wrote them to my own personal Zim Desktop Wiki. smile

Next step will be to install an Mail Server like Postfix to get a notification if something is not okay with my RAID...

Again many thanks for helping me! smile

Oh, btw: Before I decided to make the RAID 5 to 6 I made it with mdadm but the tutorial was faulty...
So I decided to use Webmin. smile

Take care and be healthy, mfleettwo! smile

21 (edited by maureencurtis 2021-12-01 13:20:26)

Re: [SOLVED] Another "Error: Can't have a partition outside the disk!"

mfleetwo wrote:

By wipe I assume you mean something like this:
1. Instruct mdadm to mark a drive as failed
2. Instruct mdadm to remove a drive from the array
3. Write zeros to the first 1 MiB of a drive

Yes that would be OK.

Hello I can't open link sad.