Version 5 vs 6
Version 5 vs 6
Content Changes
Content Changes
===Snapshots===
To **Create** snapshots:
lvcreate (Volumn) -s -n (name of the snapshot) (location to store the snapshot)
e.g. lvcreate -L300G -s -n ecc-b-01v.snap /dev/vm/ecc-b-01v
To **Remove** snapshots:
lvremove (name of snapshot @ stored location)
e.g. lvremove /dev/vm/ecc-b-01v.snap
To **Restore** snapshots:
lvconvert --merge (Logical Volume Path)
e.g. lvconvert --merge /dev/vg0/win10.snap
===Required Packages===
```
sudo apt install nano \
util-linux linux-tools-common cpufrequtils lm-sensors libusb-dev \
git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev git-email \
libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev valgrind \
xfslibs-dev -y git-email libnfs-dev libiscsi-dev libsdl2-dev libncurses5-dev \
libaio-dev libjemalloc-dev libjemalloc* libusb-1.0-0-dev
```
===Snapshots===
To **Create** snapshots:
lvcreate (Volumn) -s -n (name of the snapshot) (location to store the snapshot)
e.g. lvcreate -L300G -s -n ecc-b-01v.snap /dev/vm/ecc-b-01v
To **Remove** snapshots:
lvremove (name of snapshot @ stored location)
e.g. lvremove /dev/vm/ecc-b-01v.snap
To **Restore** snapshots:
lvconvert --merge (Logical Volume Path)
e.g. lvconvert --merge /dev/vg0/win10.snap
===Required Packages===
```
sudo apt install nano \
util-linux linux-tools-common cpufrequtils lm-sensors libusb-dev \
git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev git-email \
libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev valgrind \
xfslibs-dev -y git-email libnfs-dev libiscsi-dev libsdl2-dev libncurses5-dev \
libaio-dev libjemalloc-dev libjemalloc* libusb-1.0-0-dev
```
===LVM Setup ===
```
lang=bash
#!/bin/bash
DISK=/dev/sdd #Setting up the disk drive
#Partitions the disk
parted ${DISK} -s mklabel gpt #Scripts to make a new disk label of type gpt
parted ${DISK} -s mkpart "" fat32 0% 512MB #Scripts to make a partition of filesystem fat32 that starts at the beginning of the existing disk and ends at 512MB
parted ${DISK} -s mkpart "" ext4 512MB 100% #Scripts to make a partition of filesystem ext4 that starts at 512MB and stops at the end of the existing disk
parted ${DISK} -s set 1 boot on #Scripts the first partition flag to "boot" and the state to "on"
parted ${DISK} -s set 2 lvm on #Scripts the second partition flag to "lvm" (logical volume management) and the state to "on"
sync #Writes data in the buffer to the disk
mkfs.vfat ${DISK}1 #Creates a FAT file system??
pvcreate ${DISK}2 #Creates physical volume
vgcreate vg1 ${DISK}2 #Creates 1 copy of a new volume group
lvcreate -L 60GB -n root vg1 #Creates a new logical volume in the volume group created in the last command. Allocates 60GB named "root".
lvcreate -L 16GB -n var vg1 #Creates a new logical volume. Allocates 16GB named "var".
dd if=/dev/mapper/vg0-root of=/dev/mapper/vg1-root bs=1M status=progress
#Copies data from /dev/mapper/vg0-root to /dev/mapper/vg1-root at 1M
#Gives a warning if the previous copy command failed and exits the program
if [[ $? != 0 ]]; then
echo "root dd failed"
exit 1
fi
dd if=/dev/mapper/vg0-var of=/dev/mapper/vg1-var bs=1M status=progress
#Copies data from /dev/mapper/vg0-var to /dev/mapper/vg1-var at 1M
#Gives a warning if the previous copy command failed and exits the program
if [[ $? != 0 ]]; then
echo "var dd failed"
exit 1
fi
mount /dev/mapper/vg1-root /mnt && \ #Mounts the filesystem /dev/mapper/vg1-root to the directory /mnt
mount /dev/mapper/vg1-var /mnt/var && \ #Mounts the filesystem /dev/mapper/vg1-var to the directory /mnt/var
mount ${DISK}1 /mnt/boot/efi && \ #Mounts the created file system to the EFI partition
mount --bind /dev /mnt/dev && \ #Connects the file systems /dev and /mnt/dev to make them both accessible from either location
mount --bind /run /mnt/run && \ #Connects the file systems /run and /mnt/run to make them both accessible from either location
mount --bind /sys /mnt/sys && \ #Connects the file systems /sys and /mnt/sys to make them both accessible from either location
mount --bind /proc /mnt/proc #Connects the file systems /proc and /mnt/proc to make them both accessible from either location
#Gives a warning if the mount failed and exits the program
if [[ $? != 0 ]]; then
echo "failed to mount"
exit 1
fi
# Modify /etc/hostnmae
# Modify /etc/hosts
# Modify /etc/fstab
# Install grub
# Update grub
```
===Snapshots===
To **Create** snapshots:
lvcreate (Volumn) -s -n (name of the snapshot) (location to store the snapshot)
e.g. lvcreate -L300G -s -n ecc-b-01v.snap /dev/vm/ecc-b-01v
To **Remove** snapshots:
lvremove (name of snapshot @ stored location)
e.g. lvremove /dev/vm/ecc-b-01v.snap
To **Restore** snapshots:
lvconvert --merge (Logical Volume Path)
e.g. lvconvert --merge /dev/vg0/win10.snap
===Required Packages===
```
sudo apt install nano \
util-linux linux-tools-common cpufrequtils lm-sensors libusb-dev \
git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev git-email \
libcap-dev libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev valgrind \
xfslibs-dev -y git-email libnfs-dev libiscsi-dev libsdl2-dev libncurses5-dev \
libaio-dev libjemalloc-dev libjemalloc* libusb-1.0-0-dev
```
===LVM Setup ===
```
lang=bash
#!/bin/bash
DISK=/dev/sdd #Setting up the disk drive
#Partitions the disk
parted ${DISK} -s mklabel gpt #Scripts to make a new disk label of type gpt
parted ${DISK} -s mkpart "" fat32 0% 512MB #Scripts to make a partition of filesystem fat32 that starts at the beginning of the existing disk and ends at 512MB
parted ${DISK} -s mkpart "" ext4 512MB 100% #Scripts to make a partition of filesystem ext4 that starts at 512MB and stops at the end of the existing disk
parted ${DISK} -s set 1 boot on #Scripts the first partition flag to "boot" and the state to "on"
parted ${DISK} -s set 2 lvm on #Scripts the second partition flag to "lvm" (logical volume management) and the state to "on"
sync #Writes data in the buffer to the disk
mkfs.vfat ${DISK}1 #Creates a FAT file system??
pvcreate ${DISK}2 #Creates physical volume
vgcreate vg1 ${DISK}2 #Creates 1 copy of a new volume group
lvcreate -L 60GB -n root vg1 #Creates a new logical volume in the volume group created in the last command. Allocates 60GB named "root".
lvcreate -L 16GB -n var vg1 #Creates a new logical volume. Allocates 16GB named "var".
dd if=/dev/mapper/vg0-root of=/dev/mapper/vg1-root bs=1M status=progress
#Copies data from /dev/mapper/vg0-root to /dev/mapper/vg1-root at 1M
#Gives a warning if the previous copy command failed and exits the program
if [[ $? != 0 ]]; then
echo "root dd failed"
exit 1
fi
dd if=/dev/mapper/vg0-var of=/dev/mapper/vg1-var bs=1M status=progress
#Copies data from /dev/mapper/vg0-var to /dev/mapper/vg1-var at 1M
#Gives a warning if the previous copy command failed and exits the program
if [[ $? != 0 ]]; then
echo "var dd failed"
exit 1
fi
mount /dev/mapper/vg1-root /mnt && \ #Mounts the filesystem /dev/mapper/vg1-root to the directory /mnt
mount /dev/mapper/vg1-var /mnt/var && \ #Mounts the filesystem /dev/mapper/vg1-var to the directory /mnt/var
mount ${DISK}1 /mnt/boot/efi && \ #Mounts the created file system to the EFI partition
mount --bind /dev /mnt/dev && \ #Connects the file systems /dev and /mnt/dev to make them both accessible from either location
mount --bind /run /mnt/run && \ #Connects the file systems /run and /mnt/run to make them both accessible from either location
mount --bind /sys /mnt/sys && \ #Connects the file systems /sys and /mnt/sys to make them both accessible from either location
mount --bind /proc /mnt/proc #Connects the file systems /proc and /mnt/proc to make them both accessible from either location
#Gives a warning if the mount failed and exits the program
if [[ $? != 0 ]]; then
echo "failed to mount"
exit 1
fi
# Modify /etc/hostnmae
# Modify /etc/hosts
# Modify /etc/fstab
# Install grub
# Update grub
```