Skip to content

Commit

Permalink
DLPX-86523 CIS: /home filesystem and mount options
Browse files Browse the repository at this point in the history
  • Loading branch information
justsanjeev committed Apr 18, 2024
1 parent 0cca5c2 commit 60315a7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
14 changes: 7 additions & 7 deletions live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,9 @@ fi

zfs create \
-o canmount=noauto \
-o mountpoint=/ \
"$FSNAME/ROOT/$FSNAME/root"
-o mountpoint=/ "$FSNAME/ROOT/$FSNAME/root"

zfs mount "$FSNAME/ROOT/$FSNAME/root"
zfs mount -o nodev "$FSNAME/ROOT/$FSNAME/root"

#
# We are later going to recursively bind mount /proc/, /sys/, and /dev/
Expand Down Expand Up @@ -261,8 +260,8 @@ zfs create \
# contents. During normal boot up, we'll rely on "/etc/fstab" to handle
# these mounts.
#
mkdir -p "$DIRECTORY/export/home"
mount -t zfs "$FSNAME/ROOT/$FSNAME/home" "$DIRECTORY/export/home"
mkdir -p "$DIRECTORY/home"
mount -t zfs "$FSNAME/ROOT/$FSNAME/home" "$DIRECTORY/home"

mkdir -p "$DIRECTORY/var/delphix"
mount -t zfs "$FSNAME/ROOT/$FSNAME/data" "$DIRECTORY/var/delphix"
Expand Down Expand Up @@ -292,7 +291,7 @@ rsync --info=stats3 -Wa binary/* "$DIRECTORY/"
# automatically whenever we boot into the crash kernel.
#
cat <<-EOF >"$DIRECTORY/etc/fstab"
rpool/ROOT/$FSNAME/home /export/home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$FSNAME/home /home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$FSNAME/data /var/delphix zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$FSNAME/log /var/log zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0
Expand Down Expand Up @@ -335,8 +334,9 @@ done

umount "$DIRECTORY/var/log"
umount "$DIRECTORY/var/delphix"
umount "$DIRECTORY/export/home"
umount "$DIRECTORY/home"
umount "/var/crash"
retry 5 10 zfs umount "$FSNAME/ROOT/$FSNAME/root"
retry 5 10 zpool export "$FSNAME"
kpartx -d "$ARTIFACT_NAME.img"
ln -s /export/home /home
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
- git:
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/dms-core-gate.git"
dest:
"/export/home/delphix/dms-core-gate"
"/home/delphix/dms-core-gate"
version: "develop"
accept_hostkey: yes
update: no
when: lookup('env', 'GITHUB_TOKEN') != ''

- file:
path: "/export/home/delphix/{{ item }}"
path: "/home/delphix/{{ item }}"
owner: delphix
group: staff
mode: "g+w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
no_log: true

- file:
path: /export/home
path: /home
state: directory
mode: 0755

Expand All @@ -39,7 +39,7 @@
shell: /bin/bash
create_home: yes
comment: Delphix User
home: /export/home/delphix
home: /home/delphix
password:
"{{ lookup('env', 'APPLIANCE_PASSWORD') | password_hash('sha512') }}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
- user:
name: testrunner
comment: "Delphix"
home: /export/home/testrunner
home: /home/testrunner
groups: docker
password:
"$6$pWQE0MPZWgue7fNC$8RvR0u04Mt67792b.x4ao0G2Z/H/hrYPWezOqCkz59MIA\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
- git:
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/dlpx-app-gate.git"
dest: "/export/home/delphix/dlpx-app-gate"
dest: "/home/delphix/dlpx-app-gate"
version: "develop"
accept_hostkey: yes
update: no
when: lookup('env', 'GITHUB_TOKEN') != ''

- file:
path: "/export/home/delphix/{{ item }}"
path: "/home/delphix/{{ item }}"
owner: delphix
group: staff
mode: "g+w"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@
- git:
repo: "https://{{ lookup('env', 'GITHUB_TOKEN') }}@github.com/delphix/zfs.git"
dest:
"/export/home/delphix/zfs"
"/home/delphix/zfs"
version: develop
accept_hostkey: yes
update: no
when: lookup('env', 'GITHUB_TOKEN') != ''

- file:
path: "/export/home/delphix/zfs"
path: "/home/delphix/zfs"
owner: delphix
group: staff
state: directory
recurse: yes

- file:
path: "/export/home/delphix/.cargo/"
path: "/home/delphix/.cargo/"
state: directory
owner: delphix
group: staff
- copy:
dest: "/export/home/delphix/.cargo/config.toml"
dest: "/home/delphix/.cargo/config.toml"
content: |
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-B/usr/libexec/mold"]
2 changes: 1 addition & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function resolve_s3_uri() {
# mirror is used.
#
UPSTREAM_BRANCH=$(get_upstream_or_fail_if_unset) || exit 1
echo "Running with UPSTREAM_BRANCH set to ${UPSTREAM_BRANCH}"
# echo "Running with UPSTREAM_BRANCH set to ${UPSTREAM_BRANCH}"
local latest_subprefix="linux-pkg/${UPSTREAM_BRANCH}/combine-packages/post-push/latest"
local bucket="snapshot-de-images"
local jenkinsid="jenkins-ops"
Expand Down
2 changes: 1 addition & 1 deletion upgrade/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ resemble the following:

A "rootfs container" is a collection of ZFS datasets that can be used as
the "root filesytsem" of the appliance. This includes a dataset for "/"
of the appliance, but also seperate datasets for "/export/home" and
of the appliance, but also seperate datasets for "/home" and
"/var/delphix".

Here's an example of the datasets for a rootfs container:
Expand Down
6 changes: 3 additions & 3 deletions upgrade/upgrade-scripts/upgrade-container
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function create_upgrade_container() {
-o mountpoint=legacy \
"$ROOTFS_DATASET/home@$SNAPSHOT_NAME" \
"rpool/ROOT/$CONTAINER/home" ||
die "failed to create upgrade /export/home clone"
die "failed to create upgrade /home clone"

zfs clone \
-o mountpoint=legacy \
Expand All @@ -227,7 +227,7 @@ function create_upgrade_container() {
# dataset.
#
mount_upgrade_container_dataset \
"rpool/ROOT/$CONTAINER/home" "$DIRECTORY/export/home"
"rpool/ROOT/$CONTAINER/home" "$DIRECTORY/home"
mount_upgrade_container_dataset \
"rpool/ROOT/$CONTAINER/data" "$DIRECTORY/var/delphix"
mount_upgrade_container_dataset \
Expand Down Expand Up @@ -296,7 +296,7 @@ function create_upgrade_container() {
# before the zfs-import service is run.
#
cat <<-EOF >"$DIRECTORY/etc/fstab"
rpool/ROOT/$CONTAINER/home /export/home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$CONTAINER/home /home zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$CONTAINER/data /var/delphix zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/ROOT/$CONTAINER/log /var/log zfs defaults,x-systemd.before=zfs-import-cache.service 0 0
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0
Expand Down

0 comments on commit 60315a7

Please sign in to comment.