zfs archlinux funtoo参考

http://blog.huatai.me/2013/06/10/install-funtoo-on-zfs.html

http://www.funtoo.org/wiki/ZFS_Install_Guide

https://wiki.archlinux.org/index.php/Installing_Arch_Linux_on_ZFS

https://wiki.freebsdchina.org/doc/z/gptzfsboot

http://wiki.gentoo.org/wiki/ZFS

https://wiki.archlinux.org/index.php/Installing_on_Btrfs_root



sudo zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda8

zfs create -o mountpoint=none rpool/ROOT

zfs create -o mountpoint=/ rpool/ROOT/FUNTOO


zfs create -o mountpoint=none rpool/FUNTOO

zfs create -o mountpoint=/usr/src rpool/FUNTOO/src

zfs create -o mountpoint=/var rpool/FUNTOO/var


zfs create -o sync=always -o primarycache=metadata -o secondarycache=none -o volblocksize=4K -V 4G rpool/swap

mkswap -f /dev/zvol/rpool/swap

swapon /dev/zvol/rpool/swap



mkdir -p /mnt/funtoo/etc/zfs

# cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs

zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles

zpool export -f rpool


/etc/fstab

/dev/sda1               /boot           ext2            defaults        0 2

/dev/zvol/rpool/swap    none            swap            sw              0 0


Create initial ZFS Snapshot

 zfs snapshot -r rpool@install

  zfs list -t snapshot

zfs rollback rpool/ROOT/funtoo@install

http://docs.oracle.com/cd/E19253-01/819-7065/gbcya/index.html 删除快照

# zfs destroy tank/home/ahrens@now

=====================================================

archlinux 相关的


设置arc最大内存值

root # echo "options zfs zfs_arc_max=536870912" >> /etc/modprobe.d/zfs.conf


 # mkswap /dev/zvol/<pool>/swap

 Enable swap:

  # swapon /dev/zvol/<pool>/swap

 /dev/zvol/<pool>/swap none swap defaults 0 0

 zfs umount -a

# zfs set mountpoint=/ zroot

zpool export zroot

zpool import -d /dev/disk/by-id -R /mnt zroot

# zpool set bootfs=zroot zroot


# exit

# umount /mnt/boot

# zfs umount -a

# zpool export zroot

# reboot



zpool import -a -f


zpool status


vim /etc/mkinitcpio.conf

HOOKS="base udev autodetect modconf block keyboard zfs filesystems"



mkinitcpio -p linux

systemctl enable zfs.service

systemctl start zfs.service


zfs list


menuentry "Arch Linux" {

   set root=(hd0,1)

   linux /vmlinuz-linux zfs=zroot

   initrd /initramfs-linux.img

}


NFS Volume

Create a volume as NFS share:

root # zfs create -o sharenfs=on zfs_test/volume2

Check what file systems are shared via NFS:

root # exportfs

Per default the volume is shared to all networks, to specify share options:

root # zfs set sharenfs="-maproot=root -alldir -network 192.168.1.254 -mask 255.255.255.0" zfs_test/volume2
root # exportfs

To stop sharing the volume:

root # zfs set sharenfs=off zfs_test/volume2
root # exportfs


root # zfs get all


root # zfs snapshot zfs_test/volume1@22082011

root # zfs list -t snapshot -o name,creation

root # zfs rollback zfs_test/volume1@21082011

root # zfs clone zfs_test/volume1@21082011 zfs_test/volume1_restore

root # zfs destroy zfs_test/volume1@21082011


root # zpool history

root # zpool iostat 6



freebsd参考

#「zroot」是zpool的名字,可随意起名,注意保持一致。#如果你有两块硬盘,可用 mirror(RAID 1) 模式组建。zpool create -oaltroot=/mnt zroot mirror /dev/gpt/disk0 /dev/gpt/disk1  #如果你只有一块硬盘zpool create -oaltroot=/mnt zroot /dev/gpt/disk0
echo'zfs_enable="YES"'>>/mnt/etc/rc.conf  echo'zfs_load="YES"'>>/mnt/boot/loader.conf  echo'vfs.root.mountfrom="zfs:zroot"'>>/mnt/boot/loader.conf  zfs unmount -a zpool exportzrootzpool import -o cachefile=/tmp/zpool.cache -o  altroot=/mnt zroot    zfs set mountpoint=/zroot  cp/tmp/zpool.cache /mnt/boot/zfs/zfs unmount -azpool set  bootfs=zroot zrootzpool set cachefile=''zroot  zfs set mountpoint=/tmp zroot/tmp  zfs set mountpoint=/usr zroot/usr  zfs set mountpoint=/var zroot/var  zfs set mountpoint=/home zroot/home


只读


Fixit# zfs set readonly=on tank/var/empty


使用校验

Fixit# zfs set checksum=fletcher4                                      tank

Fixit# zfs create -o compression=on    -o exec=on      -o setuid=off   tank/tmp



Fixit# zfs create -o compression=lzjb   -o setuid=off   tank/usr/ports

Fixit# zfs create -o compression=off   -o exec=off     -o setuid=off   tank/usr/ports/distfilesFixit# zfs create -o compression=off   -o exec=off     -o setuid=off   tank/usr/ports/packages

zfs set mountpoint=legacy tank



archlinux下操作gentoo zfs 记录 [本机硬盘 上, 打算在另一台机上使用virtualbox来试]

/dev/sda8本来准备为ubuntu留的40G空间


$ sudo zpool history

History for 'rpool':

2013-06-26.17:14:36 zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda8

2013-06-26.17:16:22 zfs create rpool/ROOT

2013-06-26.17:28:35 zfs snapshot -r rpool@install

2013-06-26.17:43:54 zpool export rpool

2013-06-26.17:45:57 zpool import -d /dev/disk/by-id/ -R /mnt/funtoo rpool

2013-06-27.10:36:35 zpool import -f -d /dev/disk/by-id/ -R /mnt/gentoo rpool

2013-06-27.10:38:04 zfs create -o mountpoint=/gentoo rpool/gentoo

2013-06-27.10:38:39 zfs destroy rpool/gentoo

2013-06-27.10:40:31 zfs destroy -r rpool/ROOT

2013-06-27.10:43:18 zfs destroy rpool@install

2013-06-27.10:44:10 zfs create -o mountpoint=none rpool/gentoo

2013-06-27.10:45:01 zfs create rpool/gentoo/gentoo_rootfs

2013-06-27.10:45:51 zfs set mountpoint=/gentoo_rootfs rpool/gentoo/gentoo_rootfs

2013-06-27.12:50:53 zfs create -o mountpoint=/usr/src rpool/gentoo/gentoo_rootfs/usr_src

2013-06-27.12:51:14 zfs create -o mountpoint=/var rpool/gentoo/gentoo_rootfs/var

2013-06-27.12:51:29 zfs create -o mountpoint=/usr/portage rpool/gentoo/gentoo_rootfs/usr_portage

2013-06-27.12:52:17 zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/gentoo/gentoo_rootfs/distfiles

2013-06-27.12:56:03 zpool set bootfs=rpool rpool

2013-06-27.12:56:48 zpool set cachefile=/etc/zfs/rpool.cache rpool

2013-06-27.13:04:32 zfs create -o mountpoint=/ rpool/gentoo/gentoo_rootfs/rootfs

2013-06-27.13:07:19 zfs set mountpoint=none rpool/gentoo/gentoo_rootfs

2013-06-27.13:08:10 zpool export rpool

2013-06-27.13:08:45 zpool import -d /dev/disk/by-id/ -R /mnt/gentoo rpool

2013-06-27.13:09:02 zpool export rpool

2013-06-27.13:09:36 zpool import -d /dev/disk/by-id/ -R /mnt/gentoo rpool


总结:

  • 1. zpool set bootfs=设置根系统的分支 pool_name   --->> 如  zpool set bootfs=rpool/ROOT/archlinux  rpool

  • 2. grub-install --root-directory=/boot /dev/sdX --recheck   单独分区的时候

  • 3. 在GPT分区模式下,设置一个EF02  (bios_分区类型),然后不能将当前分区当做/boot,需要另建一个分区挂为/boot

  • 4. zfs=池名称  zfs_force=1 表示相当于import 时加-f

你可能感兴趣的:(ZFS)