Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #USE IT IN COMMAND LINE (without #):
- #curl http://pastebin.com/raw/EFcqQZdv > xenglusterfs.sh; tr -d "\015" < xenglusterfs.sh > xenglusterfsnew.sh
- #chmod 755 xenglusterfsnew.sh; . ./xenglusterfsnew.sh
- #I have managed to configure 4 servers of beta dundee with glusterfs and ctdb and fully working ha without SPOF.
- #I have four NICs: NIC0 management of xenserver 192.168.10.2*, NIC1 gluster vm client 192.168.10.14*, bond NIC2-3 10.10.10.1*, VIPs #from ctdb 192.168.10.13*. In /etc/hosts I keep only 10.10.10.1x server ips and use them in glusterfs volume creation and in #consequence in glusterfs backend traffic.
- #The main compilation script:
- #http://pastebin.com/EFcqQZdv
- #Removing local storage and configuring ctdb, /etc/hosts:
- #http://pastebin.com/yKCtrCmB
- #At the end you should:
- #gluster peer probe servers and
- #init_gluster4 "xenserverhw" "06" "08" "03" "04" "vol0" 4 #replica 4 at the end!
- #create SR nfs and iso, make vm and install xen tools and enable ha with 3 failovers.
- #You are encouraged to send some patches or opinions newfuntek(at)gmail.com
- #Here are some screenshots of the glusterfs sr in the xenserver pool:
- #http://s19.postimg.org/4pr7i3m2r/glusterfsxenserv01.jpg
- #http://s19.postimg.org/g0tv6gsxv/glusterfsxenserv02.jpg
- #http://s19.postimg.org/fzjxd1r43/glusterfsxenserv03.jpg
- #Internet help
- #Xenserver doc links
- #http://www.poppelgaard.com/citrix-xenserver-6-5
- #http://www.gluster.org/community/documentation/index.php/GlusterFS_Documentation
- #xenserver tutorials and cheatsheets
- #http://www.admin-magazine.com/HPC/Articles/GlusterFS
- #http://www.slashroot.in/gfs-gluster-file-system-complete-tutorial-guide-for-an-administrator
- #https://virtualizationandstorage.wordpress.com/2010/11/15/xenserver-commands/
- #http://krypted.com/unix/using-the-xensource-command-line-interface/
- #http://funwithlinux.net/2013/02/glusterfs-tips-and-tricks-centos/
- #http://xmodulo.com/category/xenserver
- #compilation of xenserver
- #https://discussions.citrix.com/topic/372069-does-libvmi-work-on-xenserver/
- #glusterfs slides info
- #http://rajesh-joseph.blogspot.com/2015/11/usenix-lisa-2015-tutorial-on-glusterfs.html
- #https://github.com/gluster/gluster-tutorial/blob/master/LISA-GlusterFS-Introduction.pdf
- #https://github.com/gluster/gluster-tutorial/blob/master/LISA-GlusterFS-Hands-on.pdf
- #compilation of glusterfs
- #http://majentis.com/?p=319
- #różne możliwości glusterfs jak w RAID
- #http://sysadm.pp.ua/linux/glusterfs-setup.html
- #glusterfs performance
- #https://blog.secretisland.de/xenserver-mit-glusterfs/
- #http://blog.dradmin.co.in/?tag=glusterfs-how-to
- #https://gluster.readthedocs.org/en/latest/Administrator%20Guide/Managing%20Volumes/
- #https://www.mail-archive.com/users@ovirt.org/msg31079.html
- #http://www.gluster.org/community/documentation/index.php/Performance_Testing
- #glusterfs on lvm
- #https://support.rackspace.com/how-to/getting-started-with-glusterfs-considerations-and-installation/
- #glusterfs profiling (delays in ops)
- #https://gluster.readthedocs.org/en/latest/Administrator%20Guide/Monitoring%20Workload/
- #xenserver glusterfs discussion - they said not possible ;)
- #http://discussions.citrix.com/topic/366729-about-xenserver-glusterfs/page-2
- #xenserver ha
- #http://docs.citrix.com/de-de/xencenter/6-1/xs-xc-protection/xs-xc-pools-ha/xs-xc-pools-ha-about.html
- #http://xapi-project.github.io/features/HA/HA.html
- #https://support.citrix.com/servlet/KbServlet/download/21018-102-664364/High%20Availability%20for%20Citrix%20XenServer.pdf
- #https://xen-orchestra.com/blog/xenserver-and-vm-high-availability/
- #https://discussions.citrix.com/topic/367150-ntp-ha-self-fencing/page-2#entry1884695
- #http://discussions.citrix.com/topic/333343-need-help-interpreting-xha-logs/
- #failure ha restart
- #http://support.citrix.com/article/CTX128275
- #http://citrixtechs.com/blog/help-my-citrix-xenserver-poolmaster-is-down-2/
- #http://discussions.citrix.com/topic/292757-local-storage-unplugged-and-un-repairable/
- #xenserver iscsi
- #http://gluster.readthedocs.org/en/latest/Administrator%20Guide/GlusterFS%20iSCSI/#Running_the_target_on_the_gluster_client
- #xenserver multipath
- #http://docs.citrix.com/content/dam/docs/en-us/xenserver/xenserver-61/xs-design-multipathing-config.pdf
- #xenserver iptables discussion
- #http://discussions.citrix.com/topic/235974-cannot-add-new-nfs-virtual-disk-sr-can-add-iso-library-nfs-sr/page-2
- #rebalance nics (bond for glusterfs)
- #http://www.gluster.org/pipermail/gluster-users/2014-November/019463.html
- #http://www.gluster.org/pipermail/gluster-users/2014-November/019466.html
- #multi nic splitnetwork for gluster in near future
- #https://www.gluster.org/pipermail/gluster-users/2015-May/021815.html
- #http://www.gluster.org/community/documentation/index.php/Features/SplitNetwork
- #http://pl.atyp.us/hekafs.org/index.php/2013/01/split-and-secure-networks-for-glusterfs/
- #host in vm inside vm config
- #https://wiki.openstack.org/wiki/XenServer/VirtualBox
- #reinstall xenserver host
- #http://support.citrix.com/article/CTX136342
- #discuss rejoin xenserver
- #http://discussions.citrix.com/topic/303468-server-removed-from-pool-after-failure-now-that-it-is-back-it-can-not-rejoin-pool-and-emergency-master-reset-does-not-work/
- #increase dom0 memory
- #http://support.citrix.com/article/CTX134951
- #find rpm
- #http://rpm.pbone.net/
- #win admin
- #win7-10: Net user administrator /active:yes
- #umount /dev/v/l
- #e2fsck -f /dev/v/l
- #resize2fs -p /dev/v/l 4G
- #lvreduce -L -8.9G /dev/
- #turn off nfs i iptables
- chkconfig nfs off
- service nfs stop
- rm -f /etc/exports
- service ntpd restart
- chkconfig ntpd on
- service iptables stop
- chkconfig iptables off
- #new package update lists
- #https://discussions.citrix.com/topic/372069-does-libvmi-work-on-xenserver/
- #yum install epel-release
- #http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
- #http://elrepo.org/tiki/tiki-index.php
- rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
- rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
- wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
- rpm -ivh epel-release-7-5.noarch.rpm
- rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
- rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
- rpm -Uvh http://repo.webtatic.com/yum/el7/webtatic-release.rpm
- #sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/epel-testing.repo
- sed -i -e "/baseurl=http:\/\/www.uk/d" /etc/yum.repos.d/CentOS-Base.repo
- sed -i -e "/mirrorlist/d" /etc/yum.repos.d/CentOS-Base.repo
- sed -i -e "s/^#base/base/" /etc/yum.repos.d/CentOS-Base.repo
- sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/CentOS-Base.repo
- sed -i -e "s/\$releasever/7/" /etc/yum.repos.d/CentOS-Base.repo
- sed -i -e "s/enabled=1/enabled=0/" /etc/yum.repos.d/Citrix.repo
- yum clean all
- yum repolist enabled
- yum -y install deltarpm
- yum -y install vim-enhanced mc yum-utils curl e4fsprogs epel-rpm-macros
- curl ix.io/client > /usr/local/bin/ix
- chmod +x /usr/local/bin/ix
- #update systemu i dodatkowe pakiety potrzebne do kompilacji glusterfs (mogą być jakieś nadmiarowe)
- yum update --skip-broken -y
- #yum upgrade
- yum install gcc make automake git bison flex python-ctypes fusermount readline rpm-build libibverbs-devel gcc-c++ libtool dev86 mock texinfo -y
- useradd -s /sbin/nologin mockbuild
- yum install scsi-target-utils ctdb samba nc tdb-tools -y
- #yum install targetcli targetd -y
- yum install e2fsprogs-devel openssl-devel yajl-devel libaio-devel cairo-devel python-devel uuid-devel glib2-devel lzma-devel xz-compat-libs libacl-devel sqlite-devel libxml2-devel userspace-rcu-devel readline-devel librdmacm-devel fuse-devel lvm2 audit-libs-devel gettext-devel pam-devel popt-devel libutempter-devel libuser-devel libcap-ng-devel json-c-devel libestr-devel python-docutils ibgcrypt-devel libcurl-devel libee-devel liblognorm-devel libdbi-devel mysql mysql-devel postgresql-devel librelp-devel gnutls-devel net-snmp-devel libnet-devel attr dlm-devel sanlock-devel corosynclib-devel resource-agents libgcrypt-devel libtalloc-devel libtdb-devel libtevent-devel -y
- yum update --skip-broken -y
- #kompilacja util-linux, rsyslog, lvm2, gdyż nie udało się dodanie pakietów z devel
- #dodamy devel skompilowane, aby skompilować glusterfs
- echo "%__make /usr/bin/make -j 8" > ~/.rpmmacros
- cd
- wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.2.1511/os/Source/SPackages/util-linux-2.23.2-26.el7.src.rpm
- rpm -ivh util-linux-2.23.2-26.el7.src.rpm
- rpmbuild -ba rpmbuild/SPECS/util-linux.spec
- cd rpmbuild/RPMS/x86_64/
- rpm --force -ivh libuuid-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh libblkid-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh libmount-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh libuuid-devel-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh libblkid-devel-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh libmount-devel-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh util-linux-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh uuidd-2.23.2-26.el7.centos.x86_64.rpm
- rpm --force -ivh util-linux-debuginfo-2.23.2-26.el7.centos.x86_64.rpm
- cd
- mv rpmbuild rpmbuild-util-linux
- wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.2.1511/os/Source/SPackages/rsyslog-7.4.7-12.el7.src.rpm
- rpm -ivh rsyslog-7.4.7-12.el7.src.rpm
- rpmbuild -ba rpmbuild/SPECS/rsyslog.spec
- cd rpmbuild/RPMS/x86_64/
- rpm -ivh rsyslog-7.4.7-12.el7.centos.x86_64.rpm rsyslog-crypto-7.4.7-12.el7.centos.x86_64.rpm rsyslog-debuginfo-7.4.7-12.el7.centos.x86_64.rpm rsyslog-doc-7.4.7-12.el7.centos.x86_64.rpm rsyslog-elasticsearch-7.4.7-12.el7.centos.x86_64.rpm rsyslog-gnutls-7.4.7-12.el7.centos.x86_64.rpm rsyslog-gssapi-7.4.7-12.el7.centos.x86_64.rpm rsyslog-libdbi-7.4.7-12.el7.centos.x86_64.rpm rsyslog-mmaudit-7.4.7-12.el7.centos.x86_64.rpm rsyslog-mmjsonparse-7.4.7-12.el7.centos.x86_64.rpm rsyslog-mmnormalize-7.4.7-12.el7.centos.x86_64.rpm rsyslog-mmsnmptrapd-7.4.7-12.el7.centos.x86_64.rpm rsyslog-mysql-7.4.7-12.el7.centos.x86_64.rpm rsyslog-pgsql-7.4.7-12.el7.centos.x86_64.rpm rsyslog-relp-7.4.7-12.el7.centos.x86_64.rpm rsyslog-snmp-7.4.7-12.el7.centos.x86_64.rpm rsyslog-udpspoof-7.4.7-12.el7.centos.x86_64.rpm --force
- cd
- mv rpmbuild rpmbuild-rsyslog
- wget ftp://ftp.icm.edu.pl/vol/rzm5/linux-slc/centos/7.2.1511/os/Source/SPackages/lvm2-2.02.130-5.el7.src.rpm
- rpm -ivh lvm2-2.02.130-5.el7.src.rpm
- rpmbuild -ba rpmbuild/SPECS/lvm2.spec
- cd rpmbuild/RPMS/x86_64
- rpm -ivh cmirror-2.02.130-5.el7.centos.x86_64.rpm cmirror-standalone-2.02.130-5.el7.centos.x86_64.rpm device-mapper-1.02.107-5.el7.centos.x86_64.rpm device-mapper-devel-1.02.107-5.el7.centos.x86_64.rpm device-mapper-event-1.02.107-5.el7.centos.x86_64.rpm device-mapper-event-devel-1.02.107-5.el7.centos.x86_64.rpm device-mapper-event-libs-1.02.107-5.el7.centos.x86_64.rpm device-mapper-libs-1.02.107-5.el7.centos.x86_64.rpm lvm2-2.02.130-5.el7.centos.x86_64.rpm lvm2-debuginfo-2.02.130-5.el7.centos.x86_64.rpm lvm2-devel-2.02.130-5.el7.centos.x86_64.rpm lvm2-libs-2.02.130-5.el7.centos.x86_64.rpm lvm2-lockd-2.02.130-5.el7.centos.x86_64.rpm lvm2-python-libs-2.02.130-5.el7.centos.x86_64.rpm lvm2-sysvinit-2.02.130-5.el7.centos.x86_64.rpm --force
- cd
- mv rpmbuild rpmbuild-lvm2
- sed -i -e "s/metadata_read_only = 1/metadata_read_only = 0/" /etc/lvm/lvm.conf
- #wget http://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/EPEL.repo/epel-7/SRPMS/glusterfs-3.7.6-1.el7.src.rpm
- #wget http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.6/EPEL.repo/epel-7/SRPMS/glusterfs-3.7.6-1.el7.src.rpm
- gfsversion="3.7.8-4"
- wget http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.8/CentOS/epel-7/SRPMS/glusterfs-${gfsversion}.el7.src.rpm
- rpm -ivh glusterfs-${gfsversion}.el7.src.rpm
- #sed -i -e "/lvm2-devel/d" rpmbuild/SPECS/glusterfs.spec
- rpmbuild -ba rpmbuild/SPECS/glusterfs.spec
- cd rpmbuild/RPMS/x86_64/
- rpm -ivh glusterfs-libs-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-client-xlators-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-fuse-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-cli-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-api-${gfsversion}.el7.centos.x86_64.rpm
- rpm -ivh glusterfs-server-${gfsversion}.el7.centos.x86_64.rpm
- cd
- mv rpmbuild rpmbuild-glusterfs -f
- systemctl unmask rpcbind.socket
- #uruchomienie serwisu glusterfs
- service glusterd start
- service glusterd status
- service glusterfsd start
- service glusterfsd status
- chkconfig glusterd on
- chkconfig glusterfsd on
- mkdir rpmbuild/SPECS -p; curl http://ix.io/oh7 > rpmbuild/SPECS/ctdb.spec
- wget https://download.samba.org/pub/ctdb/ctdb-2.5.5.tar.gz -P rpmbuild/SOURCES
- yum install libtalloc-devel libtdb-devel libtevent-devel nc tdb-tools samba -y
- rpmbuild -bp rpmbuild/SPECS/ctdb.spec
- sed -i "s/SCHED_FIFO/SCHED_OTHER/" rpmbuild/BUILD/ctdb-2.5.5/common/system_util.c
- sed -i "s/p.sched_priority = 1/p.sched_priority = 0/" rpmbuild/BUILD/ctdb-2.5.5/common/system_util.c
- rpmbuild -bc --short-circuit rpmbuild/SPECS/ctdb.spec --noclean
- rpmbuild -bi --short-circuit rpmbuild/SPECS/ctdb.spec --noclean
- rpmbuild -bb --short-circuit rpmbuild/SPECS/ctdb.spec --noclean
- rpm -ivh rpmbuild/RPMS/x86_64/ctdb-* --nodeps --force
- sed -i "s/^# CTDB_LOGFILE/CTDB_LOGFILE/" /etc/sysconfig/ctdb
- sed -i "s/^# CTDB_NODES/CTDB_NODES/" /etc/sysconfig/ctdb
- sed -i "s/^CTDB_RECOVERY_LOCK/# CTDB_RECOVERY_LOCK/" /etc/sysconfig/ctdb
- sed -i 's/Restart=no/Restart=always/' /usr/lib/systemd/system/ctdb.service
- service smb stop
- chkconfig smb off
- wget http://halizard.org/release/noSAN-combined/halizard_nosan_installer_1.4.7
- chmod 755 halizard_nosan_installer_1.4.7
- sed -i 's/`uname -r`/3.10.0+2/' halizard_nosan_installer_1.4.7
- sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/sysconfig/selinux
- #curl http://ix.io/oxr > /etc/ntp.conf.ix
- #curl http://ix.io/ojO > /etc/ntp.conf.ix
- curl http://ix.io/op8 > /etc/ntp.conf.ix
- #curl http://ix.io/oKN > /etc/ntp.conf.ix
- tr -d "\015" < /etc/ntp.conf.ix > /etc/ntp.conf
- echo OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x" > /etc/sysconfig/ntpd
- echo SYNC_HWCLOCK=yes >> /etc/sysconfig/ntpd
- service ntpd stop
- service ntpd start
- ntpstat -s
- ntpq -p
- ntpstat -s
- echo "#/opt/xensource/bin/xe-toolstack-restart" >> /etc/rc.d/rc.local
- echo "service glusterd restart" >> /etc/rc.d/rc.local
- echo "service glusterfsd restart" >> /etc/rc.d/rc.local
- echo "service ctdb restart" >> /etc/rc.d/rc.local
- chmod 755 /etc/rc.d/rc.local
- echo "xe host-emergency-ha-disable force=true" > /usr/local/bin/restartfence
- echo "/opt/xensource/bin/xe-toolstack-restart" >> /usr/local/bin/restartfence
- echo "service glusterd restart" >> /usr/local/bin/restartfence
- echo "service glusterfsd restart" >> /usr/local/bin/restartfence
- echo "service ctdb restart" >> /usr/local/bin/restartfence
- chmod 755 /usr/local/bin/restartfence
- echo "/opt/xensource/bin/xe-toolstack-restart" >> /usr/local/bin/restartoolxen
- echo "service glusterd restart" >> /usr/local/bin/restartoolxen
- echo "service glusterfsd restart" >> /usr/local/bin/restartoolxen
- echo "service ctdb restart" >> /usr/local/bin/restartoolxen
- chmod 755 /usr/local/bin/restartoolxen
- echo "service glusterd restart" > /usr/local/bin/restartdodatki
- echo "service glusterfsd restart" >> /usr/local/bin/restartdodatki
- echo "service ctdb restart" >> /usr/local/bin/restartdodatki
- chmod 755 /usr/local/bin/restartdodatki
- echo "service glusterd restart" > /usr/local/bin/restartgluster
- echo "service glusterfsd restart" >> /usr/local/bin/restartgluster
- chmod 755 /usr/local/bin/restartgluster
- #init_gluster4 "xenserverhw" "06" "08" "03" "04" "vol0" 4
- #server="xenserverhw"; host01="06"; host02="08"; host03="03"; host04="04"; volume="vol0"; replica=4;
- cat <<__EOF__ > /usr/local/bin/init_gluster4
- server=\$1
- host01=\$2
- host02=\$3
- host03=\$4
- host04=\$5
- volume=\$6
- replica=\$7
- gluster peer status
- #na dowolnym jednym wykonac
- #glusterfs dwa volumeny vol0 (iso) I vol1 (gfs) na sda3 i sda2
- #gluster volume stop \$volume force
- #gluster volume delete \$volume force
- gluster volume create \$volume replica \$replica \${server}\${host01}:/export/\${server}\${host01}-\$volume \${server}\${host02}:/export/\${server}\${host02}-\$volume \${server}\${host03}:/export/\${server}\${host03}-\$volume \${server}\${host04}:/export/\${server}\${host04}-\$volume force
- gluster volume set \$volume nfs.port 2049
- gluster volume set \$volume performance.cache-size 128MB
- gluster volume set \$volume performance.write-behind-window-size 4MB
- gluster volume set \$volume performance.io-thread-count 64
- gluster volume set \$volume performance.io-cache on
- gluster volume set \$volume performance.read-ahead on
- gluster volume start \$volume
- gluster volume info \$volume
- gluster volume status \$volume
- #montowanie NFS SR pod localhost lub VIP :/vol0 lub vol1
- __EOF__
- chmod 755 /usr/local/bin/init_gluster4
- #init_gluster2 "xen" "1" "2" "vol0" 2
- #server="xen"; host01="1"; host02="2"; volume="vol0"; replica=2;
- cat <<__EOF__ > /usr/local/bin/init_gluster2
- server=\$1
- host01=\$2
- host02=\$3
- volume=\$4
- replica=\$5
- gluster peer status
- #na dowolnym jednym wykonac
- #glusterfs dwa volumeny vol0 (iso) I vol1 (gfs) na sda3 i sda2
- #gluster volume stop \$volume force
- #gluster volume delete \$volume force
- gluster volume create \$volume replica \$replica \${server}\${host01}:/export/\${server}\${host01}-\$volume \${server}\${host02}:/export/\${server}\${host02}-\$volume force
- gluster volume set \$volume nfs.port 2049
- gluster volume set \$volume performance.cache-size 128MB
- gluster volume set \$volume performance.write-behind-window-size 4MB
- gluster volume set \$volume performance.io-thread-count 64
- gluster volume set \$volume performance.io-cache on
- gluster volume set \$volume performance.read-ahead on
- gluster volume start \$volume
- gluster volume info \$volume
- gluster volume status \$volume
- #montowanie NFS SR pod localhost lub VIP :/vol0 lub vol1
- __EOF__
- chmod 755 /usr/local/bin/init_gluster2
- #init_brick "/dev/sdb1" "vol2"
- cat <<__EOF__ > /usr/local/bin/init_brick
- dev4gfs=\$1
- volume=\$2
- hname=\`hostname\`
- mkfs.ext4 -m 0 -j \$dev4gfs
- tune2fs -O dir_index -o user_xattr \$dev4gfs
- mkdir -p /export/\${hname}-\${volume}
- echo "\$dev4gfs /export/\${hname}-\${volume} ext4 rw,noatime,nodiratime,user_xattr,barrier=0,data=ordered 1 2" >> /etc/fstab
- mount -a
- __EOF__
- chmod 755 /usr/local/bin/init_brick
- #reformat_brick "/dev/sda2" "vol1"
- cat <<__EOF__ > /usr/local/bin/reformat_brick
- dev4gfs=\$1
- volume=\$2
- hname=\`hostname\`
- umount /export/\${hname}-\${volume}
- mkfs.ext4 -m 0 -j \$dev4gfs
- tune2fs -O dir_index -o user_xattr \$dev4gfs
- mount /export/\${hname}-\${volume}
- __EOF__
- chmod 755 /usr/local/bin/reformat_brick
- #removeallandformat "/dev/sdb"
- cat <<__EOF__ > /usr/local/bin/removeallandformat
- #!/bin/bash
- # Script to automatically format all partitions on /dev/sda and create
- # a single partition for the whole disk
- # Remove each partition
- for v_partition in \`parted -s \$1 print|awk '/^ / {print \$1}'\`; do umount \$1\${v_partition}; parted -s \$1 rm \${v_partition}; done
- # Find size of disk
- v_disk=\`parted -s \$1 print|awk '/^Disk \/dev/ {print \$3}'| sed 's/[Mm][Bb]//'\`
- # Create single partition
- parted -s \$1 mkpart primary 1 \${v_disk}
- # Format the partition
- # mke2fs -T ext3 \${1}1
- __EOF__
- chmod 755 /usr/local/bin/removeallandformat
- #KONIEC
Add Comment
Please, Sign In to add comment