If you have a NETGEAR Readynas NAS and you want to migrate your data to a bigger disk, there is not too much information in the Netgear Forum about how to do it.
Here is how you can do it. You will require an external Linux machine (a Raspberry PI or Banana PI/Pro can do the trick)
First, you have the RAID 1 set up with (i.e) 2x 2Tb disks.
- Attach the new disk to one of the available USB ports in the NAS.
- Sync the entire 2tb disk onto the new (i.e) 5Tb disk with:
# dd if=/dev/sda of=/dev/sdc
(please, note sdc has to be the new disk, you can check it with fdisk -l and indentify the new disk, i.e by size or by dmesg after attachig the disk).
Once this dd finished (it can take 8 hours or more), you will have a new 5tb disk synced with the 2Tb data with same partitions size as the original 2tb disk.
Now you have to resize the 3rd partition (the one that belongs to md127) on your new disk to fit the entire disk.
Based on the below useful information about what you need to resize first:
Tasks | Description | Order If Increasing Size | Order If Decreasing Size |
---|---|---|---|
Resize each of the component partitions. | Increase or decrease the active size of each component partition. You remove only one component partition at a time, modify its size, then return it to the RAID. | 1 | 2 |
Resize the software RAID itself. | The RAID does not automatically know about the increases or decreases you make to the underlying component partitions. You must inform it about the new size. | 2 | 3 |
Resize the file system. | You must resize the file system that resides on the RAID. This is possible only for file systems that provide tools for resizing. | 3 | 1 |
Let’s proceed. You will have to attach and run the next steps in a different linux machine (i.e. Banana Pi or Raspberry) with the new disk attached to the USB port.
- with Parted, edit the partition number (in our case 3). sdc is the new bigger size disk.
# parted /dev/sdc Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used. OK/Cancel? OK Model: Seagate Expansion Desk (scsi) Disk /dev/sdc: 5001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 32,8kB 4295MB 4295MB raid 2 4295MB 4832MB 537MB raid 3 4832MB 2000GB 1996GB raid (parted) resizepart Partition number? 3 End? [2000GB]? 5001GB Error: Not enough space on device during write on /dev/sdc Retry/Ignore/Cancel? I (parted) p Model: Seagate Expansion Desk (scsi) Disk /dev/sdc: 5001GB Sector size (logical/physical): 512B/4096B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 32,8kB 4295MB 4295MB raid 2 4295MB 4832MB 537MB raid 3 4832MB 4500GB 4495GB raid (parted) quit Information: You may need to update /etc/fstab.
Basically, we are increasing the md127 partition to fit the entire disk. Note. 5001Gb is the value in the header of parted. (Disk /dev/sdc: 5001GB) bigger or smaller disks will have other values.
- Check, enabling the mdadm device
# mdadm -A --scan mdadm: /dev/md/2fe74896:data-0 has been started with 1 drive (out of 2). mdadm: /dev/md/2fe74896:1 has been started with 1 drive. mdadm: /dev/md/2fe74896:0 has been started with 1 drive (out of 2).
- Now resize the size of the mdadm device:
# mdadm --grow --size max /dev/md127 mdadm: component size of /dev/md127 has been set to 4389681554K unfreeze
- As this is btrfs, we need to mount it and resize it online.
# mount /dev/md127 /mnt/sdb # btrfs filesystem resize max /mnt/sdb Resize '/mnt/sdb' of 'max' # echo $? 0 # df -h|grep md127 S.ficheros Tamaño Usados Disp Uso% Montado en /dev/md127 5,6T 1,6T 2,6T 39% /mnt/sdb
- Now we have the md127 partition of the disk using the entire available space.
Now you will have to stop your NAS device, and replace the two similar current disks with the new one and start the NAS. Once it will be up you only have to attach a second disk with similar size and the system will automatically start synchronicing the data.
If something goes wrong starting the NAS, just stop the NAS again, and replace the new bigger disk with the two old smaller ones that have not been modified and are synced.