× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Manually Resizing Readynas Duo 2 X-Raid2 Volume

lazyfox
Follower

Manually Resizing Readynas Duo 2 X-Raid2 Volume

Hi,

I had the following problem: I wanted to replace Samsung 1TB HD with a new shinny WD RED 2 TB without factory reset.

In my case I only use one HD since I can afford to have my NAS off-line for some time. Obviously I have a full back-up on external usb HD kept off-site.

So these are steps to follow:

1) Insert 2TB HD and wait for replication to complete
2) Remove 1TB HD to have non-redundant configuration with 1TB capacity
At this point you might install another 2TB HD to extend capacity to 2TB, but this wasn't option for me, since it meant a purchase of another 2TB HD which I did not need.
3) Login as root (ssh)
4) Run parted (if not installed run apt-get install parted)
5) Run print in parted:

(parted) print
Model: WDC WD20EFRX-68AX9N0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 32.8kB 4295MB 4295MB raid
2 4295MB 4832MB 537MB raid
3 4832MB 1000GB 995GB raid

###As you can see the /dev/sda is a 2000GB drive, but available was only 995GB

6) Create another logical partition (still within parted)

(parted) mkpart logical 1000GB 2000GB
(parted) print
Model: WDC WD20EFRX-68AX9N0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 32.8kB 4295MB 4295MB raid
2 4295MB 4832MB 537MB raid
3 4832MB 1000GB 995GB raid
4 1000GB 2000GB 1000GB logical

### another 1TB partition no. 4 created

7) quit parted
(parted) q
Information: You may need to update /etc/fstab.

8 ) run lvm
root@Readynas:~# lvm

9) create a physical volume /dev/sda4 (sda4 because it is partition no. 4 on /dev/sda)

lvm> pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created


10) run pvs to display information about physical volumes
lvm> pvs
PV VG Fmt Attr PSize PFree
/dev/md2 c lvm2 a- 927.00g 7.00g
/dev/sda4 lvm2 a- 931.51g 931.51g

#### As you can see the Volume Group (VG) is called "c"

11) now we need to extend the Volume Group (VG) to include the new physical volume /dev/sda4 with vgextend command

lvm> vgextend c /dev/sda4
Volume group "c" successfully extended

12) now you can see extended VG
lvm> pvs
PV VG Fmt Attr PSize PFree
/dev/md2 c lvm2 a- 927.00g 7.00g
/dev/sda4 c lvm2 a- 931.50g 931.50g

13) to extend the logical volume to include the new space with lvextend we need to run vgdisplay

lvm> vgdisplay c
--- Volume group ---
VG Name c
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.81 TiB
PE Size 64.00 MiB
Total PE 29736
Alloc PE / Size 14720 / 920.00 GiB
Free PE / Size 15016 / 938.50 GiB
VG UUID hz3d0K-fOgY-73tL-THeR-cbgF-itgS-JACE0X

### the number we are looking for is "Free PE / Size" which in our case is 15016 / 938.50 GiB

14) now it is the time for lvextend

lvm> lvextend -l+15016 /dev/c/c
Extending logical volume c to 1.81 TiB
Logical volume c successfully resized

15) quit lvm

lvm> quit
Exiting.

16) and the last step is to expand the file system with resize2fs

root@Readynas:~# resize2fs /dev/c/c
resize2fs 1.41.14 (22-Dec-2010)
Filesystem at /dev/c/c is mounted on /c; on-line resizing required
old desc_blocks = 58, new_desc_blocks = 117
Performing an on-line resize of /dev/c/c to 487194624 (4k) blocks.
The filesystem on /dev/c/c is now 487194624 blocks long.

root@Readynas:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md0 4.0G 740M 3.1G 20% /
tmpfs 16K 0 16K 0% /USB
/dev/c/c 1.9T 849G 1003G 46% /c


17) that's all and you don't even have to reboot your NAS !!! 😄

Good luck.

PLEASE MAKE SURE THAT YOUR OLD 1TB HD IS NOT FORMATTED/DELETED WHILE YOU ARE STRUGGLING WITH THE ABOVE STEPS.

IT IS YOUR INSURANCE POLICY - IF SOMETHING GOES REALLY WRONG YOU CAN REPLACE 2TB HD WITH THE "OLD" 1TB HD AND YOU ARE OK

Good luck

lazyfox
Message 1 of 2
azer
Aspirant

Re: Manually Resizing Readynas Duo 2 X-Raid2 Volume

I was successfull doing this on my ultra 2 running 4.2.25 with some changes:
2) Depending on your braveness it might be wise to shutdown your readynas before pulling out the old drive
5) run "print free" in parted to view the free space and use the start end end numbers with the mkpart command
8 ) lvm doesn't run interactively, but the commads like pvcreate work from the regular commandline
9) If you get " Device /dev/sda4 not found (or ignored by filtering)." then there is a filter in lvm.conf, edit it using your favourite editor
root@Readynas:~# pico /etc/lvm/lvm.conf
change
devices {
dir = "/dev"
scan = [ "/dev" ]
filter = [ "a|^/dev/md[2-9]|", "a|^/dev/md[12][0-9]|", "r/.*/" ]
cache = "/etc/lvm/.cache"

to
devices {
dir = "/dev"
scan = [ "/dev" ]
# filter = [ "a|^/dev/md[2-9]|", "a|^/dev/md[12][0-9]|", "r/.*/" ]
filter = [ "a/.*/" ]
cache = "/etc/lvm/.cache"

then run "pvcreate /dev/sda4" and change the file back again afterwords

Many thanks for your guide lazyfox 😄
Message 2 of 2
Top Contributors
Discussion stats
  • 1 reply
  • 1374 views
  • 0 kudos
  • 2 in conversation
Announcements