Note that these are the work-in-progress steps I’ve taken based on information I see on a local VM running Rockstor. FWIW, the Rockstor AMI is no longer there, and there are restrictions as to what Amazon thinks the OS actually is so you can’t just import the vmdk. It expects a specific version of CentOS with a specific kernel, though as you can see below you can update the vanilla CentOS image up there to use Rockstor repos, btrfs, and a 4.x kernel.
Launch a new instance of CentOS 7 in size t2.micro (You can change it to e.g. m4.large
later, but why pay that price now while you’re building the instance?)
Change the root mount point in /etc/fstab to /dev/xvda1
modify /etc/grub2.cfg to use /dev/xvda1 instead of the UUID for the root filesystem
add the centos user to /etc/ssh/sshd_config so we can log in after rockstor is installed
echo -e “\nAllowUsers centos” >> /etc/ssh/sshd_config
Then add the Rockstor repo and perform the installation
cat < /etc/yum.repos.d/Rockstor-Base.repo
#RockStor repos
[rockstor]
name=Rockstor 3 - x86_64
baseurl=http://rockstor.com/rockrepo/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rockstor
metadata_expire=1m
EOF
cat < /etc/pki/rpm-gpg/RPM-GPG-KEY-Rockstor
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQENBFYewywBCADRC3prGgOcYyNKGvMvAAGMEECSqhWahZvkxJ+QmJWSnbrOiwM5
htKVTUnRH41OmIuwQppDDzNUygH9Ls8MlOZNfQ/pdz07zF0Li+U9DqYqEZWDbDWB
P2lOoI8xVSnAk+fa+jO19YDyUy5H+2lQmEX8WelKvXml8d+0t+QjjyBwigj8lft9
oLHd2WNqfS2sHx7ddkeGvLv9N03p8g6rcVjCZqtrJh7BDE7w6EoAFUbuab+GEeKE
Tru39wWc2WYspgzCqcDs4Ru4p63ecmowZILTb2nY0xwnP4+a/6lY2OrweNLsH486
/CbxzriQ9qDeQrm+E+MZS41q1yt9t61dqRX1ABEBAAG0Q1N1bWFuIENoYWtyYXZh
cnR1bGEgKFJvY2tzdG9yIFJQTSBkZXZlbG9wbWVudCkgPHN1bWFuQHJvY2tzdG9y
LmNvbT6J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jkAsc4QotUt9g9WlEdO0dkec3S+Qzk
P4J8HYW3+4I3iIH63gQn1fzgMZzT5hribqd9cas/WkUHRxE1M4YNgF89quYK7ul0
H2/vbmi8kO0X9rrqNnolzE2ikP3Bgr1lOFNL7kBl
=YgLO
-----END PGP PUBLIC KEY BLOCK-----
EOF
yum -y install epel-release
yum clean all
yum -y install NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager
yum -y install rockstor
Stop the instance
Create a snapshot of the disk and name it rockstor-xfs
Create a volume from the snapshot and name it rockstor-xfs
Create a new volume and name it rockstor /
Attach the rockstor-xfs volume to the instance as /dev/sdg
Attach the rockstor / volume to the instance as /dev/sdh
Start the instance
Sudo to root and stop rockstor
systemctl stop rockstor
Create a partition on the new rockstor / volume (/dev/xvdh)
[root@ip-172-31-11-4 ~]# fdisk /dev/xvdh
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4b3d0be3.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-16777215, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215):
Using default value 16777215
Partition 1 of type Linux and of size 8 GiB is set
Command (m for help): a
Selected partition 1
Command (m for help): p
Disk /dev/xvdh: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x4b3d0be3
Device Boot Start End Blocks Id System
/dev/xvdh1 * 2048 16777215 8387584 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ip-172-31-11-4 ~]# mkfs.btrfs /dev/xvdh1
btrfs-progs v4.4.1
See http://btrfs.wiki.kernel.org for more information.
Detected a SSD, turning off metadata duplication. Mkfs with -m dup if you want to force metadata duplication.
Label: (null)
UUID: 43b52eba-d9c6-4aa0-a4af-026d720bd2d9
Node size: 16384
Sector size: 4096
Filesystem size: 8.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: single 8.00MiB
System: single 4.00MiB
SSD detected: yes
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 8.00GiB /dev/xvdh1
[root@ip-172-31-11-4 ~]# btrfs filesystem label / rockstor_rockstor
Change the UUID on the rockstor-xfs filesystem so we can mount it.
[root@ip-172-31-11-4 ~]# xfs_admin -U generate /dev/xvdg1
Clearing log and setting UUID
writing all SBs
new UUID = 174e006c-290c-4b08-9bfc-38ea6e7a2318
Mount the filesystems:
mount /dev/xvdg1 /mnt/root-xfs/
mount /dev/xvdh1 /mnt/root-btrfs/
And rsync everything over:
rsync -aAXv --exclude={"/mnt/root-xfs/lost+found"} /mnt/root-xfs/ /mnt/root-btrfs/
Then chroot into the new volume:
mount --bind /dev /mnt/root-btrfs/dev
mount --bind /sys /mnt/root-btrfs/sys
mount --bind /proc /mnt/root-btrfs/proc
chroot /mnt/root-btrfs/ /bin/bash
Set the UUIDs as variables for easy replacement
XFS_UUID=$(xfs_admin -u /dev/xvda1 | awk ‘{print $3}’)
BTRFS_UUID=$(btrfs filesystem show /dev/xvdf1 | awk ‘/uuid:/ {print $4}’)
Make sure we change the fstype in /etc/fstab:
sed -i -e ‘s/([ \t])xfs([ \t])/\1btrfs\2/g’ -e ‘s/’$XFS_UUID’/’$BTRFS_UUID’/g’ /etc/fstab
Make sure grub is set to boot to the 4.x kernel, in my case, the first entry (0):
[root@ip-172-31-11-4 ~]# awk -F’ ‘$1=="menuentry " {print $2}’ /etc/grub2.cfg
CentOS Linux (4.8.7-1.el7.elrepo.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-8bd05758fdfc1903174c9fcaf82b71ca) 7 (Core)
Since mine is the first entry, set to 0 (1 for second, 2 for third…)
[root@ip-172-31-11-4 ~]# grub2-set-default 0
[root@ip-172-31-11-4 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.8.7-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-4.8.7-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.16.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.16.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca
Found initrd image: /boot/initramfs-0-rescue-8bd05758fdfc1903174c9fcaf82b71ca.img
done
And finally install grub
[root@ip-172-31-11-4/]# grub2-install /dev/xvdf
Installing for i386-pc platform.
Installation finished. No error reported.
[root@ip-172-31-11-4/]# exit
exit
Shut down the instance and detach all volumes, reattaching rockstor / to /dev/sda1
Also create a new EBS volume for your data disk and attach it to the instance.
Start your instance and log into https://<your.instance.ip.address>