reformatting ext3 -> vxfs


Just a notepad post now…

I needed this when I needed to change a whole set of empty (!) filesystems from one ext3 to vxfs when a system suddenly was to become a cluster. (yes this means 100% data loss.)

fstab already had the new fs type set.

* Check the FS are empty

for fs in $( grep ^/dev/vx /etc/fstab | awk ‘{print $2}’ ) ; do ls $fs ; done

* Stop automounter

service autofs stop

* Umount them

for fs in $( grep ^/dev/vx /etc/fstab | awk ‘{print $2}’ | sort -r) ; do umount $fs ; done

* Re-format

for vol in $( grep ^/dev/vx /etc/fstab | awk ‘{print $1}’) ; do mkfs -t vxfs -o bsize=8192,largefiles $vol; done

* Backup & Change fstab

cp -p /etc/fstab /etc/fstab.$$ cat /etc/fstab.$$ | sed ‘s/ext3\ _netdev/vxfs\ _netdev/g’ > /etc/fstab

* Re-create missing Mountpoints and mount FS

for fs in $( grep ^/dev/vx /etc/fstab | awk ‘{print $2}’) ; do mkfs -t vxfs -o bsize=8192,largefiles $fs ; done

*  Use df to check FS mounts and note the usage difference, close your eyes, hold back a panic and remember you don’t have root reservation (-m XX) and various other overheads

* Restart the automounter

service autofs stop

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s