Creating zfs filesystem
1. Find your disk to use for pool
# echo | format
2. Create a pool
# zpool create ppool c2t1d0
3. Create filesystem
# zfs create ppool/FS_opt-os
4. Mount the filesystem
# zfs set mountpoint=/opt/os ppool/FS_opt-os
1. Find your disk to use for pool
# echo | format
or
# zfs create -o mountpoint=/opt/os mypool/opt_os
or
# zfs create ppool/FS_opt-os
# zfs set mountpoint=/opt/os ppool/FS_opt-os
or
# df -h /opt/ns
ppool/fs_opt_ns 20G 31K 20G 1% /opt/ns
# zfs umount ppool/fs_opt_ns
# zfs set mountpoint=/opt/OS_Image ppool/fs_opt_ns
# df -h
# zfs mount ppool/fs_opt_ns
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How to change mount point on zfs
1. Check your mount point that you are going to change
# df -h /opt/OS_Image/
Filesystem size used avail capacity Mounted on
ppool/fs_opt_ns 20G 31K 20G 1% /opt/OS_Image
2. Unmount old mountpoing
# zfs umount ppool/fs_opt_ns
3. Verify filesystem is unmounted
# df -h /opt/OS_Image/
Filesystem size used avail capacity Mounted on
/dev/dsk/c0d1s0 8.1G 4.0G 4.1G 50% /
4. Check zfs filesystem
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 85K 976M 31K /pool
ppool 142K 19.6G 31K none
ppool/fs_opt_ns 31K 19.6G 31K /opt/OS_Image
5. Change the mountpoint
# zfs set mountpoint=/opt/ns ppool/fs_opt_ns
6. Verify its changed
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 85K 976M 31K /pool
ppool 142K 19.6G 31K none
ppool/fs_opt_ns 31K 19.6G 31K /opt/ns
# df -h /opt/ns
Filesystem size used avail capacity Mounted on
/dev/dsk/c0d1s0 8.1G 4.0G 4.1G 50% /
7. Mount the filesystem and verify
# zfs mount ppool/fs_opt_ns
# df -h /opt/ns
Filesystem size used avail capacity Mounted on
ppool/fs_opt_ns 20G 31K 20G 1% /opt/ns
#
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Creating zfs filesystem
1. Find your disk to use for pool
# echo | format
2. Create a pool
# zpool create ppool c2t1d0
3. Create filesystem
# zfs create ppool/FS_opt-os
4. Mount the filesystem
# zfs set mountpoint=/opt/os ppool/FS_opt-os
1. Find your disk to use for pool
# echo | format
or
# zfs create -o mountpoint=/opt/os mypool/opt_os
or
# zfs create ppool/FS_opt-os
# zfs set mountpoint=/opt/os ppool/FS_opt-os
or
# df -h /opt/ns
ppool/fs_opt_ns 20G 31K 20G 1% /opt/ns
# zfs umount ppool/fs_opt_ns
# zfs set mountpoint=/opt/OS_Image ppool/fs_opt_ns
# df -h
# zfs mount ppool/fs_opt_ns
--------------------Detail Steps----------------
# echo | format
Searching for disks...
Inquiry failed for this logical diskdone
AVAILABLE DISK SELECTIONS:
0. c0d0 <▒x▒▒▒▒▒▒▒▒@▒▒▒ cyl 1566 alt 2 hd 255 sec 63>
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c2t0d0 <VMware,-VMware Virtual -1.0 cyl 1020 alt 2 hd 64 sec 32>
/pci@0,0/pci15ad,1976@10/sd@0,0
2. c2t1d0 <VMware,-VMwareVirtualS-1.0 cyl 128 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@1,0
3. c2t2d0 <VMware,-VMware Virtual S-1.0-1.00GB>
/pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number): Specify disk (enter its number):
2. Create a pool
# zpool create ppool c2t1d0
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
datapool 1008M 1.08M 1007M 0% ONLINE -
ppool 1008M 77K 1008M 0% ONLINE -
rpool 11.9G 6.39G 5.55G 53% ONLINE -
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 1.08M 975M 31K none
datapool/FS_opt-apps 970K 99.1M 948K /opt/apps
datapool/FS_opt-apps@snap05272017 22K - 948K -
ppool 70K 976M 31K /ppool
rpool 6.46G 5.30G 42.5K /rpool
rpool/ROOT 4.39G 5.30G 31K legacy
rpool/ROOT/s10x_u11wos_24a 4.39G 5.30G 4.39G /
rpool/dump 1.00G 5.30G 1.00G -
rpool/export 286K 5.30G 32K /export
rpool/export/home 254K 5.30G 254K /export/home
rpool/swap 1.06G 5.36G 1.00G -
# df -h
Filesystem size used avail capacity Mounted on
rpool/ROOT/s10x_u11wos_24a
12G 4.4G 5.3G 46% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 1.9G 360K 1.9G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
9.7G 4.4G 5.3G 46% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 1.9G 76K 1.9G 1% /tmp
swap 1.9G 28K 1.9G 1% /var/run
rpool/export 12G 32K 5.3G 1% /export
rpool/export/home 12G 253K 5.3G 1% /export/home
datapool/FS_opt-apps 100M 948K 99M 1% /opt/apps
rpool 12G 42K 5.3G 1% /rpool
/vol/dev/dsk/c1t0d0/sol_10_113_x86
2.1G 2.1G 0K 100% /cdrom/sol_10_113_x86
ppool 976M 31K 976M 1% /ppool
# zfs set mountpoint=none ppool
# df -h
Filesystem size used avail capacity Mounted on
rpool/ROOT/s10x_u11wos_24a
12G 4.4G 5.3G 46% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 1.9G 360K 1.9G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
9.7G 4.4G 5.3G 46% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 1.9G 76K 1.9G 1% /tmp
swap 1.9G 28K 1.9G 1% /var/run
rpool/export 12G 32K 5.3G 1% /export
rpool/export/home 12G 253K 5.3G 1% /export/home
datapool/FS_opt-apps 100M 948K 99M 1% /opt/apps
rpool 12G 42K 5.3G 1% /rpool
/vol/dev/dsk/c1t0d0/sol_10_113_x86
2.1G 2.1G 0K 100% /cdrom/sol_10_113_x86
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 1.08M 975M 31K none
datapool/FS_opt-apps 970K 99.1M 948K /opt/apps
datapool/FS_opt-apps@snap05272017 22K - 948K -
ppool 94K 976M 31K none
rpool 6.46G 5.30G 42.5K /rpool
rpool/ROOT 4.39G 5.30G 31K legacy
rpool/ROOT/s10x_u11wos_24a 4.39G 5.30G 4.39G /
rpool/dump 1.00G 5.30G 1.00G -
rpool/export 286K 5.30G 32K /export
rpool/export/home 254K 5.30G 254K /export/home
rpool/swap 1.06G 5.36G 1.00G -
3. Create filesystem
# zfs create ppool/FS_opt-os
# df -h
Filesystem size used avail capacity Mounted on
rpool/ROOT/s10x_u11wos_24a
12G 4.4G 5.3G 46% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 1.9G 360K 1.9G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
9.7G 4.4G 5.3G 46% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 1.9G 76K 1.9G 1% /tmp
swap 1.9G 28K 1.9G 1% /var/run
rpool/export 12G 32K 5.3G 1% /export
rpool/export/home 12G 253K 5.3G 1% /export/home
datapool/FS_opt-apps 100M 948K 99M 1% /opt/apps
rpool 12G 42K 5.3G 1% /rpool
/vol/dev/dsk/c1t0d0/sol_10_113_x86
2.1G 2.1G 0K 100% /cdrom/sol_10_113_x86
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 1.08M 975M 31K none
datapool/FS_opt-apps 970K 99.1M 948K /opt/apps
datapool/FS_opt-apps@snap05272017 22K - 948K -
ppool 132K 976M 31K none
ppool/FS_opt-os 31K 976M 31K none
rpool 6.46G 5.30G 42.5K /rpool
rpool/ROOT 4.39G 5.30G 31K legacy
rpool/ROOT/s10x_u11wos_24a 4.39G 5.30G 4.39G /
rpool/dump 1.00G 5.30G 1.00G -
rpool/export 286K 5.30G 32K /export
rpool/export/home 254K 5.30G 254K /export/home
rpool/swap 1.06G 5.36G 1.00G -
4. Mount the filesystem
# zfs set mountpoint=/opt/os ppool/FS_opt-os
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 1.08M 975M 31K none
datapool/FS_opt-apps 970K 99.1M 948K /opt/apps
datapool/FS_opt-apps@snap05272017 22K - 948K -
ppool 142K 976M 31K none
ppool/FS_opt-os 31K 976M 31K /opt/os
rpool 6.46G 5.30G 42.5K /rpool
rpool/ROOT 4.39G 5.30G 31K legacy
rpool/ROOT/s10x_u11wos_24a 4.39G 5.30G 4.39G /
rpool/dump 1.00G 5.30G 1.00G -
rpool/export 286K 5.30G 32K /export
rpool/export/home 254K 5.30G 254K /export/home
rpool/swap 1.06G 5.36G 1.00G -
# df -h
Filesystem size used avail capacity Mounted on
rpool/ROOT/s10x_u11wos_24a
12G 4.4G 5.3G 46% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 1.9G 360K 1.9G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
9.7G 4.4G 5.3G 46% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
swap 1.9G 76K 1.9G 1% /tmp
swap 1.9G 28K 1.9G 1% /var/run
rpool/export 12G 32K 5.3G 1% /export
rpool/export/home 12G 253K 5.3G 1% /export/home
datapool/FS_opt-apps 100M 948K 99M 1% /opt/apps
rpool 12G 42K 5.3G 1% /rpool
/vol/dev/dsk/c1t0d0/sol_10_113_x86
2.1G 2.1G 0K 100% /cdrom/sol_10_113_x86
ppool/FS_opt-os 976M 31K 976M 1% /opt/os
# df -h /export/home/prema/
Filesystem size used avail capacity Mounted on
rpool/export/home 12G 253K 5.3G 1% /export/home
zfs mirror and creating swap on zfs filesystem
1. Remove the sub mirror from the pool
# zpool detach datapool c1t2d0
# zpool status datapool
pool: datapool
state: ONLINE
scan: resilvered 454M in 0h0m with 0 errors on Sun Jun 4 09:00:42 2017
config:
NAME STATE READ WRITE CKSUM
datapool ONLINE 0 0 0
c1t0d0 ONLINE 0 0 0
errors: No known data errors
2. Mirror the disk
# zpool help attach
usage:
attach [-f] <pool> <device> <new-device>
# zpool attach datapool c1t0d0 c1t2d0
3. Create a swap volume
# zfs help
The following commands are supported:
allow clone create destroy diff get
groupspace help hold holds inherit list
mount promote receive release rename rollback
send set share snapshot unallow unmount
unshare upgrade userspace
For more info, run: zfs help <command>
# zfs help create
usage:
create [-p] [-o property=value] ... <filesystem>
create [-ps] [-b blocksize] [-o property=value] ... -V <size> <volume>
# zfs create -V 100m datapool/myswap
4. Locate your swap volume
# ls -l /dev/zvol/dsk/datapool/myswap
lrwxrwxrwx 1 root root 35 Jun 4 09:09 /dev/zvol/dsk/datapool/myswap -> ../../../../devices/pseudo/zfs@0:1c
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
datapool 557M 419M 32K none
datapool/mydb 454M 419M 453M /data/mydb
datapool/mydb/test 31K 419M 31K /data/mydb/test
datapool/myswap 103M 522M 16K -
mypool 142K 1.95G 31K none
mypool/opt_os 31K 1.95G 31K /opt/os
yourpool 189K 19.6G 31K none
yourpool/FS_opt-OS_Image 31K 19.6G 31K /opt/OS_Image
yourpool/fs-opt-os 31K 19.6G 31K /opt/os
5. Add swap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
# swap -s
total: 273784k bytes allocated + 91588k reserved = 365372k used, 1264948k available
# swap -a /dev/zvol/dsk/datapool/myswap
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0d1s1 102,1 8 1076344 1076344
/dev/zvol/dsk/datapool/myswap 181,1 8 204792 204792
# swap -s
total: 273868k bytes allocated + 91572k reserved = 365440k used, 1366508k available
#
No comments:
Post a Comment