Skip to content

Instantly share code, notes, and snippets.

View hihellobolke's full-sized avatar
💭
I may be slow to respond.

Some Guy hihellobolke

💭
I may be slow to respond.
View GitHub Profile
# : Lets mount everything inside the new rootvol
# mount /dev/rootvg/varvol /mnt/new/root/var
# mount /dev/sda1 /mnt/new/root/boot
# mount -o bind /dev /mnt/new/root/dev
# mount -t sysfs sys /mnt/new/root/sys
# mount -t procfs none /mnt/new/root/proc
# : Chrooting now..
# chroot /mnt/new/root
# mkdir /mnt/new/boot && mount /dev/sda1 /mnt/new/boot
# rsync -avAX /mnt/new/root/boot/ /mnt/new/boot/
# umount /mnt/new/boot
# rsync -avAX /mnt/new/root/boot/ /mnt/new/boot/
# cat /mnt/new/root/etc/fstab
/dev/sda1 /boot ext4 defaults 1 2
/dev/rootvg/rootvol / ext4 defaults 1 1
/dev/rootvg/varvol /var ext4 defaults 1 2
/dev/datavg/epiclulz /home/epiclulz btrfs defaults 1 2
# : Create new mount directories
# mkdir -p /mnt/new/{root,var,home/epiclulz,home/somebody}
# mkdir -p /mnt/old/root
# : Mount lvms
# mount /dev/rootvg/rootvol /mnt/new/root
# mount /dev/rootvg/varvol /mnt/new/var
# mount /dev/datavg/epiclulz /mnt/new/home/epiclulz
# mkfs -t ext4 /dev/rootvg/rootvol
# mkfs -t ext4 /dev/rootvg/varvol
# mkfs -t btrfs /dev/datavg/epiclulz
# mkfs -t btrfs /dev/datavg/somebody
lvm> lvcreate -T datavg/homepool -L 15G
Logical volume "lvol1" created
Logical volume "homepool" created
lvm> lvcreate -T datavg/homepool -V5G -n epiclulz
Logical volume "epiclulz" created
lvm> lvcreate -T datavg/homepool -V5G -n somebody
Logical volume "somebody” created
# : Creating two VGs
# lvm
lvm> vgcreate rootvg /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
Volume group "rootvg" successfully created
lvm> vgcreate datavg /dev/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2
Volume group "datavg" successfully created
# : Create root volume in thin pool 'rootpool'
# lvm
lvm> pvcreate -y /dev/sdb1 /dev/sdb2 /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sdd2 /dev/sde1 /dev/sde2
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb2" successfully created
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdc2" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sdd2" successfully created
Physical volume "/dev/sde1" successfully created
Physical volume "/dev/sde2" successfully created
# sfdisk -d /dev/sdb | sfdisk /dev/sdc
# sfdisk -d /dev/sdb | sfdisk /dev/sdd
# sfdisk -d /dev/sdb | sfdisk /dev/sde
# fdisk -l | grep ^/dev | grep -v sda
/dev/sdb1 2048 10487807 5242880 83 Linux
/dev/sdb2 10487808 20971519 5241856 83 Linux
/dev/sdc1 2048 10487807 5242880 83 Linux
/dev/sdc2 10487808 20971519 5241856 83 Linux
/dev/sdd1 2048 10487807 5242880 83 Linux
@hihellobolke
hihellobolke / ssh.bash
Created February 2, 2014 14:51
Ssh with dynamic ssh config :-P Modify it to suite your needs
#!/bin/bash
# [email protected]
SSHCONFIG_Linux=$(cat << 'HERE-DOC'
Host *
StrictHostKeyChecking no
ServerAliveInterval 60
ForwardAgent yes
ServerAliveCountMax 4
@hihellobolke
hihellobolke / sudossh.bash
Created January 31, 2014 20:39
sudo2ssh - a sudo that is basically ssh as root to localhost, written as bash function
sudo () {
echo "sudossh wrapper i.e. 'ssh root@localhost'";
curdir=$(pwd);
sudossh="ssh -q -t";
if [[ "${1-bash}" == "bash" ]]; then
$sudossh root@localhost "PATH=$PATH; export PATH; PS1=(ROOT)$PS1; export PS1; cd $curdir && bash";
else
$sudossh root@localhost "PATH=$PATH; export PATH; PS1=(ROOT)$PS1; export PS1; cd $curdir && $@";