RAID1 to single disk
-
- New here
- Posts: 3
- Joined: Sat Jan 30, 2021 1:36 am
Re: RAID1 to single disk
Hi, It is great work ! Thanks !
But unfortunately I have an issue during expansion.
GUI and command line show different sizes on my TS-332X.
It looks that there is a separate data base for GUI and it should be also updated to enable possibility to resize the volume.
Any idea how to fix it ?
[~] # mdadm --query --detail /dev/md1
/dev/md1:
Version : 1.0
Creation Time : Tue Dec 10 23:06:27 2019
Raid Level : raid1
Array Size : 14892500000 (14202.60 GiB 15249.92 GB)
Used Dev Size : 14892500000 (14202.60 GiB 15249.92 GB)
Raid Devices : 1
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Fri Jan 29 19:25:20 2021
State : clean
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : 1
UUID : xxxx:yyyaaa
Events : 4650
Number Major Minor RaidDevice State
2 8 51 0 active sync /dev/sdd3
But unfortunately I have an issue during expansion.
GUI and command line show different sizes on my TS-332X.
It looks that there is a separate data base for GUI and it should be also updated to enable possibility to resize the volume.
Any idea how to fix it ?
[~] # mdadm --query --detail /dev/md1
/dev/md1:
Version : 1.0
Creation Time : Tue Dec 10 23:06:27 2019
Raid Level : raid1
Array Size : 14892500000 (14202.60 GiB 15249.92 GB)
Used Dev Size : 14892500000 (14202.60 GiB 15249.92 GB)
Raid Devices : 1
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Fri Jan 29 19:25:20 2021
State : clean
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : 1
UUID : xxxx:yyyaaa
Events : 4650
Number Major Minor RaidDevice State
2 8 51 0 active sync /dev/sdd3
You do not have the required permissions to view the files attached to this post.
-
- Getting the hang of things
- Posts: 50
- Joined: Sat Nov 21, 2009 7:31 am
- Location: Bizkaia
Re: RAID1 to single disk
Hi wknighta
Have you tried to restart the nas?
It’s possible the GUI may not have been refreshed
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
Have you tried to restart the nas?
It’s possible the GUI may not have been refreshed
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
-
- New here
- Posts: 3
- Joined: Sat Jan 30, 2021 1:36 am
Re: RAID1 to single disk
Dear Ganekogorta,
Regards
I tried twice. It doesn't help.ganekogorta wrote: ↑Sat Jan 30, 2021 5:27 am Have you tried to restart the nas?
It’s possible the GUI may not have been refreshed
Regards
-
- New here
- Posts: 3
- Joined: Sat Jan 30, 2021 1:36 am
Re: RAID1 to single disk
Hi all,
Magic command to fix the issue:
mdadm --grow /dev/md1 --size=max
There is no need to calculate the size. It seems that in my case it was wrong.
After the update of the size I got:
[~] # mdadm --detail /dev/md1
/dev/md1:
Version : 1.0
Creation Time : Tue Dec 10 23:06:27 2019
Raid Level : raid1
Array Size : 15615918972 (14892.50 GiB 15990.70 GB)
Used Dev Size : 15615918972 (14892.50 GiB 15990.70 GB)
Raid Devices : 1
Total Devices : 1
Persistence : Superblock is persistent
Magic command to fix the issue:
mdadm --grow /dev/md1 --size=max
There is no need to calculate the size. It seems that in my case it was wrong.
After the update of the size I got:
[~] # mdadm --detail /dev/md1
/dev/md1:
Version : 1.0
Creation Time : Tue Dec 10 23:06:27 2019
Raid Level : raid1
Array Size : 15615918972 (14892.50 GiB 15990.70 GB)
Used Dev Size : 15615918972 (14892.50 GiB 15990.70 GB)
Raid Devices : 1
Total Devices : 1
Persistence : Superblock is persistent
You do not have the required permissions to view the files attached to this post.
-
- Getting the hang of things
- Posts: 50
- Joined: Sat Nov 21, 2009 7:31 am
- Location: Bizkaia
Re: RAID1 to single disk
Hi
Thanks for your note
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
Thanks for your note
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
-
- Know my way around
- Posts: 186
- Joined: Sat Nov 29, 2014 5:21 pm
-
- Starting out
- Posts: 36
- Joined: Mon Apr 19, 2021 11:47 am
Re: RAID1 to single disk
Thank you for this. I migrated from a 750 GB disk to a 3 TB disk. After I finished successfully, I was still stuck with a 750 GB RAID size. I couldn't figure out how to expand either the volume or the RAID group using the GUI, but your command did the job. The system seemed a little slow after rebooting, but the QNAP is now optimizing - very slowly - so hopefully once it is done it'll speed up.
I just finished this process, and yes, you can resize without losing data.
ganekogorta, thank you very much for writing this procedure. I used it successfully, and saved a lot of time. I found a couple corrections. In the above command, the third parameter should beganekogorta wrote: ↑Fri Nov 01, 2019 5:56 pm I run the following command by console to reduce the number of raid members to a single member. I get a single-disc Raid1
"mdadm --grow /dev/md1 --raid-devices-1 --force"
Code: Select all
--raid-devices=1
I'm using a TS-230, so my situation may be slightly different from yours. Unfortunately, I didn't have the raid.conf file from when I did my initial setup with the smaller drive. But I found raid.conf.bkup and raid.conf in /etc/config, and comparing the two, I set the following:ganekogorta wrote: ↑Fri Nov 01, 2019 5:56 pm I've removed the lines that begin with "scrubstatus, eventskipped, eventcompleted,degradedcnt".
I've removed the line that starts with "data_0", and the one that starts with "data_1" I've modified it to "data_0 = 1, disk_serial_number"
I removed the lines from the [Remove] field
I've changed chunkSize from 64 to value 0
I've changed readAhead from 4096 to value 0
I've changed databitmap from 3 to value 1
chunkSize 0 --> 512
readAhead 4096 --> 0
dataBitmap 3 --> 1
Both my backup and active raid.conf file had dataBitmap set to 3, but I followed your example and set it to 1. From what I'm able to find, the dataBitmap doesn't seem to make sense for a single disk.
TS-230, TS-253A, both with latest stable QTS
-
- Starting out
- Posts: 19
- Joined: Sun Oct 30, 2016 8:58 pm
Re: RAID1 to single disk
I tried to follow the steps to replace the drive, but i do not have the file raid.conf on my nas.
It is TS-439 Pro II with QTS 4.2.6 20210327
[/etc/config] # cat raid.conf
cat: raid.conf: No such file or directory
I looked in other directories as well but the file is not there.
It is TS-439 Pro II with QTS 4.2.6 20210327
[/etc/config] # cat raid.conf
cat: raid.conf: No such file or directory
I looked in other directories as well but the file is not there.
-
- Getting the hang of things
- Posts: 50
- Joined: Sat Nov 21, 2009 7:31 am
- Location: Bizkaia
Re: RAID1 to single disk
Hi
Uff, QTS 4.2.6 on a robust TS-439Pro II.
How old is it? 9 years?
I think that the organization system is diferent than the new QTS and we cannot apply the same instructions.
I'm going to test on an old ts219, but i think it runs QTS4.3.3
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
Uff, QTS 4.2.6 on a robust TS-439Pro II.
How old is it? 9 years?
I think that the organization system is diferent than the new QTS and we cannot apply the same instructions.
I'm going to test on an old ts219, but i think it runs QTS4.3.3
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
-
- Starting out
- Posts: 19
- Joined: Sun Oct 30, 2016 8:58 pm
Re: RAID1 to single disk
There is no newer firmware for my device unfortunately.ganekogorta wrote: ↑Fri May 07, 2021 1:29 pm Hi
Uff, QTS 4.2.6 on a robust TS-439Pro II.
How old is it? 9 years?
I think that the organization system is diferent than the new QTS and we cannot apply the same instructions.
I'm going to test on an old ts219, but i think it runs QTS4.3.3
Un saludo
Agur eta ondo ibilli
Mon (TS-469Pro, TVS-673, QBoat Sunny y TS-453Be)
It seems there is only the ".conf" file which contains HDD SN's.
During the start of the NAS, "raidtab" file and "md_brief.conf" file are created based on the drives superblocks by "/sbin/disk_reorder --patch" command.
I will confirm later, I am recreating the RAID1 again.
I already did it once, but the new drive was still reported as raid after the mdadm grow and not a single drive and also i was confused by fdisk not showing the partitions (it seems to be due to the 4TB drive wich is not supported by the fdisk version).
So I removed the raid by following commands and i am back at the beginning, trying again.
mdadm --stop /dev/md3
mdadm --remove /dev/md3
mdadm --zero-superblock /dev/sdb3
*****************
After the completion of RAID1 I ran following commands
/etc/init.d/services.sh stop
mdadm /dev/md0 --fail /dev/sdb3
mdadm /dev/md0 --remove /dev/sdb3
mdadm --grow /dev/md0 --force --raid-devices=1
mdadm --grow /dev/md0 --size=max
mdadm --stop /dev/md0
mdadm --remove /dev/md0
mdadm --zero-superblock /dev/sdd3
I changed the SN in ".conf" file and cleared the "raidtab" and "md_brief.conf" and edited the "smb.conf" as there was md0 mentioned instead of HDA.
After the reboot I was able to see my new drive working including the shares.
But the volume size was reported as the size of the previous drive.
The partition size was set correct but the filesystem occupied only half of it .
df
dumpe2fs -h /dev/sdb3
[~] # resize2fs /dev/sdb3
resize2fs 1.41.4 (27-Jan-2009)
resize2fs: Filesystem has unsupported feature(s) while trying to open /dev/sdb3
Couldn't find valid filesystem superblock.
Unfortunately there was an old version of resize2fs so i was not able to resize it on the nas . I had to remove the drive and do it from lubuntu.
Everything was correct when i put the drive back to the nas than.
-
- New here
- Posts: 2
- Joined: Fri Jun 08, 2018 11:37 am
Re: RAID1 to single disk
Hi there....
I followed the instructions and everything worked a treat!
Now I want to reuse the original drive from bay 1 again in my unit but it keeps failing to create storage pool. Does anyone have an Idea why, i have read that people open a service ticket and support remove something to do with the superblock.
Thanks in advance
I followed the instructions and everything worked a treat!
Now I want to reuse the original drive from bay 1 again in my unit but it keeps failing to create storage pool. Does anyone have an Idea why, i have read that people open a service ticket and support remove something to do with the superblock.
Thanks in advance
-
- Starting out
- Posts: 19
- Joined: Sun Oct 30, 2016 8:58 pm
Re: RAID1 to single disk
You can just set the drive as global spare and unset again.maxknysna@gmail.com wrote: ↑Mon May 24, 2021 4:12 pm Now I want to reuse the original drive from bay 1 again in my unit but it keeps failing to create storage pool. Does anyone have an Idea why, i have read that people open a service ticket and support remove something to do with the superblock.
Or clear the superblock manually
mdadm --zero-superblock /dev/sdxx
-
- Starting out
- Posts: 22
- Joined: Fri May 10, 2019 1:03 pm
Re: RAID1 to single disk
Amazing and very useful technique, I recently got QM2-2P-344 card and will install 2TB 960 EVO on my TVS-463ganekogorta wrote: ↑Fri Nov 01, 2019 5:56 pm Hi
I'll try to explain how to undo a raid 1 of TWO disks to ONE only.
It is even valid if it contains system volume. In fact this is the most interesting thing, especially for those who only have two bays in the QNAP.
This may be interesting for the following cases:
- I have a disk with SMART crash warnings, I buy one same size, expand to RAID1 and remove it by removing the "touched" disk
We're going to need access to the console. I use WinSCP and Putty.
- I have a RAID1 and I want to undo it to reuse a disk because I need space or to mount it as a single drive.
My Qnap is a TS469Pro with QTS 4.3.4
Just in case I recommend a data backup, as a failure can cost us to lose everything
This case is the easiest since we are going to take advantage of a file that we already have.
- 1- We start from a single disk, create a raid1 and remove the old disk
Initially I have a disk in bay1 (the first) as a simple disk. It's size is 160GB and it's serial number is 5RX0XIJN
We examine and save the contents of the /etc/config/raid.conf file (which is actually located in /mnt/HDA_ROOT/.config/raid.conf)
Raid1 constructionCode: Select all
[Global] raidBitmap = 0x2 pd_5RX0XIJN_Raid_Bitmap = 0x2 [RAID_1] uuid = adcdd09b:1286b132:793faae3:09f1257a id = 1 partNo = 3 aggreMember = no readonly = no legacy = no version2 = yes deviceName = /dev/md1 raidLevel = 1 internal = 1 mdBitmap = 0 chunkSize = 64 readAhead = 0 stripeCacheSize = 0 speedLimitMax = 0 speedLimitMin = 0 data_0 = 1, 5RX0XIJN dataBitmap = 1
Now we physically add in the second bay the "new" 160GB disk and serial number 5RX0XHMS.
The nas will let us know that it has detected it by beeping and will prepare the disc.
Remember that if that disk has something it will erase it without asking (as long as they are not previous QNAP partitions).
From the menus, migrate from single disk to RAID1
We finish the wizard and wait for both disks to be synchronized (be patience if you have large disks)
When it's finished we'll be with something similar to this
Now again we get the contents of the new /etc/config/raid.conf fileThese values have changed:Code: Select all
[Global] raidBitmap = 0x2 pd_5RX0XIJN_Raid_Bitmap = 0x2 pd_5RX0XHMS_Raid_Bitmap = 0x2 [RAID_1] uuid = adcdd09b:1286b132:793faae3:09f1257a id = 1 partNo = 3 aggreMember = no readonly = no legacy = no version2 = yes deviceName = /dev/md1 raidLevel = 1 internal = 1 mdBitmap = 0 chunkSize = 0 readAhead = 4096 stripeCacheSize = 0 speedLimitMax = 0 speedLimitMin = 50000 data_0 = 1, 5RX0XIJN data_1 = 2, 5RX0XHMS dataBitmap = 3 scrubStatus = 1 eventSkipped = 0 eventCompleted = 1 degradedCnt = 0
chunkSize = 0
readAhead = 4096
dataBitmap = 3
And these are the new lines:
pd_5RX0XHMS_Raid_Bitmap = 0x2
data_1 = 2, 5RX0XHMS
scrubStatus = 1
eventSkipped = 0
eventCompleted = 1
degradedCnt = 0
Now go to the console and using the mdadm command you can see the status and other information of the raid.
Run "mdadm --query --detail /dev/md1" where md1 is the first (and only) raid1 created on the nas.
You see the correct size and status information for "clean". We also see in the lower lines the partitions involved in it.
On disk number 0 (bay 1) the partition is /dev/sda3
On disk number 1 (bay 2) the partition is the /dev/sdb3
Now we put the first disk into failure mode and extract the disk using two commands:
"mdadm /dev/md1 --fail /dev/sda3"
"mdadm /dev/md1 --remove /dev/sda3"
The nas will beep and activate the red alarm LED. Now we can physically extract the disk from the first bay (the original)
If we go to the QTS environment we'll see the following
We can also see it from the console with "mdadm --query --datail /dev/md1"
I run the following command by console to reduce the number of raid members to a single member. I get a single-disc Raid1
"mdadm --grow /dev/md1 --raid-devices=1 --force"
Now we need to edit the /etc/config/raid.conf file to look like this:I've removed the lines that begin with "scrubstatus, eventskipped, eventcompleted,degradedcnt".Code: Select all
[Global] raidBitmap = 0x2 pd_5RX0XHMS_Raid_Bitmap = 0x2 [RAID_1] uuid = adcdd09b:1286b132:793faae3:09f1257a id = 1 partNo = 3 aggreMember = no readonly = no legacy = no version2 = yes deviceName = /dev/md1 raidLevel = 1 internal = 1 mdBitmap = 0 chunkSize = 64 readAhead = 0 stripeCacheSize = 0 speedLimitMax = 0 speedLimitMin = 50000 data_0 = 1, 5RX0XHMS dataBitmap = 1 [Remove]
I've removed the line that starts with "data_0", and the one that starts with "data_1" I've modified it to "data_0 = 1, disk_serial_number"
I removed the lines from the [Remove] field
I've changed chunkSize from 64 to value 0
I've changed readAhead from 4096 to value 0
I've changed databitmap from 3 to value 1
We can be done faster if you take advantage of and edit the initial file (raid.conf) when there was a single disk, we would only have to update the serial number of the disk with the new one.
Once the change is saved, we turn off the nas via QTS or from the console with "halt".
When it's off, we move the disk from Bay 2 to Bay 1 and mission accomplished.
We started and we already have our new record with everything we had in the original.
If we go to the QTS environment we will see the following:
And if we do it by console
The disk that was in Bay 1 and we removed, contains EVERYTHING, nothing has been deleted.
If we want to use it on the nas again we must delete the five partitions.
I hope it will be useful for qnap nas owners with two bays who wants to change that disk.
P.D. If you see spelling errors, clemence with me
Regards from Spain
I want to make this a primary drive instead of old WD-Blue 5400RPM HDD. I will try your technique next week and hope that everything goes well.
Thanks alot ganekogorta I salute you.
-
- Starting out
- Posts: 12
- Joined: Thu Dec 29, 2016 4:37 pm
Re: RAID1 to single disk
Sorry for necroposting. I followed with success your detailed explanations, @ganekogorta. Thank you for taking the time to document it!ganekogorta wrote: ↑Fri Nov 01, 2019 5:56 pm I'll try to explain how to undo a raid 1 of TWO disks to ONE only.
DISCLAIMER: follow that procedure ONLY if you have a full backup of your NAS data.
I own a QNAP TVS-471 model with 4-bays here with firmware 5.0.0.1785. Some days ago, one of my two 6TB disks in a RAID1 mirror configuration started to show SMART ID 197 and ID 198 errors. My plan is to move to two 8TB RAID1 disks. For several practical reasons, it is best for me to first downgrade to no-raid for some days (yes, I know this is risky, but I have a full safe backup of the important information).
I document here only the differences I experienced.
1. In my case, the first line of the raid.conf file was way longer:
Code: Select all
raidBitmap = 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e
3. After issuing the mdadm --fail command, the NAS beeped twice. The mdadm --remove command failed in my case, but this didn't seem to affect the procedure.
Code: Select all
[/etc/config] # mdadm /dev/md1 --fail /dev/sda3
mdadm: set /dev/sda3 faulty in /dev/md1
[/etc/config] # mdadm /dev/md1 --remove /dev/sda3
mdadm: hot remove failed for /dev/sda3: No such device or address
Code: Select all
[Remove]
0x00000001 = 0x2
Of course, none of the actions above are supported by QNAP, "do at your own risk".
-
- Starting out
- Posts: 12
- Joined: Thu Dec 29, 2016 4:37 pm
Re: RAID1 to single disk
Well, I was able to complete the move. It was very easy to swap disks in slots. I just changed this lines in the aforementioned /etc/config/raid.conf file to move a disk from (bothering) slot 2 to slot 4 (before shutting down the NAS, swapping the disks and restarting the NAS), to leave space for a new disk in slot 2 (of course, leave your disk id 50014E11111119D2 as is):5. This procedure could eventually work as well just to swap disks in slots. I didn't try that here, but plan to do that once I move to a 2x8TB RAID1 group. I'd prefer to keep the 2 mirrored disks in adjacent slots.
Code: Select all
data_0 = 2, 50014E11111119D2
Code: Select all
data_0 = 4, 50014E11111119D2
The procedure to convert a single static disk in slot 1 to a RAID1/mirror (slots 1 + 2) is well documented elsewhere.
Of course, none of the actions above are supported by QNAP, "do at your own risk".