mdadm raid 1 how to remove raid and remove data offset to mount normally?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a disk that was in a mdadm raid1 with a btrfs partition.
Now I want to use this partition without the raid stuff and mount it normally.
I already zeroed the mdadm superblock, but now the offsets that mdadm created are still present and I can't mount the partition.
Before I deleted the superblock, I noted that the data offset was 2048.



What can I do now? I would try to move the partition by that 2048 bit, but I'm not sure how to do that exactly.



Wouldn't it be enough to alter the parition table and set the begin sector 2048 bits further?



Edit:
Here is the full information from mdadm



mdadm --examine /dev/sdb
/dev/sdb:
MBR Magic : aa55
Partition[0] : 4980480 sectors at 2048 (type fd)
Partition[1] : 4194304 sectors at 4982528 (type fd)
Partition[2] : 11329536 sectors at 9437184 (type fd)
root@debian-test:/home/debian# mdadm --examine /dev/sdb3
/dev/sdb3:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 8bd40f46:896acdc5:6f3fa1f7:67f779fc
Name : dsm-virtualbox:2
Creation Time : Thu Jul 12 23:05:16 2018
Raid Level : raid1
Raid Devices : 1

Avail Dev Size : 11327488 (5.40 GiB 5.80 GB)
Array Size : 5663744 (5.40 GiB 5.80 GB)
Data Offset : 2048 sectors
Super Offset : 8 sectors
Unused Space : before=1968 sectors, after=0 sectors
State : clean
Device UUID : 5cf0a635:f107d2b7:18498037:0a9d68f7

Update Time : Thu Jul 12 23:29:40 2018
Checksum : b3b49d3d - correct
Events : 6


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


I'm only interested in partition 3, the rest are system paritions that I'll delete.







share|improve this question























    up vote
    1
    down vote

    favorite












    I have a disk that was in a mdadm raid1 with a btrfs partition.
    Now I want to use this partition without the raid stuff and mount it normally.
    I already zeroed the mdadm superblock, but now the offsets that mdadm created are still present and I can't mount the partition.
    Before I deleted the superblock, I noted that the data offset was 2048.



    What can I do now? I would try to move the partition by that 2048 bit, but I'm not sure how to do that exactly.



    Wouldn't it be enough to alter the parition table and set the begin sector 2048 bits further?



    Edit:
    Here is the full information from mdadm



    mdadm --examine /dev/sdb
    /dev/sdb:
    MBR Magic : aa55
    Partition[0] : 4980480 sectors at 2048 (type fd)
    Partition[1] : 4194304 sectors at 4982528 (type fd)
    Partition[2] : 11329536 sectors at 9437184 (type fd)
    root@debian-test:/home/debian# mdadm --examine /dev/sdb3
    /dev/sdb3:
    Magic : a92b4efc
    Version : 1.2
    Feature Map : 0x0
    Array UUID : 8bd40f46:896acdc5:6f3fa1f7:67f779fc
    Name : dsm-virtualbox:2
    Creation Time : Thu Jul 12 23:05:16 2018
    Raid Level : raid1
    Raid Devices : 1

    Avail Dev Size : 11327488 (5.40 GiB 5.80 GB)
    Array Size : 5663744 (5.40 GiB 5.80 GB)
    Data Offset : 2048 sectors
    Super Offset : 8 sectors
    Unused Space : before=1968 sectors, after=0 sectors
    State : clean
    Device UUID : 5cf0a635:f107d2b7:18498037:0a9d68f7

    Update Time : Thu Jul 12 23:29:40 2018
    Checksum : b3b49d3d - correct
    Events : 6


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


    I'm only interested in partition 3, the rest are system paritions that I'll delete.







    share|improve this question





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a disk that was in a mdadm raid1 with a btrfs partition.
      Now I want to use this partition without the raid stuff and mount it normally.
      I already zeroed the mdadm superblock, but now the offsets that mdadm created are still present and I can't mount the partition.
      Before I deleted the superblock, I noted that the data offset was 2048.



      What can I do now? I would try to move the partition by that 2048 bit, but I'm not sure how to do that exactly.



      Wouldn't it be enough to alter the parition table and set the begin sector 2048 bits further?



      Edit:
      Here is the full information from mdadm



      mdadm --examine /dev/sdb
      /dev/sdb:
      MBR Magic : aa55
      Partition[0] : 4980480 sectors at 2048 (type fd)
      Partition[1] : 4194304 sectors at 4982528 (type fd)
      Partition[2] : 11329536 sectors at 9437184 (type fd)
      root@debian-test:/home/debian# mdadm --examine /dev/sdb3
      /dev/sdb3:
      Magic : a92b4efc
      Version : 1.2
      Feature Map : 0x0
      Array UUID : 8bd40f46:896acdc5:6f3fa1f7:67f779fc
      Name : dsm-virtualbox:2
      Creation Time : Thu Jul 12 23:05:16 2018
      Raid Level : raid1
      Raid Devices : 1

      Avail Dev Size : 11327488 (5.40 GiB 5.80 GB)
      Array Size : 5663744 (5.40 GiB 5.80 GB)
      Data Offset : 2048 sectors
      Super Offset : 8 sectors
      Unused Space : before=1968 sectors, after=0 sectors
      State : clean
      Device UUID : 5cf0a635:f107d2b7:18498037:0a9d68f7

      Update Time : Thu Jul 12 23:29:40 2018
      Checksum : b3b49d3d - correct
      Events : 6


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


      I'm only interested in partition 3, the rest are system paritions that I'll delete.







      share|improve this question











      I have a disk that was in a mdadm raid1 with a btrfs partition.
      Now I want to use this partition without the raid stuff and mount it normally.
      I already zeroed the mdadm superblock, but now the offsets that mdadm created are still present and I can't mount the partition.
      Before I deleted the superblock, I noted that the data offset was 2048.



      What can I do now? I would try to move the partition by that 2048 bit, but I'm not sure how to do that exactly.



      Wouldn't it be enough to alter the parition table and set the begin sector 2048 bits further?



      Edit:
      Here is the full information from mdadm



      mdadm --examine /dev/sdb
      /dev/sdb:
      MBR Magic : aa55
      Partition[0] : 4980480 sectors at 2048 (type fd)
      Partition[1] : 4194304 sectors at 4982528 (type fd)
      Partition[2] : 11329536 sectors at 9437184 (type fd)
      root@debian-test:/home/debian# mdadm --examine /dev/sdb3
      /dev/sdb3:
      Magic : a92b4efc
      Version : 1.2
      Feature Map : 0x0
      Array UUID : 8bd40f46:896acdc5:6f3fa1f7:67f779fc
      Name : dsm-virtualbox:2
      Creation Time : Thu Jul 12 23:05:16 2018
      Raid Level : raid1
      Raid Devices : 1

      Avail Dev Size : 11327488 (5.40 GiB 5.80 GB)
      Array Size : 5663744 (5.40 GiB 5.80 GB)
      Data Offset : 2048 sectors
      Super Offset : 8 sectors
      Unused Space : before=1968 sectors, after=0 sectors
      State : clean
      Device UUID : 5cf0a635:f107d2b7:18498037:0a9d68f7

      Update Time : Thu Jul 12 23:29:40 2018
      Checksum : b3b49d3d - correct
      Events : 6


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


      I'm only interested in partition 3, the rest are system paritions that I'll delete.









      share|improve this question










      share|improve this question




      share|improve this question









      asked Jul 12 at 22:24









      Fizz Khalifa

      82




      82




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          I am no expert for mdadm, but assuming raw data with just an offset, you are right since you can alter the partition table for accessing the partition as such. You probably need to delete the partition and then create a new partition at the desired location. The MBR is self contained, no data will be written to the partition itself (this is only true for primary partitions).



          Alternatively, you can wrap a block device with a loop device, starting at a given offset. The offset reportedly is 2048 sectors, an equivalent of 2048 · 512 = 1048576 bytes.



          offset=1048576
          losetup -f /dev/sdb3 -o $offset


          Then mount the newly created loop block device (usually /dev/loop0).



          Or using mount directly:



          mount -o loop,ro,offset=$offset /dev/sdb3 /mountpoint


          (ro added for safety reasons during experiments.)






          share|improve this answer























          • Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
            – Fizz Khalifa
            Jul 13 at 0:14











          • My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
            – Hermann
            Jul 13 at 10:37










          • Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
            – Fizz Khalifa
            Jul 14 at 23:11











          • You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
            – Hermann
            Jul 15 at 0:08










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454996%2fmdadm-raid-1-how-to-remove-raid-and-remove-data-offset-to-mount-normally%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          I am no expert for mdadm, but assuming raw data with just an offset, you are right since you can alter the partition table for accessing the partition as such. You probably need to delete the partition and then create a new partition at the desired location. The MBR is self contained, no data will be written to the partition itself (this is only true for primary partitions).



          Alternatively, you can wrap a block device with a loop device, starting at a given offset. The offset reportedly is 2048 sectors, an equivalent of 2048 · 512 = 1048576 bytes.



          offset=1048576
          losetup -f /dev/sdb3 -o $offset


          Then mount the newly created loop block device (usually /dev/loop0).



          Or using mount directly:



          mount -o loop,ro,offset=$offset /dev/sdb3 /mountpoint


          (ro added for safety reasons during experiments.)






          share|improve this answer























          • Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
            – Fizz Khalifa
            Jul 13 at 0:14











          • My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
            – Hermann
            Jul 13 at 10:37










          • Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
            – Fizz Khalifa
            Jul 14 at 23:11











          • You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
            – Hermann
            Jul 15 at 0:08














          up vote
          0
          down vote



          accepted










          I am no expert for mdadm, but assuming raw data with just an offset, you are right since you can alter the partition table for accessing the partition as such. You probably need to delete the partition and then create a new partition at the desired location. The MBR is self contained, no data will be written to the partition itself (this is only true for primary partitions).



          Alternatively, you can wrap a block device with a loop device, starting at a given offset. The offset reportedly is 2048 sectors, an equivalent of 2048 · 512 = 1048576 bytes.



          offset=1048576
          losetup -f /dev/sdb3 -o $offset


          Then mount the newly created loop block device (usually /dev/loop0).



          Or using mount directly:



          mount -o loop,ro,offset=$offset /dev/sdb3 /mountpoint


          (ro added for safety reasons during experiments.)






          share|improve this answer























          • Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
            – Fizz Khalifa
            Jul 13 at 0:14











          • My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
            – Hermann
            Jul 13 at 10:37










          • Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
            – Fizz Khalifa
            Jul 14 at 23:11











          • You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
            – Hermann
            Jul 15 at 0:08












          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          I am no expert for mdadm, but assuming raw data with just an offset, you are right since you can alter the partition table for accessing the partition as such. You probably need to delete the partition and then create a new partition at the desired location. The MBR is self contained, no data will be written to the partition itself (this is only true for primary partitions).



          Alternatively, you can wrap a block device with a loop device, starting at a given offset. The offset reportedly is 2048 sectors, an equivalent of 2048 · 512 = 1048576 bytes.



          offset=1048576
          losetup -f /dev/sdb3 -o $offset


          Then mount the newly created loop block device (usually /dev/loop0).



          Or using mount directly:



          mount -o loop,ro,offset=$offset /dev/sdb3 /mountpoint


          (ro added for safety reasons during experiments.)






          share|improve this answer















          I am no expert for mdadm, but assuming raw data with just an offset, you are right since you can alter the partition table for accessing the partition as such. You probably need to delete the partition and then create a new partition at the desired location. The MBR is self contained, no data will be written to the partition itself (this is only true for primary partitions).



          Alternatively, you can wrap a block device with a loop device, starting at a given offset. The offset reportedly is 2048 sectors, an equivalent of 2048 · 512 = 1048576 bytes.



          offset=1048576
          losetup -f /dev/sdb3 -o $offset


          Then mount the newly created loop block device (usually /dev/loop0).



          Or using mount directly:



          mount -o loop,ro,offset=$offset /dev/sdb3 /mountpoint


          (ro added for safety reasons during experiments.)







          share|improve this answer















          share|improve this answer



          share|improve this answer








          edited Jul 13 at 10:37


























          answered Jul 12 at 22:41









          Hermann

          47428




          47428











          • Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
            – Fizz Khalifa
            Jul 13 at 0:14











          • My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
            – Hermann
            Jul 13 at 10:37










          • Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
            – Fizz Khalifa
            Jul 14 at 23:11











          • You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
            – Hermann
            Jul 15 at 0:08
















          • Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
            – Fizz Khalifa
            Jul 13 at 0:14











          • My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
            – Hermann
            Jul 13 at 10:37










          • Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
            – Fizz Khalifa
            Jul 14 at 23:11











          • You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
            – Hermann
            Jul 15 at 0:08















          Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
          – Fizz Khalifa
          Jul 13 at 0:14





          Just tried it and still got no valid mount: mount -o loop,ro,offset=2048 /dev/sdb3 /mnt/ mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
          – Fizz Khalifa
          Jul 13 at 0:14













          My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
          – Hermann
          Jul 13 at 10:37




          My bad. The offset is given in sectors, not bytes. I adjusted my answer. Also relevant: unix.stackexchange.com/questions/64889/…
          – Hermann
          Jul 13 at 10:37












          Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
          – Fizz Khalifa
          Jul 14 at 23:11





          Thanks, just tested it and all worked as expected. I also recreated the partition starting 2048 sectors further, now I can mount it normally. Sadly there seems to be no way to expand that partition to the left to use the space of the first two partitions... still thanks a lot.
          – Fizz Khalifa
          Jul 14 at 23:11













          You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
          – Hermann
          Jul 15 at 0:08




          You are correct. All filesystems I know cannot grow into space before the beginning. But you can move the partition with the filesystem to the beginning of the disk. I recommend gparted. This action is somewhat dangerous as data is physically copied around on the disk. In case of a power loss, complete data loss is likely.
          – Hermann
          Jul 15 at 0:08












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454996%2fmdadm-raid-1-how-to-remove-raid-and-remove-data-offset-to-mount-normally%23new-answer', 'question_page');

          );

          Post as a guest