Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pierre Kim
vmware-thin-mover
Commits
10aa2ac0
Commit
10aa2ac0
authored
4 years ago
by
Pierre Kim
Browse files
Options
Download
Email Patches
Plain Diff
Edit some messages
parent
92b71140
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+5
-9
README.md
move_vm.sh
+8
-9
move_vm.sh
with
13 additions
and
18 deletions
+13
-18
README.md
+
5
-
9
View file @
10aa2ac0
...
...
@@ -11,12 +11,8 @@ Script syntax: move_vm.sh origin_datastore vm_name destination_datastore
## Example
[root@esxi:/vmfs/volumes/5c84813a-fed5e5c0-dbfa-d05099c274e1] ./move_vm.sh "500GB EVO" testvm RAID
#####################################
###VMWare Thin VM migration script###
#####################################
#########Author: manatails###########
#####################################
VMWare Thin VM migration script written by manatails
Version 1.0
Moving VM testvm from datastore 500GB EVO to VM testvm at datastore RAID
Creating destination directory...
Copying VMDK file...
...
...
@@ -26,7 +22,7 @@ Script syntax: move_vm.sh origin_datastore vm_name destination_datastore
Copying extra VMDK file...
Copying other files...
Copying snapshots...
c
opy finished.
Delete th
e origin
al
VM (y/n)? y
Removing origin VM...
C
opy finished.
Remov
e origin VM
files from disk
(y/n)? y
Removing origin VM
files
...
Migration finished.
This diff is collapsed.
Click to expand it.
move_vm.sh
+
8
-
9
View file @
10aa2ac0
#!/bin/sh
set
-e
echo
"#####################################"
echo
"###VMWare Thin VM migration script###"
echo
"#####################################"
echo
"#########Author: manatails###########"
echo
"#####################################"
VERSION
=
"1.0"
echo
"VMWare Thin VM migration script written by manatails"
echo
"Version
$VERSION
"
print_help
()
{
echo
"Syntax: move_vm.sh origin_datastore vm_name destination_datastore"
...
...
@@ -13,7 +12,7 @@ print_help() {
if
[
-z
"
$3
"
]
then
echo
"Insufficent arguments."
echo
"Insufficent
number of
arguments."
print_help
exit
1
fi
...
...
@@ -59,10 +58,10 @@ find "/vmfs/volumes/$1/$2" -maxdepth 1 -type f | grep -v ".vmdk" | while read fi
echo
"Copying snapshots..."
find
"/vmfs/volumes/
$1
/
$2
"
-maxdepth
1
-type
f |
grep
[
0123456789][0123456789][0123456789][0123456789][0123456789][0123456789] |
grep
".vmdk"
|
while
read
file
;
do
cp
"
$file
"
"/vmfs/volumes/
$3
/
$2
"
;
done
echo
"
c
opy finished."
read
-p
"
Delete th
e origin
al
VM (y/n)? "
CONT
echo
"
C
opy finished."
read
-p
"
Remov
e origin VM
files from disk
(y/n)? "
CONT
if
[
"
$CONT
"
=
"y"
]
;
then
echo
"Removing origin VM..."
echo
"Removing origin VM
files
..."
rm
-rf
"/vmfs/volumes/
$1
/
$2
"
fi
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help