Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Marvell Kirkwood based
Post Reply
stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Mon Jun 18, 2018 7:44 am

Hi.

Been having a nightmare getting my old NSA325v1 to be viewable by my Win10 PC's and then expanded to 4TB usable RAID1.
The Samba side may be resolved (yet to check) thanks to Mijzelf's help, but expanding from 2x2TB to 2x4TB seems to be a real issue.

I followed the Disk replacement procedure and then the 'Expanding a RAID1 Volume' instructions in the manual, to the letter.
All was going OK prior the the Expansion. At this point I had both 4TB drives installed and the had been synced with one of the the 2TB drives - so the new 2x4TB drives RAID1 appeared to be 2TB usable (~90% full).
The first attempt of expansion appeared to go OK, but got stuck at 99%. I had to reboot. The second attempt does not even attempt an expand. It fsck checks the drives and goes no further.

Code: Select all

e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/md0: 617895/122068992 files (0.8% non-contiguous) 455603841/488249472 blocks
e2fsck -f -y return value:0 
I also notice that others have had similar issues - for instance viewtopic.php?f=249&t=17949&p=101423&hi ... on#p101423 where @nasmart appears to use telnet/ssh command to manually expand the Volume.

Its also worth pointing out that prior to any attempt at expand, if I view the folders via the file explorer on the NAS I only get a short list of mainly empty folders, whereas when I check the i-data folder via ssh putty session I see the data is on the drives. So is the partition map scr*wed?

What is the correct procedure to expand from 2x2TB to 2x4TB???

Many thanks.
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

Mijzelf
Posts: 6224
Joined: Mon Jun 16, 2008 10:45 am

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by Mijzelf » Mon Jun 18, 2018 9:54 am

stagger321 wrote:
Mon Jun 18, 2018 7:44 am

Code: Select all

/dev/md0: 617895/122068992 files (0.8% non-contiguous) 455603841/488249472 blocks
That's not good. The new volume has 488249472 'blocks', which is kB, so the total volume is 488GiB in size. I think it's an MBR issue.

Can you post the output of

Code: Select all

cat /proc/mdstat
cat /proc/partitions
df
fdisk -l /dev/sda

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Mon Jun 18, 2018 4:02 pm

Thansk for looking into this Mijzelf.

results as below:

Code: Select all

~ $ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1]
md0 : active raid1 sda2[0] sdb2[1]
      3906485112 blocks super 1.0 [2/2] [UU]

unused devices: <none>

Code: Select all

~ $ cat /proc/partitions
major minor  #blocks  name

   7        0     143360 loop0
   8        0 3906985816 sda
   8        1     498688 sda1
   8        2 3906485248 sda2
   8       16 3906985816 sdb
   8       17     498688 sdb1
   8       18 3906485248 sdb2
  31        0       1024 mtdblock0
  31        1        512 mtdblock1
  31        2        512 mtdblock2
  31        3        512 mtdblock3
  31        4      10240 mtdblock4
  31        5      10240 mtdblock5
  31        6      48896 mtdblock6
  31        7      10240 mtdblock7
  31        8      48896 mtdblock8
   9        0 3906485112 md0

Code: Select all

~ $ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mtdblock6           48896     44356      4540  91% /zyxel/mnt/nand
/dev/sda1               482922    475988      6934  99% /zyxel/mnt/sysdisk
/dev/loop0              138829    122762     16067  88% /ram_bin
/dev/loop0              138829    122762     16067  88% /usr
/dev/loop0              138829    122762     16067  88% /lib/security
/dev/loop0              138829    122762     16067  88% /lib/modules
/dev/ram0                 5120         4      5116   0% /tmp/tmpfs
/dev/ram0                 5120         4      5116   0% /usr/local/etc
/dev/ram0                 5120         4      5116   0% /usr/local/var
/dev/mtdblock4           10240      1564      8676  15% /etc/zyxel
/dev/md0             1922352464 1791769472 130582992  93% /i-data/c3fb44f8
/dev/md0             1922352464 1791769472 130582992  93% /usr/local/zy-pkgs
/dev/md0             1922352464 1791769472 130582992  93% /etc/zyxel/zy-pkgs
/dev/md0             1922352464 1791769472 130582992  93% /usr/local/apache/htdocs/adv,/pkg
/dev/md0             1922352464 1791769472 130582992  93% /usr/local/apache/web_framework/data/cache
/dev/mtdblock4           10240      1564      8676  15% /usr/local/apache/web_framework/data/config
/dev/md0             1922352464 1791769472 130582992  93% /usr/local/apache/htdocs/adv,/res/imdb_poster

Code: Select all

~ # fdisk -l /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 4000.7 GB, 4000753476096 bytes
255 heads, 63 sectors/track, 486397 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      267350  2147483647+  ee  GPT
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

Mijzelf
Posts: 6224
Joined: Mon Jun 16, 2008 10:45 am

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by Mijzelf » Mon Jun 18, 2018 4:20 pm

OK. It's not an MBR problem (fdisk -l).

The partitions sda2 and sdb2 are successfully resized (/proc/partitions), and so is the raid array (/proc/mdstat & /proc/partitions). But the filesystem is still it's old size (df).

I don't see how this matches the output of e2fsck.

Anyway, in theory you only have to run

Code: Select all

resize2fs /dev/md0
The manual of resize2fs says:
If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel and the file system supports on-line resizing. (Modern Linux 2.6 kernels will support online resize for file systems mounted using ext3 and ext4; ext3 file systems will require the use of file systems with the resize_inode feature enabled.)
I don't know if that resize_inode feature is enabled.

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Mon Jun 18, 2018 7:03 pm

That's great Mijzelf. I now have an expanded 4TB Volume. :D

I'm almost there now.
So as per the orig post I only get a short list of mainly empty folders in File Browser, whereas when I check the i-data folder via ssh putty session I see the data is on the drives.

I found something on one of your other posts here: viewtopic.php?f=249&t=16861

I presume I have to do the following to fix this and reboot and cross fingers??

Code: Select all

rm /etc/zyxel/storage/sysvol
ln -s /i-data/<YOUR_DIRECTORY> /etc/zyxel/storage/sysvol
Thanks
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Mon Jun 18, 2018 8:59 pm

Actually - the symbolic link looks OK.

Code: Select all

/etc/zyxel/storage # ls -l /etc/zyxel/storage/sysvol
lrwxrwxrwx    1 root     root            16 Mar  8  2013 /etc/zyxel/storage/sysvol -> /i-data/c3fb44f8
/etc/zyxel/storage # ls -l /etc/zyxel/storage/sysvol/
drwxrwsrwx    5 admin    root          4096 Jun  9 11:14 Backups
drwxrwsrwx    2 admin    root          4096 Jun 22  2016 Craig
drwxrwsrwx    5 admin    root          4096 Jun 22  2016 DVD-Rips
drwxrwsrwx    3 admin    root          4096 Jun 22  2016 Debbie
drwxrwxrwx    2 root     root          4096 Dec 11  2013 Documents
etc
etc
So that looks OK.

It looks like I can only now see 'Predefined' shares in the 'File Browser' for each user - as attachment for for user 'admin'. Apart from a couple of folders they are empty.
All the other 16 'User-created' shares that admin should have access to (and did have access to prior to the are 2x2TB->2x4TB upgrade) are not in the 'File Browser' list, but I can see the contents of them in the admin panels 'share browser'
Really odd.
You do not have the required permissions to view the files attached to this post.
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

Mijzelf
Posts: 6224
Joined: Mon Jun 16, 2008 10:45 am

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by Mijzelf » Tue Jun 19, 2018 6:58 am

Ah. In that case somewhere in the conversion flow that shares were not available when the file sharing daemon started, or something like that.

You'll have to re-enable the shares in the shares menu.

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Tue Jun 19, 2018 8:01 am

Hi Mijzelf.

I had a look at the shares list last night and couldn't see anything obviously wrong with the User shares list, in that they didn't look disabled.
I guess I must have missed some subtlety in the GUI to re-enable them.
I'll have a look later when I get home.

TBH, I am not that confident that the GUI does what it asks you too, and to make it "User-friendly", it hides too much. Although its been a long time (decades) since I was last working on UNIX, not Linux, you obviously see whats happening when telnet/ssh'd onto the box.

Thanks again for your help.
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Tue Jun 19, 2018 3:42 pm

Hi Mijzelf,

Its not that simple unfortunately.

All my User-Created shares are active.

As user admin, if I create another 'test' share and try and upload to that active share it won't allow me - permission denied.
There is something permission wise that is not enabling the shares properly or scr*wing the permissions
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Wed Jun 20, 2018 7:22 am

Morning all

Anyone know what daemon logs I should be looking at to debug this share issue.
As above, no user shares are working despite them all being set as active.
Plus when I create a new enabled share 'test' , and try and create a new subfolder in it via the File Browser GUI it won't - 'Permission denied'
Friggin anoying. With Mijzelf's help I finally have my 2x4TB installed and expanded, but have no way of accessing any shares.
AAARRRRGGGHHH
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

Mijzelf
Posts: 6224
Joined: Mon Jun 16, 2008 10:45 am

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by Mijzelf » Wed Jun 20, 2018 10:45 am

Bummer.

I'm certainly not a Samba expert, and never faced your problems. But I must admit that I didn't test the package with Windows (I don't own any Windows boxes). On Linux it works fine (for me).
In the [HOWTO] Update samba (to 3.6.25) using Entware-ng thread some suggestions for adaptation of /opt/etc/samba/ZyXELSambaReplacement.conf can be found, but AFAICS those are more about the guest account.
TBH, I am not that confident that the GUI does what it asks you too, and to make it "User-friendly", it hides too much. Although its been a long time (decades) since I was last working on UNIX, not Linux, you obviously see whats happening when telnet/ssh'd onto the box.
Yeah, that's a well-known limitation of a GUI. Implementation of the zillion options of Samba is hard, so you only get a (small) subset.
And the same GUI is also used for other sharing mechanisms (NFS, FTP, ...), which can have mutual exclusive options.

Anyway, as far as I know the stock samba is really 'stock'. So whatever the GUI does, all what matters is the content of /etc/samba/smb.conf, and /etc/samba/smbpasswd.

There could be some daemon changing the access permissions at filesystem level, but I guess in that case the stock samba would also suffer?
Anyone know what daemon logs I should be looking at to debug this share issue.
Don't know where to look at, but you can try to change the debug level in /opt/etc/samba/ZyXELSambaReplacement.conf, and see if it gives something useful.

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Fri Jun 29, 2018 1:36 pm

Hi Mijzelf

Been away for a few days and got back to looking at this - and debugging.
Tried to set debug level (to 3 - don't know if that is right), and did not get anywhere.

It seems to be an issue with the smbd and nmbd not starting with the new S09ZyXELSambaReplacement is run.
I get no Samba processes.
If I run the S09ZyXELSambaReplacement stop to replace your script with the orig/firmware S08samba start script they start both processes (smbd & nmbd).
I can then see the contents of each share in the Web GUI as expected.

I found a way to add a debug mode to the start of the S09ZyXELSambaReplacement script, thus:

Code: Select all

debug_me=true

if [[ $debug_me == true ]]; then

  # Close STDOUT
  exec 1<&-
  # Close STDERR
  exec 2<&-

  LOG_FILE=/var/log/init/initlog.log


  # Open STDOUT as $LOG_FILE file for read and write.
  exec 1<>$LOG_FILE

  # Redirect STDERR to STDOUT
  exec 2>&1

  # Display shell commands with expanded args
  set -x

  fi
This writes to a logfile (/var/log/init/initlog.log).

If I run 'S09ZyXELSambaReplacement start' I get this, and no Samba processes start:

Code: Select all

/var/log/init # cat initlog.log
+ prgmname1=/opt/sbin/nmbd
+ prgmname2=/opt/sbin/smbd
+ configfile=/opt/etc/samba/ZyXELSambaReplacement.conf
+ nmbdpid=/opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid
+ smbdpid=/opt/var/run/smbd-ZyXELSambaReplacement.conf.pid
+ basename ./S09ZyXELSambaReplacement
+ [ S09ZyXELSambaReplacement = samba.sh ]
+ startreplacement
+ [ -f /etc/init.d/samba.replaced.sh ]
+ return
+ exit
If I run 'S09ZyXELSambaReplacement stop' I get this, and the old SMB1 Samba processes start:

Code: Select all

/var/log/init # cat initlog.log
+ prgmname1=/opt/sbin/nmbd
+ prgmname2=/opt/sbin/smbd
+ configfile=/opt/etc/samba/ZyXELSambaReplacement.conf
+ nmbdpid=/opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid
+ smbdpid=/opt/var/run/smbd-ZyXELSambaReplacement.conf.pid
+ basename /etc/init.d/samba.sh
+ [ samba.sh = samba.sh ]
+ stop
+ [ -f /opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid ]
+ cat /opt/var/run/nmbd-ZyXELSambaReplacement+ rm /etc/init.d/samba.sh
+ mv /etc/init.d/samba.replaced.sh /etc/init.d/samba.sh
+ [ -h /var/run/smbd.pid ]
+ rm /var/run/smbd.pid
+ [ -h /var/run/nmbd.pid ]
+ rm /var/run/nmbd.pid
+ sh /etc/init.d/samba.sh start
Starting Samba daemons: nmbd smbd.
+ exit
No such process
+ logger -t smbd service stopped
+ return 0
+ exit
I am soooooo close now. The shares work OK with the old SMB1 setup (not visible on PC), but I cannot get your replacement script to start any of the new SMB processes.
Really appreciate your help. Its probably something obvious, but...... I can't see what.
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Fri Jun 29, 2018 1:53 pm

Just to add - After the post above I tried the 'S09ZyXELSambaReplacement start' again and got a slightly diff result in the log file. Still no Samba processes, but diff logs:

Code: Select all

+ prgmname1=/opt/sbin/nmbd
+ prgmname2=/opt/sbin/smbd
+ configfile=/opt/etc/samba/ZyXELSambaReplacement.conf
+ nmbdpid=/opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid
+ smbdpid=/opt/var/run/smbd-ZyXELSambaReplacement.conf.pid
+ basename /etc/init.d/samba.sh
+ [ samba.sh = samba.sh ]
+ start
+ /opt/sbin/nmbd -D -s /opt/etc/samba/ZyXELSambaReplacement.conf
+ logger -t nmbd started /opt/sbin/nmbd, conf: /opt/etc/samba/ZyXELSambaReplacement.conf
+ /opt/sbin/smbd -D -s /opt/etc/samba/ZyXELSambaReplacement.conf
+ logger -t smbd started /opt/sbin/smbd, conf: /opt/etc/samba/ZyXELSambaReplacement.conf
+ return 0
+ exit
 ]
+ ln -s /opt/var/run/smbd-ZyXELSambaReplacement.conf.pid /var/run/smbd.pid
+ [ -f /var/run/nmbd.pid ]
+ ln -s /opt/var/run/nmbd-ZyXELSambaReplacement.conf.pid /var/run/nmbd.pid
+ [ ! -h /opt/var/lock ]
+ sh /etc/init.d/samba.sh start
So I tried manually starting each of the processes shown in the log file. Nothing :(:

Code: Select all

/var/log/init # /opt/sbin/nmbd -D -s /opt/etc/samba/ZyXELSambaReplacement.conf
/var/log/init # /opt/sbin/smbd -D -s /opt/etc/samba/ZyXELSambaReplacement.conf
/var/log/init # ps | grep smbd
/var/log/init #
/etc/init.d # cat /opt/etc/samba/ZyXELSambaReplacement.conf
[global]
#client max protocol = SMB2
max protocol = SMB2
log level = 3

include = /etc/samba/smb.conf

/etc/init.d # ls -al /opt/sbin
drwxr-xr-x    2 root     root          4096 Jun 13 13:00 .
drwxr-xr-x   10 root     root          4096 Jan  4 08:53 ..
-rwxr-xr-x    1 root     root        262864 Jan  4 08:53 eventlogadm
-rwxr--r--    1 root     root           399 Jan 29  2016 kernel-2.6.24-support.sh
-rwxr-xr-x    1 root     root        611824 Jan  4 08:53 ldconfig
lrwxrwxrwx    1 root     root            15 Jun 13 12:36 nmbd -> samba_multicall
-rwxr-xr-x    1 root     root        382944 Jan  4 08:53 pdbedit
-rwxr-xr-x    1 root     root        234592 Jan  4 08:53 profiles
-rwxr-xr-x    1 root     root       2170340 Jan  4 08:53 samba_multicall
lrwxrwxrwx    1 root     root            15 Jun 13 12:36 smbd -> samba_multicall
lrwxrwxrwx    1 root     root            15 Jun 13 12:36 smbpasswd -> samba_multicall
-rwxr-xr-x    1 root     root        281228 Jan  4 08:53 smbstatus
-rwxr-xr-x    1 root     root         27204 Jan  4 08:53 tdbbackup

Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

stagger321
Posts: 58
Joined: Fri Feb 08, 2013 2:52 pm

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by stagger321 » Fri Jun 29, 2018 3:05 pm

OK, So I got bored and removed the Entware-ng respostory via packages list uninstall
Re-installed Entware-ng and then reinstalled the samba 3.6.25 OK.

This time I can start the S09ZyXELSambaReplacement script OK,
This restarts fine after reboot

Code: Select all

~ $ ps |grep smbd
 3769 root      5252 S    /opt/sbin/smbd -D -s /opt/etc/samba/ZyXELSambaReplac
~ $ ps|grep nmbd
 3766 root      5212 S    /opt/sbin/nmbd -D -s /opt/etc/samba/ZyXELSambaReplac
~ $
But I still can't see the shares via the Zyxel GUI or via a Windows map. Only time I can get to the shares is via GUI re-enabling SMB1 with 'S09ZyXELSambaReplacement stop'

ARRRGGGGGHHHH
Cheers

Stagger

NSA325_4.80(AAAJ.0), FFP 0.7, [2 x 2TB WD Caviar Greens (WD20EZRX) - RAID1]

Mijzelf
Posts: 6224
Joined: Mon Jun 16, 2008 10:45 am

Re: Correct procedure for moving from 2x2TB RAID1 to 2x4TB??

Post by Mijzelf » Fri Jun 29, 2018 3:07 pm

The reason why smbd doesn't start is probably in it's own logs:
ERROR: can't open /opt/var/run/smbd-ZyXELSambaReplacement.conf.pid: Error was File exists
Although I don't know why that file already exists. It's generated by /opt/sbin/smbd on start, and that process is supposed to clean it up on stop.
Further /opt/var/run/ is supposed to be a ramdrive, so after a reboot the file should be gone.

About your specific samba problems, you might want to have a look at this.
barmalej2 provides a heart transplantation for FFP, and has adapted my 'samba replacement script' for FFP samba. I really don't know if that solves your problem, but it might be worth a try.

Post Reply