Tuesday, November 18, 2014

data sync, and server migration

Source: Solaris 10 zone M5000 server
Target: Solaris 11.2, M10 server

One of the server which had over 30TB of data was really slow. This was a zone on M5000 server with 64GB of ram. We build a new server on Sun M10 server and sync the data. rsync was really slow because it was using the 1GB throughput available on the system. However on M10 side, it has 10GB connection and out TSM back server also had 10GB connection. So we decided to use restore rather then rsync. 30 TB of data was restored and then final rsync is completed within a week. It was a wonderful experience. We used to do san to san replication but this time the storage were on different env. Server were on different env. We were copying data from prod to dev. Here is the detail how this task was completed.

on source server get the filesystem info.

You will need FS info, total size assigned to the filesystem and mountpoint.
bash-3.2# df -h | grep z01 | awk '{print $1 "\t\t\t" $2 "\t\t" $6}' >/var/tmp/FS_info.txt
z01p25/sis_appr1                        1.0T            /appsdata/dev/sis/appr1
z01p26/sis_appr2                        500G            /appsdata/dev/sis/appr2
z01p25/fmd_dev_sis_dav                  600G            /appsdata/dev/sis/davm
z01p19/distressed_wrsi                  500G            /appsdata/dev/sis/distressed_wrsi
z01p03/fdata_dev_sis_earlyindicator                     20G             /appsdata/dev/sis/earlyindicator
z01p25/fmd_dev_sis_hpaf                 100G            /appsdata/dev/sis/hpafcst
z01p11/appsdata_dev_sis_hve_monthly                     450G            /appsdata/dev/sis/hve/monthly
z01p10/appsdata_devsis_hve_monthly2                     400G            /appsdata/dev/sis/hve/monthly2
z01p06/fdata_dev_sis_hvedistress                        300G            /appsdata/dev/sis/hvedistress
z01p07/apdata_dev_sis_hvedist                   250G            /appsdata/dev/sis/hvedistress_archive
z01p18/fdata_dev_sis_hvedist_arch2                      295G            /appsdata/dev/sis/hvedistress_archive2
z01p29/fmd_dev_sis_mls                  1000G           /appsdata/dev/sis/mls
z01p13/appsdata_dev_sis_rnd                     600G            /appsdata/dev/sis/rnd
z01p07/apdata_dev_sis_rnd10                     325G            /appsdata/dev/sis/rnd10
z01p15/fmd_dev_sis_rnd11                        400G            /appsdata/dev/sis/rnd11
z01p16/appsdata_dev_sis_rnd2                    600G            /appsdata/dev/sis/rnd2

Now, seperate pool and volume info

bash-3.2# cat /var/tmp/FS_info.txt | awk '{print $2 "\t" $3}' > /var/tmp/size_n_FS.txt
bash-3.2# cd /var/tmp
bash-3.2# cat /var/tmp/size_n_FS.txt
1.0T    /appsdata/dev/sis/appr1
500G    /appsdata/dev/sis/appr2
600G    /appsdata/dev/sis/davm
500G    /appsdata/dev/sis/distressed_wrsi
20G     /appsdata/dev/sis/earlyindicator
100G    /appsdata/dev/sis/hpafcst
450G    /appsdata/dev/sis/hve/monthly
400G    /appsdata/dev/sis/hve/monthly2
300G    /appsdata/dev/sis/hvedistress
250G    /appsdata/dev/sis/hvedistress_archive
295G    /appsdata/dev/sis/hvedistress_archive2
1000G   /appsdata/dev/sis/mls
600G    /appsdata/dev/sis/rnd
325G    /appsdata/dev/sis/rnd10
400G    /appsdata/dev/sis/rnd11
600G    /appsdata/dev/sis/rnd2

bash-3.2# cat /var/tmp/FS_info.txt | awk '{print $1}'>pool_n_Vol.txt
bash-3.2# cat pool_n_Vol.txt

bash-3.2# cat pool_n_Vol.txt | awk -F/ '{print $1 "\t" $2}'>pool_volume.sep.txt
bash-3.2# cat pool_volume.sep.txt
z01p25  sis_appr1
z01p26  sis_appr2
z01p25  fmd_dev_sis_dav
z01p19  distressed_wrsi
z01p03  fdata_dev_sis_earlyindicator
z01p25  fmd_dev_sis_hpaf
z01p11  appsdata_dev_sis_hve_monthly
z01p10  appsdata_devsis_hve_monthly2
z01p06  fdata_dev_sis_hvedistress
z01p07  apdata_dev_sis_hvedist
z01p18  fdata_dev_sis_hvedist_arch2
z01p29  fmd_dev_sis_mls
z01p13  appsdata_dev_sis_rnd
z01p07  apdata_dev_sis_rnd10
z01p15  fmd_dev_sis_rnd11
z01p16  appsdata_dev_sis_rnd2

bash-3.2# paste pool_volume.sep.txt size_n_FS.txt
z01p25  sis_appr1       1.0T    /appsdata/dev/sis/appr1
z01p26  sis_appr2       500G    /appsdata/dev/sis/appr2
z01p25  fmd_dev_sis_dav 600G    /appsdata/dev/sis/davm
z01p19  distressed_wrsi 500G    /appsdata/dev/sis/distressed_wrsi
z01p03  fdata_dev_sis_earlyindicator    20G     /appsdata/dev/sis/earlyindicator
z01p25  fmd_dev_sis_hpaf        100G    /appsdata/dev/sis/hpafcst
z01p11  appsdata_dev_sis_hve_monthly    450G    /appsdata/dev/sis/hve/monthly
z01p10  appsdata_devsis_hve_monthly2    400G    /appsdata/dev/sis/hve/monthly2
z01p06  fdata_dev_sis_hvedistress       300G    /appsdata/dev/sis/hvedistress
z01p07  apdata_dev_sis_hvedist  250G    /appsdata/dev/sis/hvedistress_archive
z01p18  fdata_dev_sis_hvedist_arch2     295G    /appsdata/dev/sis/hvedistress_archive2
z01p29  fmd_dev_sis_mls 1000G   /appsdata/dev/sis/mls
z01p13  appsdata_dev_sis_rnd    600G    /appsdata/dev/sis/rnd
z01p07  apdata_dev_sis_rnd10    325G    /appsdata/dev/sis/rnd10
z01p15  fmd_dev_sis_rnd11       400G    /appsdata/dev/sis/rnd11
z01p16  appsdata_dev_sis_rnd2   600G    /appsdata/dev/sis/rnd2

bash-3.2#  paste pool_volume.sep.txt size_n_FS.txt | awk '{print $2 "\t" $3 "\t" $4 "\t" $1}' >mypool_config.txt

bash-3.2# cat mypool_config.txt
sis_appr1       1.0T    /appsdata/dev/sis/appr1 z01p25
sis_appr2       500G    /appsdata/dev/sis/appr2 z01p26
fmd_dev_sis_dav 600G    /appsdata/dev/sis/davm  z01p25
distressed_wrsi 500G    /appsdata/dev/sis/distressed_wrsi       z01p19
fdata_dev_sis_earlyindicator    20G     /appsdata/dev/sis/earlyindicator        z01p03
fmd_dev_sis_hpaf        100G    /appsdata/dev/sis/hpafcst       z01p25
appsdata_dev_sis_hve_monthly    450G    /appsdata/dev/sis/hve/monthly   z01p11
appsdata_devsis_hve_monthly2    400G    /appsdata/dev/sis/hve/monthly2  z01p10
fdata_dev_sis_hvedistress       300G    /appsdata/dev/sis/hvedistress   z01p06
apdata_dev_sis_hvedist  250G    /appsdata/dev/sis/hvedistress_archive   z01p07
fdata_dev_sis_hvedist_arch2     295G    /appsdata/dev/sis/hvedistress_archive2  z01p18
fmd_dev_sis_mls 1000G   /appsdata/dev/sis/mls   z01p29
appsdata_dev_sis_rnd    600G    /appsdata/dev/sis/rnd   z01p13
apdata_dev_sis_rnd10    325G    /appsdata/dev/sis/rnd10 z01p07
fmd_dev_sis_rnd11       400G    /appsdata/dev/sis/rnd11 z01p15
appsdata_dev_sis_rnd2   600G    /appsdata/dev/sis/rnd2  z01p16


Get the ownership info
# df -h |grep z01 | awk '{print $6}' >/var/tmp/permission.txt

bash-3.2$ more permission.txt
drwxrwxrwx   9 sisuser  sisgrp        10 Sep 10 16:15 /appsdata/dev/sis/appr1
drwxrwxrwx   9 sisuser  sisgrp        14 Mar 19  2014 /appsdata/dev/sis/appr2
drwxrwxr-x   8 sisuser  sisgrp        10 Aug 26 16:06 /appsdata/dev/sis/davm
drwxrwxrwx   4 sisuser  sisgrp         4 Apr 18  2014 /appsdata/dev/sis/distressed_wrsi
drwxrwx---  11 sisuser  sisgrp        50 May  2  2008 /appsdata/dev/sis/earlyindicator
drwxrwxrwx   3 sisuser  sisgrp         4 Jul 12  2013 /appsdata/dev/sis/hpafcst
drwxrwx---  31 sisuser  sisgrp        35 Apr 20  2011 /appsdata/dev/sis/hve/monthly
bash-3.2$ cat permission.txt | awk '{print "chown -R " $3":"$4 "\t" $9}' >/var/tmp/chpermission.sh
$ cat chpermission.sh
chown -R sisuser:sisgrp /appsdata/dev/sis/appr1
chown -R sisuser:sisgrp /appsdata/dev/sis/appr2
chown -R sisuser:sisgrp /appsdata/dev/sis/davm
chown -R sisuser:sisgrp /appsdata/dev/sis/distressed_wrsi
chown -R sisuser:sisgrp /appsdata/dev/sis/earlyindicator
chown -R sisuser:sisgrp /appsdata/dev/sis/hpafcst
chown -R sisuser:sisgrp /appsdata/dev/sis/hve/monthly
chown -R sisuser:sisgrp /appsdata/dev/sis/hve/monthly2
chown -R sisuser:sisgrp /appsdata/dev/sis/hvedistress
chown -R sisuser:sisgrp /appsdata/dev/sis/hvedistress_archive
chown -R sisuser:sisgrp /appsdata/dev/sis/hvedistress_archive2

Calculate the size and what filesystem you want to create on what pool. We created 800 to 1200 GB pool and adjusted the
space to fit the filesystem. You copy the mypool_config.txt file to the target system and create pool and filesystem. and
also copy the chpermission.sh script and put it under /var/tmp and run it to change the permission.

On target system
1. Bring the luns under the OS and create pool based on the size.
vi createpool.sh
zpool create poolv401_2 c1d11 c1d12 c1d13 c1d14 c1d15 c1d16
zpool create poolv401_3 c1d21 c1d22 c1d23 c1d24 c1d25
zpool create poolv401_4 c1d26 c1d27 c1d28 c1d29 c1d30
zpool create poolv401_5 c1d31 c1d32 c1d33 c1d34 c1d35
zpool create poolv401_6 c1d36 c1d37 c1d38 c1d39 c1d40
zpool create poolv401_7 c1d41 c1d42 c1d43 c1d44 c1d45
zpool create poolv401_8 c1d46 c1d47 c1d48 c1d49 c1d50 c1d51
zpool create poolv401_9 c1d52 c1d53 c1d54 c1d55 c1d56 c1d57
zpool create poolv401_10 c1d58 c1d59 c1d60 c1d61 c1d62
zpool create poolv401_11 c1d63 c1d64 c1d65 c1d66 c1d67
zpool create poolv401_12 c1d68 c1d69 c1d70 c1d71 c1d72 c1d73
zpool create poolv401_13 c1d74 c1d75 c1d76 c1d77 c1d78 c1d79
zpool create poolv401_14 c1d80 c1d81 c1d82 c1d83
zpool create poolv401_15 c1d84 c1d85 c1d86 c1d87 c1d88
zpool create poolv401_16 c1d89 c1d90 c1d91 c1d92 c1d93
zpool create poolv401_17 c1d94 c1d95 c1d96 c1d97 c1d98 c1d99
zpool create poolv401_18 c1d100 c1d101 c1d102 c1d103 c1d104 c1d105
zpool create poolv401_19 c1d106 c1d107 c1d108 c1d109 c1d110
zpool create poolv401_20 c1d111 c1d112 c1d113 c1d114 c1d115 c1d116
zpool create poolv401_21 c1d117 c1d118 c1d119 c1d120 c1d121
zpool create poolv401_22 c1d122 c1d123 c1d124 c1d125 c1d126 c1d127
zpool create poolv401_23 c1d128 c1d129 c1d130 c1d131 c1d132 c1d133
zpool create poolv401_24 c1d134 c1d135 c1d136 c1d137 c1d138 c1d139
zpool create poolv401_25 c1d140 c1d141 c1d142 c1d143
zpool create poolv401_26 c1d144 c1d145 c1d146 c1d147 c1d148 c1d149
zpool create poolv401_27 c1d150 c1d151 c1d152 c1d153 c1d154
zpool create poolv401_28 c1d155 c1d156 c1d157 c1d158 c1d159 c1d160
zpool create poolv401_29 c1d161 c1d162 c1d163 c1d164 c1d165 c1d166
zpool create poolv401_30 c1d167 c1d168 c1d169 c1d170 c1d171 c1d172
zpool create poolv401_31 c1d173 c1d174 c1d175 c1d176 c1d177
zpool create poolv401_32 c1d178 c1d179 c1d180 c1d181 c1d182
zpool create poolv401_33 c1d183 c1d184 c1d185 c1d186 c1d187
zpool create poolv401_34 c1d188 c1d189 c1d190 c1d191 c1d192
zpool create poolv401_35 c1d193 c1d194 c1d195

# ===================================================================

# FS      Size   MNT Point  POOL
# Pool poolv401_1 - 1T
FS_sis_appr1                        990G                    /appsdata/dev/sis/appr1 poolv401_1
# poolv401_2  - 1.2T
FS_sis_appr2                        500G                    /appsdata/dev/sis/appr2 poolv401_2
FS_fmd_dev_sis_dav                  600G                    /appsdata/dev/sis/davm poolv401_2
# poolv401_3 - 1T
FS_distressed_wrsi                  500G                    /appsdata/dev/sis/distressed_wrsi poolv401_3
FS_fdata_dev_sis_earlyindicator     20G                     /appsdata/dev/sis/earlyindicator poolv401_3
FS_appsdata_dev_sis_hve_monthly     450G                    /appsdata/dev/sis/hve/monthly poolv401_3
# poolv401_4  - 1T
FS_appsdata_devsis_hve_monthly2 400G                    /appsdata/dev/sis/hve/monthly2 poolv401_4
FS_fdata_dev_sis_hvedistress  300G                    /appsdata/dev/sis/hvedistress poolv401_4
FS_apdata_dev_sis_hvedist   250G                    /appsdata/dev/sis/hvedistress_archive poolv401_4
# poolv401_5 - 1T
FS_fmd_dev_sis_mls                  990G                   /appsdata/dev/sis/mls poolv401_5
# poolv401_6 - 1T
FS_fdata_dev_sis_hvedist_arch2  295G                    /appsdata/dev/sis/hvedistress_archive2 poolv401_6
FS_appsdata_dev_sis_rnd   590G                    /appsdata/dev/sis/rnd  poolv401_6
FS_fmd_dev_sis_hpaf   100G                    /appsdata/dev/sis/hpafcst poolv401_6
# poolv401_7 - 1T
FS_fmd_dev_sis_rnd11   390G                    /appsdata/dev/sis/rnd11  poolv401_7
FS_appsdata_dev_sis_rnd2   590G                    /appsdata/dev/sis/rnd2  poolv401_7
# poolv401_8 - 1.2T
FS_apdata_dev_sis_rnd10     325G                    /appsdata/dev/sis/rnd10  poolv401_8
FS_fdata_dev_sis_rnd5    375G                    /appsdata/dev/sis/rnd5  poolv401_8
FS_fdata_dev_sis_rnd6    375G                    /appsdata/dev/sis/rnd6  poolv401_8
# poolv401_9 - 1.2T
FS_apdata_dev_sis_rnd7    300G                    /appsdata/dev/sis/rnd7  poolv401_9
FS_fmd_dev_sis_rnd8   375G                    /appsdata/dev/sis/rnd8  poolv401_9
FS_fmd_dev_sis_rnd9    375G                    /appsdata/dev/sis/rnd9  poolv401_9
# poolv401_10  - 1TB
FS_fdata_dev_sis_rs                 445G                    /appsdata/dev/sis/rs  poolv401_10
FS_appsdata_dev_sis_rs_archive  295G                    /appsdata/dev/sis/rs_archive poolv401_10
FS_fmd_dev_sis_rs_arc2   245G                    /appsdata/dev/sis/rs_archive2 poolv401_10
# poolv401_11 - 1TB -- adjusted
FS_appsdata_dev_sis_rs_monthly  595G                    /appsdata/dev/sis/rs_monthly  poolv401_11
FS_fdata_dev_sis_rsm_arch   395G                    /appsdata/dev/sis/rs_monthly/archive poolv401_11
# poolv401_12  - 1.2 T
FS_fdata_dev_sis_rs_mon_rnd   275G                    /appsdata/dev/sis/rs_monthly/rnd poolv401_12
FS_fdata_dev_sis_rsmon_rnd2  375G                    /appsdata/dev/sis/rs_monthly/rnd2 poolv401_12
FS_apdata_dev_sis_seeds     375G                    /appsdata/dev/sis/seeds  poolv401_12
# poolv401_13 - 1.2T
FS_fmcdt_dev_sis_sds_arch   375G                    /appsdata/dev/sis/seeds_archive poolv401_13
FS_appsdata_dev_sis_work2   650G                    /appsdata/dev/sis/work2  poolv401_13
# poolv401_14 - 800 GB
FS_appsdata_dev_sis_work   790G                    /appsdata/dev/sis/work  poolv401_14
# poolv401_15 - 1TB
FS_apdata_dev_sis_work3   495G                    /appsdata/dev/sis/work3  poolv401_15
FS_fmd_dev_sis_wrsi_noreo   495G                    /appsdata/dev/sis/wrsi_noreo poolv401_15
# ------------------ Prod ----------------
# poolv401_16 - 1TB
FS_fmdt_prod_arch_1year  195G                    /appsdata/prod/archive/oneyear  poolv401_16
FS_fmdt_prod_arch_7year  195G                    /appsdata/prod/archive/sevenyear poolv401_16
FS_appsdata_prod_sis_archive  595G                    /appsdata/prod/sis/archive  poolv401_16
# poolv401_17  - 1.2 TB
FS_appsdata_prod_sis_arch2  595G                    /appsdata/prod/sis/archive2  poolv401_17
FS_fmd_prod_sis_archive3  595G                    /appsdata/prod/sis/archive3  poolv401_17
# poolv401_18 - 1.2T
FS_appsdata_prod_sis_data   400G                    /appsdata/prod/sis/data  
FS_fdata_p_sishvedat_sds_rawdat  400G                    /appsdata/prod/sis/hve/data/seeds/rawdata
FS_fmdp_sisd_sds_raw_firsta  300G                    /appsdata/prod/sis/hve/data/seeds/rawdata/firsta
# poolv401_19 - 1TB
FS_fdata_p_seedsrawdat_acx   500G                    /appsdata/prod/sis/hve/data/seeds/rawdata/acxiom
FS_fmdt_prd_sis_hve_dt_fdrout  250G                    /appsdata/prod/sis/hve/data/fdrout  poolv401_19
FS_fmd_prd_shve_sd2_rawd   170G                    /appsdata/prod/sis/hve/data/seeds2/rawdata
# poolv401_20 - 1.2 TB
FS_appsdata_prod_sis_hve_retro3  400G                    /appsdata/prod/sis/hve/retro3  poolv401_20
FS_appsdata_prod_sis_nplqc   10G                     /appsdata/prod/sis/nplqc  poolv401_20
FS_apdata_prod_sis_retro10   350G                    /appsdata/prod/sis/retro10  poolv401_20
FS_fmd_prod_sis_retro11   350G                    /appsdata/prod/sis/retro11  poolv401_20
# poolv401_21 - 1TB
FS_fmd_prod_sis_retro12  350G                    /appsdata/prod/sis/retro12  poolv401_21
FS_appsdata_prod_sis_retro1  600G                    /appsdata/prod/sis/retro1  poolv401_21
# poolv401_22  - 1.2T
FS_sis_retro13    595G                    /appsdata/prod/sis/retro13  poolv401_22
FS_appsdata_prod_sis_retro2  595G                    /appsdata/prod/sis/retro2  poolv401_22
# poolv401_23 - 1.2T
FS_fdata_prod_sis_retro4    595G                    /appsdata/prod/sis/retro4  poolv401_23
FS_appsdata_data_sis_retro5  595G                    /appsdata/prod/sis/retro5  poolv401_23
# poolv401_24  - 1.2T
FS_appsdata_prod_sis_retro6  595G                    /appsdata/prod/sis/retro6  poolv401_24
FS_appsdata_prod_sis_retro7  595G                    /appsdata/prod/sis/retro7  poolv401_24
# poolv401_25 - 800GB
FS_appsdata_prod_sis_retro8   350G                    /appsdata/prod/sis/retro8 poolv401_25
FS_apdata_prod_sis_retro9  350G                    /appsdata/prod/sis/retro9 poolv401_25
# poolv401_26  - 1.2TB
FS_sis     22G                     /sis  poolv401_26
FS_sis_cbrtr     250G                    /sis/cbrtr poolv401_26
FS_sis_hve      700G                    /sis/hve poolv401_26
FS_sis_income    150G                    /sis/income poolv401_26
# poolv401_27 - 1TB
FS_sis_hve_archive   595G                    /sis/hve/archive poolv401_27
FS_sis_hve_archive2     395G                    /sis/hve/archive2 poolv401_27
# poolv401_28  - 1.2TB
FS_sis_hve_data   495G                    /sis/hve/data  poolv401_28
FS_sis_hve_data_acxiom   195G                    /sis/hve/data/acxiom poolv401_28
FS_sis_hve_data_comps   195G                    /sis/hve/data/comps poolv401_28
FS_appraise_latest      299G                    /sis/hve/data/property/appraisal/latest  poolv401_28
# poolv401_29  - 1.2TB
FS_sis_hve_data_firsta      200G                    /sis/hve/data/firsta   poolv401_29
FS_sis_hve_data_property_firsta   390G                    /sis/hve/data/property/firsta  poolv401_29
FS_sis_hve_data_p_fir_rawdata    600G                    /sis/hve/data/property/firsta/rawdata poolv401_29
# poolv401_30  - 1.2TB
FS_firsta_latest                    300G                    /sis/hve/data/property/firsta/latest
FS_sis_hve_data_prop_fir_pscrub    500G                    /sis/hve/data/property/firsta/prescrub
FS_sis_hve_data_prop_idm     300G                    /sis/hve/data/property/idm  poolv401_30
# poolv401_31 - 1TB
FS_idm_latest     300G                    /sis/hve/data/property/idm/latest poolv401_31
FS_sis_hve_data_prop_idm_prescr   275G                    /sis/hve/data/property/idm/prescrub poolv401_31
FS_sis_hve_data_rs   400G                    /sis/hve/data/rs   poolv401_31
# poolv401_32 - 1TB
FS_sis_hve_data_prop_idm_rawdat  495G                    /sis/hve/data/property/idm/rawdata poolv401_32
FS_sis_hve_retro    495G                    /sis/hve/retro    poolv401_32
# poolv401_33 - 1TB
FS_sis_hve_data_seeds    250G                    /sis/hve/data/seeds  poolv401_33
FS_sis_hve_data_seeds_raw    280G                    /sis/hve/data/seeds/raw  poolv401_33
FS_sis_hve_distress  300G                    /sis/hve/distress  poolv401_33
FS_sis_hve_ffs    5.0G                    /sis/hve/ffs   poolv401_33
# poolv401_34 - 1TB
FS_sis_hve_forecast   300G                    /sis/hve/forecast  poolv401_34
FS_sis_hve_hedonic   140G                    /sis/hve/hedonic  poolv401_34
FS_sis_hve_rnd2   350G                    /sis/hve/rnd2   poolv401_34
FS_sis_hve_tablescrap          150G                    /sis/hve/tablescrap  poolv401_34
# poolv401_35 - 600GB
FS_sis_hve_testdata    300G                    /sis/hve/testdata poolv401_35
FS_sis_rnd     200G                    /sis/rnd  poolv401_35
# ================================================================================
# df -h | grep z01 | awk '{print $1 "\t\t\t" $2 "\t\t\t" $6}'
# for i in `cat /tmp/a`; do df -h $i | tail -1; done

Once your config file is ready use the following script to create fs.

Copy the following script to /var/tmp and run the script
# cd /var/tmp; vi create_zfs.sh; chmod u+x create_zfs.sh; ./create_zfs.sh

# cat var/tmp/create_zfs.sh
# Sam Bhusal; Only for personal use
# Automate FS creation task using zfs. This script tested and verified on Solaris 10.
# Mon Feb 24 12:13:24 EST 2014
# Update: Thu Aug 14 09:55:12 EDT 2014
# This is a config file for sybase FS.
# Volume       Size (GB) mPoint         pool
#FS_opt_oracle  10G     /opt/oracle     z01p03
#opt_sasbi      25G     /opt/sasbi      z01p03
#pkgs           50G     /pkgs           z01p03
if [ `/usr/bin/whoami` != "root" ]
        echo "You must be root to run this script"
        exit 1
# Creating LVM.
# Read the config file
/bin/cat mypool_config.txt | grep -v "^#" | while read myvol mysize mymnt mypool
        # create FS
        zfs create -o mountpoint=${mymnt} -o quota=${mysize} ${mypool}/${myvol}
#       zfs create -o mountpoint=/tmp/abcde -o quota=10G poolv401_1/FS_TMP_ABCDE
# For raw device
#       zfs create -V ${mysize} ${mypool}/${myvol}
        # Check the condition if the process is successful.
        if [ $? -eq 0 ]; then
                echo "Successfully Created ${mymnt} fileystem on ${mypool} pool."
                df -h ${mymnt}
                echo "Failed, please review the error"
                # exit
echo " ----------------end----------------"
# Backout Plan
# List your LVMs
# zfs list
# zfs destroy /dev/${myvg}/${myfs}

Once fs are created, verify each and everything such as size, mountpoint.
then change the ownership. to change it run the script.

No comments:

Post a Comment