Frequently Asked Question

How can I add a secondary storage to an existing system?
Last Updated 5 months ago

A secondary storage can be added to the system as a storage pool. Storage pools can be used either as a sharepoint (for use on the file server or for backup purposes) or as a mail server partition (used for storing mailboxes)

Most new disks come shipped already partitioned and formatted using NTFS. These disks can be used directly for backup purposes. Just plugging it in should be available or use as a new storage pool. If the disk is intended to be used by the file server, reformatting using ext4 is recommended.

On virtual systems, newly added storage is usually completely blank, so a partition table, at least one partition and a filesystem have to be manually created.

Currently, no GUI is available for this, but there are a few internal commands that allow the administrator to manually perform this task.

NOTE: the following directions must be used with extreme caution since mistakes could lead to data loss!

Partitioning and formatting a new disk

First, connect the storage to the system and start it up. On physical devices in case the strorage is external, just plug it in any USB port.

When the system is up and running, establish a connection to the admin command line interface. The interface uses telnet protocol and the default TCP port 23. Any client on the local network should be able to connect to it. It is recommended to use a telnet client like putty  instead of windows telnet command.

Connect using the admin account, or any administrative user account:

image

After authenticating you should see the above prompt, waiting for commands. We will use the following commands:

  • cmd mount.list_uuids
    This command displays all available filesystems that can be used as storage pools
  • cmd system.scsi_devices
    This command displays all available devices and associated partitions on the system
  • cmd mount.cfdisk
    This command is used for partitioning any hard disk drive
  • cmd mount.mkfs
    This command is used for creating a filesystem on a hard disk partition
    IMPORTANT:
    this command will overwrite an existing filesystem without any warning. Be extremely careful using this command. Providing the wrong parameters can cause irreversible damage!


First, let's see the filesystems that are currently available after attaching the extra storage. In our case, the system is virtual and the new disk is completely blank:

> cmd mount.list_uuids
executing command "list_uuids" of mount service...
2019-04-02-14-00-46-07|/dev/sr0|iso9660|X|CDROM|||1243674624

We can see that a CD or DVD is attached to the system, we ignore this. Now let's see the disks attached to the system:

> cmd system.scsi_devices
executing command "scsi_devices" of system service...
disk|/dev/vda|-|QEMU|Virtual Storage Device|virtio_blk|21.0 GB
disk|/dev/vdb|-|QEMU|Virtual Storage Device|virtio_blk|40.0 GB
disk|/dev/sr0|-|QEMU|Virtual CD/DVD Device||296.5 MB
>

As we can see, there are two disks currently attached and a CD or DVD. The disk size should tell us which disk is the newly added. To be absolutely sure, we will use the -r parameter with he above command, in order to hide the system storage (the disk where the system installation was made). Additionally adding -n will also hide the CD/DVD storage devices:

> cmd system.scsi_devices -n -r
executing command "scsi_devices" of system service...
disk|/dev/vdb|-|QEMU|Virtual Storage Device|virtio_blk|40.0 GB
>

So now we know that the newly attach device is /dev/dvb. Now we can use the partiioning command to create a new partition on the device:

> cmd mount.cfdisk /dev/vdb 

Since the disk is completely blank, and no partition is found, we must select the partition table

image

From the list, gpt stands for "GUID partition table" and dos stands for "DOS-style MBR partition tables". It is recommended to use gpt

The available free space will be displayed. Select "New" to create a new partition:

image

The maximum space will be recommended. Just leave it as is or specify a smaller size in case you want to divide the disk space to multiple partitions:

image

Finally select "Write", and press enter

image

Type "yes" to verify that all changes made will be written to the disk:

image

Now we have created a partition, we can see it with the following command:

> cmd system.scsi_devices -r -p
executing command "scsi_devices" of system service...
partition|/dev/vdb|/dev/vdb1|QEMU|Virtual Storage Device|virtio_blk|40.0 GB
>

But as we can see, there is still no filesystem yet:

> cmd mount.list_uuids
executing command "list_uuids" of mount service...
2019-04-02-14-00-46-07|/dev/sr0|iso9660|X|CDROM|||1243674624

We have to create now the filesystem. There are two main filesystem types used: ext4 and NTFS. It is generally recommended to use the ext4 filesystem. It required in order to have the ability to properly use the storage on the file server, using special permissions/extended attributes. Since windows cannot directly access this type o filesystem, if the filesystem is on a removable storage device that must be detached from this system and directly attached to a windows system (for backup purposes), then NTFS may be the recommended filesystem type.

To create an ext4 filesystem we use the following command:

> cmd mount.mkfs -t ext4 /dev/vdb1
executing command "mkfs" of mount service...
mke2fs 1.44.4 (18-Aug-2018)
Creating filesystem with 10485499 4k blocks and 2621440 inodes
Filesystem UUID: 271bc077-9cfb-4802-9d88-75e841f5d0dc
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

>

In case we want the filesystem to be NTFS the following command should be used instead:

> cmd mount.mkfs -t ntfs /dev/vdb1
executing command "mkfs" of mount service...
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
>

Finally, we should now be able to see the available filesystem on the administrative GUI and use it as a new storage pool:

image


Please Wait!

Please wait... it will take a second!