ESXi : Working with tar, vmtar, vmtgz and ramdisks

The following script demonstrates how to create a .vgz file which can be loaded into memory.

It also demonstrates the fact that these act as union mounts:

# mkdir /foo

# echo "This file in tar disk" > /foo/bar

# tar cvf /tmp/foo.tar /foo
tar: removing leading '/' from member names
foo/
foo/bar

# rm -rf /foo

# vmtar -c /tmp/foo.tar -o /tmp/foo.vmtar

# rm /tmp/foo.tar

# vmtar -t < /tmp/foo.vmtar
drwxr-xr-x 0/0          0 2010-09-04 13:35 foo/
-rw-r--r-- 0/0         22 2010-09-04 13:35 foo/bar

# gzip < /tmp/foo.vmtar > /tmp/foo.vgz

# rm /tmp/foo.vmtar

# vmkramdisk /tmp/foo.vgz

# echo "Not in tardisk" > /foo/file2

# vdf
Tardisk              1k-blocks      Used
SYS1                    204548    204548
SYS2                     56724     56724
SYS3                     34724     34724
SYS4                       100       100
foo.vgz                      4         4
-----
Ramdisk              1k-blocks      Used Available Use% Mounted on
MAINSYS                  32768      2416     30352   7% --
tmp                     196608       120    196488   0% --
updatestg               768000         8    767992   0% --

# ls -al /foo
drwxr-xr-x    1 root     root                512 Oct  4 13:38 .
drwxr-xr-x    1 root     root                512 Oct  4 13:37 ..
-rw-r--r--    1 root     root                 22 Oct  4 13:35 bar
-rw-r--r--    1 root     root                 15 Oct  4 13:38 file2

# vdu /foo
For '/foo/file2':
                                 heap :         2048
For '/foo/bar':
                       tardisk foo.vgz:          512
For '/foo':
                                 heap :         2048            (    2 inodes)
                       tardisk foo.vgz:          512            (    1 inodes)

# vmkramdisk -u foo.vgz

# ls -al /foo
drwxr-xr-x    1 root     root                512 Oct  4 13:38 .
drwxr-xr-x    1 root     root                512 Oct  4 13:37 ..
-rw-r--r--    1 root     root                 15 Oct  4 13:38 file2

# vdu /foo
For '/foo/file2':
                                 heap :         2048
For '/foo':
                                 heap :         2048            (    2 inodes)
Advertisements

One Response to ESXi : Working with tar, vmtar, vmtgz and ramdisks

  1. Pingback: 7zip on ESXi through p7zip « The Wiert Corner – irregular stream of stuff

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

%d bloggers like this: