-
-
Save priyadarshan/ae3da282c18b310e7e91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@rescue ~]# gpart destroy -F ada0 | |
ada0 destroyed | |
[root@rescue ~]# gpart destroy -F ada1 | |
ada1 destroyed | |
[root@rescue ~]# gpart create -s gpt ada0 | |
ada0 created | |
[root@rescue ~]# gpart create -s gpt ada1 | |
ada1 created | |
[root@rescue ~]# gpart add -s 128 -t freebsd-boot ada0 | |
ada0p1 added | |
[root@rescue ~]# gpart add -s 128 -t freebsd-boot ada1 | |
ada1p1 added | |
[root@rescue ~]# gpart add -s 2G -t freebsd-zfs ada0 | |
ada0p2 added | |
[root@rescue ~]# gpart add -s 2G -t freebsd-zfs ada1 | |
ada1p2 added | |
[root@rescue ~]# gpart add -t freebsd-zfs ada0 | |
ada0p3 added | |
[root@rescue ~]# gpart add -t freebsd-zfs ada1 | |
ada1p3 added | |
[root@rescue ~]# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0 | |
bootcode written to ada0 | |
[root@rescue ~]# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 | |
bootcode written to ada1 | |
[root@rescue ~]# mdconfig -a -t malloc -s 128m -u 2 | |
[root@rescue ~]# newfs -O2 /dev/md2 | |
/dev/md2: 128.0MB (262144 sectors) block size 32768, fragment size 4096 | |
using 4 cylinder groups of 32.03MB, 1025 blks, 4224 inodes. | |
super-block backups (for fsck_ffs -b #) at: | |
192, 65792, 131392, 196992 | |
[root@rescue ~]# mount /dev/md2 /boot/zfs | |
[root@rescue ~]# kldload opensolaris | |
[root@rescue ~]# kldload zfs | |
[root@rescue ~]# zpool create bootdir mirror /dev/ada0p2 /dev/ada1p2 | |
[root@rescue ~]# zpool set bootfs=bootdir bootdir | |
[root@rescue ~]# mkdir /boot/zfs/bootdir | |
[root@rescue ~]# zfs set mountpoint=/boot/zfs/bootdir bootdir | |
[root@rescue ~]# zpool create zroot mirror /dev/ada0p3 /dev/ada1p3 | |
[root@rescue ~]# zfs set mountpoint=/boot/zfs/zroot zroot | |
[root@rescue ~]# zfs unmount bootdir | |
[root@rescue ~]# mkdir /boot/zfs/zroot/bootdir | |
[root@rescue ~]# zfs set mountpoint=/boot/zfs/zroot/bootdir bootdir | |
[root@rescue ~]# zfs mount bootdir | |
[root@rescue ~]# zfs set checksum=fletcher4 zroot | |
[root@rescue ~]# zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp | |
[root@rescue ~]# chmod 1777 /boot/zfs/zroot/tmp | |
[root@rescue ~]# zfs create zroot/usr | |
[root@rescue ~]# zfs create zroot/home | |
[root@rescue ~]# zfs create -o compression=lzjb -o setuid=off zroot/usr/ports | |
[root@rescue ~]# zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles | |
[root@rescue ~]# zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages | |
[root@rescue ~]# zfs create zroot/var | |
[root@rescue ~]# zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/crash | |
[root@rescue ~]# zfs create -o exec=off -o setuid=off zroot/var/db | |
[root@rescue ~]# zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/db/pkg | |
[root@rescue ~]# zfs create -o exec=off -o setuid=off zroot/var/empty | |
[root@rescue ~]# zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/log | |
[root@rescue ~]# zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail | |
[root@rescue ~]# zfs create -o exec=off -o setuid=off zroot/var/run | |
[root@rescue ~]# zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/tmp | |
[root@rescue ~]# zfs create -V 4G zroot/swap | |
[root@rescue ~]# zfs set org.freebsd:swap=on zroot/swap | |
[root@rescue ~]# zfs set checksum=off zroot/swap | |
[root@rescue ~]# chmod 1777 /boot/zfs/zroot/var/tmp | |
[root@rescue ~]# cd /boot/zfs/zroot/ | |
[root@rescue /boot/zfs/zroot]# wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.2/FreeBSD-9.2-RELEASE-amd64-disc1.iso | |
--2013-11-02 10:49:10-- ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.2/FreeBSD-9.2-RELEASE-amd64-disc1.iso | |
=> `FreeBSD-9.2-RELEASE-amd64-disc1.iso' | |
Resolving ftp.freebsd.org (ftp.freebsd.org)... 193.162.146.4, 204.152.184.73, 2001:6c8:130:800::4, ... | |
Connecting to ftp.freebsd.org (ftp.freebsd.org)|193.162.146.4|:21... connected. | |
Logging in as anonymous ... Logged in! | |
==> SYST ... done. ==> PWD ... done. | |
==> TYPE I ... done. ==> CWD (1) /pub/FreeBSD/releases/ISO-IMAGES/9.2 ... done. | |
==> SIZE FreeBSD-9.2-RELEASE-amd64-disc1.iso ... 686858240 | |
==> PASV ... done. ==> RETR FreeBSD-9.2-RELEASE-amd64-disc1.iso ... done. | |
Length: 686858240 (655M) (unauthoritative) | |
100%[================================================================================================>] 686,858,240 9.40M/s in 2m 2s | |
2013-11-02 10:51:12 (5.37 MB/s) - `FreeBSD-9.2-RELEASE-amd64-disc1.iso' saved [686858240] | |
[root@rescue /boot/zfs/zroot]# mount -t cd9660 /dev/`mdconfig -f FreeBSD-9.2-RELEASE-amd64-disc1.iso` /mnt | |
[root@rescue /boot/zfs/zroot]# unxz -c /mnt/usr/freebsd-dist/base.txz | tar xpf - | |
[root@rescue /boot/zfs/zroot]# unxz -c /mnt/usr/freebsd-dist/kernel.txz | tar xpf - | |
[root@rescue /boot/zfs/zroot]# unxz -c /mnt/usr/freebsd-dist/src.txz | tar xpf - | |
[root@rescue /boot/zfs/zroot]# unxz -c /mnt/usr/freebsd-dist/lib32.txz | tar xpf - | |
[root@rescue /boot/zfs/zroot]# unxz -c /mnt/usr/freebsd-dist/ports.txz | tar xpf - | |
[root@rescue /boot/zfs/zroot]# umount /mnt | |
[root@rescue /boot/zfs/zroot]# rm FreeBSD-9.2-RELEASE-amd64-disc1.iso | |
[root@rescue /boot/zfs/zroot]# zfs set readonly=on zroot/var/empty | |
[root@rescue /boot/zfs/zroot]# chroot /boot/zfs/zroot /bin/csh | |
root@rescue:/ # mv boot bootdir/ | |
root@rescue:/ # ln -fs bootdir/boot | |
root@rescue:/ # echo 'ifconfig_re0="DHCP"' > /etc/rc.conf | |
root@rescue:/ # echo 'zfs_enable="YES"' >> /etc/rc.conf | |
root@rescue:/ # echo 'sshd_enable="YES"' >> /etc/rc.conf | |
root@rescue:/ # touch /etc/fstab | |
root@rescue:/ # echo 'vfs.zfs.prefetch_disable="1"' > /boot/loader.conf | |
root@rescue:/ # echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf | |
root@rescue:/ # echo 'zfs_load="YES"' >> /boot/loader.conf | |
root@rescue:/ # passwd root | |
Changing local password for root | |
New Password: | |
Retype New Password: | |
root@rescue:/ # tzsetup | |
root@rescue:/ # cd /etc/mail | |
root@rescue:/etc/mail # make aliases | |
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases | |
WARNING: local host name (rescue) is not qualified; see cf/README: WHO AM I? | |
/etc/mail/aliases: 28 aliases, longest 10 bytes, 283 bytes total | |
chmod 0640 /etc/mail/aliases.db | |
root@rescue:/etc/mail # adduser | |
root@rescue:/etc/mail # exit | |
[root@rescue /boot/zfs/zroot]# cd /boot/zfs | |
[root@rescue /boot/zfs]# cp /boot/zfs/zpool.cache /boot/zfs/zroot/boot/zfs/zpool.cache | |
[root@rescue /boot/zfs]# zfs unmount -a | |
[root@rescue /boot/zfs]# zfs set mountpoint=legacy zroot | |
[root@rescue /boot/zfs]# zfs set mountpoint=/tmp zroot/tmp | |
[root@rescue /boot/zfs]# zfs set mountpoint=/usr zroot/usr | |
[root@rescue /boot/zfs]# zfs set mountpoint=/home zroot/home | |
[root@rescue /boot/zfs]# zfs set mountpoint=/var zroot/var | |
[root@rescue /boot/zfs]# zfs set mountpoint=/bootdir bootdir | |
[root@rescue /boot/zfs]# reboot | |
Connection to thrall closed by remote host. | |
Connection to thrall closed. | |
kiela@rico ~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment