Orbi WiFi 7 RBE973
Reply

Making a folder appear as a volume in OS 6 GUI?

eton
Luminary

Making a folder appear as a volume in OS 6 GUI?

If a folder is created via SSH under /data/ like /data/New-folder, it will not appear as a normal share in ReadyNAS OS 6's web GUI. What needs to be edited to make that folder become a normal share? Specifically which terminal commands needs to be executed and which files needs to be edited?

 
Message 1 of 20
StephenB
Guru

Re: Making a folder appear as a volume in OS 6 GUI?


@eton wrote:

If a folder is created via SSH under /data/ like /data/New-folder, it will not appear as a normal share in ReadyNAS OS 6's web GUI. What needs to be edited to make that folder become a normal share? Specifically which terminal commands needs to be executed and which files needs to be edited?

 

Among other things, a share is a BTRFS subvolume, and not an ordinary folder.  

 

The best thing is to rename new-folder to a temporary name, and then create the share properly using the web ui.  Then copy the contents into the share, and delete the original folder.  You can do the copy from ssh using --ref-link - that will transfer more quickly, and won't double the disk space.

 

 

Message 2 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

Ah, BTRFS subvolume!

I know how to create a share via the web GUI. The question is how to dot it via terminal.

How is this accomplished?

Please reply with full command example for `--ref-link`.

 

 

Message 3 of 20
StephenB
Guru

Re: Making a folder appear as a volume in OS 6 GUI?


@eton wrote:

 

I know how to create a share via the web GUI. The question is how to do it via terminal.

How is this accomplished?

 


Not sure how to set up everything the ReadyNAS application needs, so my basic advice is don't.

 


@eton wrote:

 

Please reply with full command example for `--ref-link`.

 


It's an option for cp.

Message 4 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

I manually created a btrfs subvolume:

btrfs subvolume create /data/cli-test
chown guest:guest /data/cli-test

 

And added it to these config files:

/etc/frontview/samba/Shares.conf

/etc/snapper/configs/10

/etc/minidlna.conf

 

And restarted needed services. The subvolume/share is accessible over the network but still doesn't show up in web admin.

 
Message 5 of 20
StephenB
Guru

Re: Making a folder appear as a volume in OS 6 GUI?


@eton wrote:

 

And restarted needed services. The subvolume/share is accessible over the network but still doesn't show up in web admin.

 

There's also an SQL database, and I am guessing that it needs to be added there.

Message 6 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

Indeed!

 

# find / -not -path "/data/*" -not -path "/media/*" -not -path "/run/*" -type f -iname "*.sql"
/usr/share/mysql/mysql_system_tables_data.sql
/usr/share/mysql/mysql_system_tables.sql
/usr/share/mysql/fill_help_tables.sql
/usr/share/mysql/mysql_test_data_timezone.sql

Message 7 of 20
Sandshark
Sensei

Re: Making a folder appear as a volume in OS 6 GUI?

There are also a lot of hidden files that have to be there.  Netgear did not create a command line utility for creating a share, likely because you also need to set up sharing options.  Is there a reason you need to do it from SSH?  There is a script (I know @StephenB has a link for it) that will scan the BTRFS sub-volumes and update the hidden files and databases.  But you'd still have to set permissions to get access unless you are logging in as admin.

Message 8 of 20
tigerten
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

look at here: 

 

you can create volume under SSH for ReadyDATA. I would assume possible with ReadyNAS as well. 

 

https://community.netgear.com/t5/ReadyDATA/Install-OS6/m-p/1531523/highlight/true#M483

Message 9 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

@Sandshark 

No critical reason, but all admin tasks in GUI should have an equivalent CLI version. 

 

I just find it a bit irritating that we are kept in the dark. There is a solution and technical documentation most likely exists, but Netgear chooses to hide it from their customers.

 

Message 10 of 20
StephenB
Guru

Re: Making a folder appear as a volume in OS 6 GUI?


@tigerten wrote:

 

you can create volume under SSH for ReadyDATA. I would assume possible with ReadyNAS as well. 

 


Yes. 

 

Netgear has a utility called rnutil. It has quite a few "personalities"

 

  event_push          push a system event to the UI
  get_disk_info       print a list of all attached disks and disk information
  check_ups_drv       check and possibly start network ups drivers
  rn_shutdown         shutdown readynasd and system gracefully
  rn_lcd              LCD display
  remote_access       start a remote access session for tech support
  volume_util         perform volume operations
  mkhomedir_helper    home subvolume creator for PAM
  disk_event_handler  handler for disk events
  hotplug_event       notifier for hotplug events
  md_event            notifier for MD RAID events
  start_raids         start all MD RAID arrays
  volume_schedule     start volume schedule job
  spindown_schedule   start spindown schedule job
  backup_md           backup MD RAID superblocks
  bit_rot_event       bit rot events
  firmware_update     check for firmware update
  apt_wait            Wait for an APT lock to release
  create_system_log   Create system log archive
  diagnostics         Run system diagnostics
  blink               Locate the NAS with LEDs
  bluetooth_event     Bluetooth events
  dump_sysflags       List systype flags or check if flag is set for system
  clamav_event        ClamAV events
  antivirus_scan_rootfscan antivirus in rootfs

 

 

The personality is determined by the executable file name.  For instance, /usr/bin/volume_util is a link to rnutil, and when you execute the link you can run the volume_util command set.  (you can alternatively run rnutil volume_util directly).

 

The volume_util commands are:

 

root@NAS:~# volume_util help
Usage: volume_util [-c NAME] [-c NAME D1,..,DN] [-c NAME LEVEL D1,..,DN]
                   [-c NAME LEVEL D1,..,DN KEY_FILE] [-d NAME|UUID]
                   [-x NAME|UUID] [-e] [-e TYPE] [-v NAME LEVEL D1,...,DN]
                   [-f NAME DISK] [-S DISK] [-F DISK] [-s TYPE..]
    -c  Create pool
        NAME is the desired pool name
        LEVEL is the desired RAID level (0,1,5,6,10)
        D1,..,DN is the list of disk channels to use, zero-based
          you may specify the disk by controller and channel, so
          '0,1' means chassis 0, channels 0 and 1
          '1:3,1:4' means chassis 1, channels 3 and 4
        if you do not specify any channels, all available channels will be used
        KEY_FILE is the encryption key passphrase file for encrypted volumes
    -d  Delete pool
        NAME is the desired pool name
        UUID is the UUID of the desired pool
    -x  Export pool
        NAME is the desired pool name
        UUID is the UUID of the desired pool
    -e  Expand pool
        TYPE is one of 'auto', 'expand', 'extend', or 'xraid'
        auto - automatically do all forms of expansion
        expand - expand to fill all space on all current disks (disk replacement)
        extend - extend pool to use available new disks (disk addition)
        xraid - grow pool to use available space on some current disks
          (partial disk replacement)
    -f  Flex-RAID add parity
        NAME is the desired pool name
        D1,..,DN is the list of disk channels to use, zero-based
          you may specify the disk by controller and channel, so
          '0,1' means chassis 0, channels 0 and 1
          '1:3,1:4' means chassis 1, channels 3 and 4
    -E  Flex-RAID expand
        NAME is the desired pool name
        D1,..,DN is the list of disk channels to use, zero-based
          you may specify the disk by controller and channel, so
          '0,1' means chassis 0, channels 0 and 1
          '1:3,1:4' means chassis 1, channels 3 and 4
    -v  Vdev expand pool
        NAME is the desired pool name
        LEVEL is the desired RAID level (0,1,5,6,10)
        D1,..,DN is the list of disk channels to use, zero-based
          you may specify the disk by controller and channel, so
          '0,1' means chassis 0, channels 0 and 1
          '1:3,1:4' means chassis 1, channels 3 and 4
    -S  Make a disk a hot spare
        DISK is the disk channel to use, zero-based
    -F  Format disk
        DISK is the disk channel to use, zero-based
    -r  Automatically repair degraded pools
    -O  Forcibly optimize swap array
    -s  Show volume information
        TYPE is any combination of 'disk', 'raid', 'pool', or 'enclosure'
          separated by a space so '-s disk raid' would show disks and raids

 

 

What rnutil doesn't seem to have is a mechanism to create a public share.You can create a home folder for a user account  with rnutil mkhomedir_helper - which is a specialized share, but not public.  

 

root@NAS:~# mkhomedir_helper

Usage: mkhomedir_helper <username>

root@NAS:~#

 

There possibly could be some other tool that can create a public share, but I don't know what it is.

 

As @Sandshark says, there is a repair script that Netgear support uses that might give you more clues.

If you download it to the NAS with wget, you will need to add the --no-check-certificate  option.

 

Message 11 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

Thanks @StephenB!

 

Interesting command: rnutil, but I have never before encountered arguments being named personalities. Although the arguments in this case are sub programs.

 

I browsed through script, but could not find how a new share was made available in the web admin:

https://gitlab.codycook.us/readynas-scripts/share_lun_ui_fix.sh/-/blob/master/share_lun_ui_fix.sh

 

And there we had a real engineer at Netgear: Cody Cook https://codycook.us/#resume

 

Message 12 of 20
StephenB
Guru

Re: Making a folder appear as a volume in OS 6 GUI?


@eton wrote:

 

I browsed through script, but could not find how a new share was made available in the web admin:

 


It appears to be rebuilding config files in /volume/._shares/sharename

 

Looking at one of my shares, these are the files needed

root@NAS:/data/._share/Backup# ls -als
total 44
0 drwxr-xr-x 1 root  root  324 Apr 20 11:00 .
0 drwxr-xr-x 1 root  root  482 Feb 28 16:41 ..
4 -rw-r--r-- 1 admin admin 179 Feb 28 16:41 afp.conf
4 -rw-r--r-- 1 admin admin 116 Apr 20 11:00 custom_snapshot_management.conf
4 -rw-r--r-- 1 admin admin 175 Apr 20 11:00 custom_snapshot_schedule.conf
4 -rw-r--r-- 1 root  root    6 Feb 28 16:41 datasettype.conf
4 -rw-r--r-- 1 admin admin  65 Sep 23  2018 fs.conf
4 -rw-r--r-- 1 admin admin 113 Feb 28 16:41 ftp.conf
4 -rw-r--r-- 1 admin admin 110 Feb 28 16:41 nfs.conf
0 drwxr-xr-x 1 admin admin   2 Feb 22  2021 .pvcache
4 -rw-r--r-- 1 root  root    8 Feb 28 16:41 recycle.conf
4 -rw-r--r-- 1 admin admin 138 Feb 28 16:41 samba.conf
4 -rw-r--r-- 1 root  root    1 Feb 28 16:41 snapdir.conf
4 -rw-r--r-- 1 root  root   14 Apr 20 11:00 snapshot.conf
root@NAS:/data/._share/Backup#

 

Not sure if that is all that is needed, but it is a start. 

Message 13 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

Yes, I know that each share has got settings in a hidden directory. In my case: /data/._share/{ShareName}

I copied settings from a share I made via web admin to my test share (created via CLI). But it still does not show up in web admin. Not even after reboot.

Message 14 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

I think I have found where web admin stores shares info:

 

 

 

 

sqlite3 --header --column /var/readynasd/db.sq3 'select * from "share"'

sqlite3  --header --column /var/readynasd/db.sq3  'select id,zfs_name,type,name,path from "share" Order by name'

sqlite3  --header --column --separator "|" --list /var/readynasd/db.sq3  'select id,zfs_name,type,name,path from "share" Order by name' | column -t -s "|"

 

 

 

And there are more database files in /var/readynasd/

 

 

# ls -lA /var/readynasd/
total 12384
-rw-r----- 1 root admin 8212480 Apr 20 21:16 db.sq3
-rw-r--r-- 1 root root    16384 Apr 20 21:26 event.sq3
-rw-r--r-- 1 root admin     131 Sep 27  2022 .flash_update_info
-rw-r--r-- 1 root root  4406801 Apr 20 21:31 loadavg.dat
-rw-r--r-- 1 root root       42 May  9  2020 .localsid
-rw-r--r-- 1 root root     1589 Apr 18 22:11 pilgrim.list
-rw-r--r-- 1 root root     8192 May  9  2020 smart.sq3
drwxr-xr-x 1 root root      168 May  9  2020 stats
-rw-r--r-- 1 root root        7 Sep 27  2022 .update_from
-rw-r--r-- 1 root root    15001 Apr 20 21:16 usage.dat

 

 

 

The sq3 files are related to readynasd.Restart with systemctl restart readynasd

Message 15 of 20
Sandshark
Sensei

Re: Making a folder appear as a volume in OS 6 GUI?

If you aren't willing/able to create the share via the GUI, I don't know why you care that the share be visible in it.  Studying that script told me a lot about the "under the hood" workings of a ReadyNAS share.  But since the share is intended to find "lost" shares and make them visible to the GUI, I believe it should do the same with your share created via the back door,

Message 16 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

@Sandshark I am doing this out of curiosity. I am fine with creating new share via gui, but would like to know how to do it via cli. And it gets extra enticing when there is no publicly known method.

 

Yes I understand that that script solves a problem that is very close to this case. I found some interesting stuff there, but did not understand all of it.

Message 17 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

I managed to make the  BTRFS subvolume that was created via CLI visible in the web admin 😄

 

I added it like this

sqlite3 /var/readynasd/db.sq3

INSERT INTO share (id, zfs_name, type, volume_id, name, path, user_access, group_access, everyone_access, non_owner_delete, user_id, group_id, update_ts) VALUES (13, 'data/TestTest', 'share', 'data', 'TestTest', '/data/TestTest', 7, 7, 7, 0, 99, 99, CURRENT_TIMESTAMP);

.exit

 

Message 18 of 20
tigerten
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

Amazing expedition!

 

You might be able to figure out why the USB drive is not showing up as external under media with virtual ReadyNAS. 

 

I can mount to a subvolume under DATA, but not under the default media/USB_HDD. Wee, I would say I can mount it to under media manually, but it does show up in the UI. 

 

 

Message 19 of 20
eton
Luminary

Re: Making a folder appear as a volume in OS 6 GUI?

I know a little bit more now. But it's still not a complete method for creating a share via CLI. I wish Netgear was more transparent and released technical documentation.

 

@tigerten 

Create a separate thread for the issue with your USB drive. It is probably solvable.

 
Message 20 of 20
Top Contributors
Discussion stats
  • 19 replies
  • 3288 views
  • 3 kudos
  • 4 in conversation
Announcements