Monday, November 15, 2010

tar into a pipe and then out of the pipe for copying files

Sometimes you want to copy a directory from one location to another and in order to preserve all permissions, etc, you can easily tar the files into a pipe and then out of the pipe:

cd fromdir; tar cf - .| (cd todir; tar xfBp -)

Drop a 'v' (without the quote marks) into the second tar command and you will get a file listing of all the files it extracts from the pipe.

Thursday, September 2, 2010

VMWare Snapshot Troubleshooting

If you try and delete a snapshot from the GUI, but it times out, you can use these commands to see what's going on. First login to your vmware server as root:

# vmware-vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
80 host1 [vm-host1] host1/host1.vmx winLonghornGuest vmx-07

96 host2 [vm-host2] host2/host2.vmx winLonghornGuest vmx-07


That will give you the VMID for the system you want to check. Feed that into the next command:

# vmware-vim-cmd vmsvc/get.tasklist 80

(ManagedObjectReference) [
'vim.Task:haTask-80-vim.vm.Snapshot.remove-1460141'
]

To monitor the snapshot deletion process itself, issue the following command:

# watch -d "ls -touh --full-time *.vmdk"

where:

-d highlights the differences between successive updates

t sorts by modification time
o inhibits display of group information to shorten the output display
u sorts by and shows access time
h prints sizes in a readable format like 1K 234M 2G
full-time displays the time in full format

This command monitors the contents of a directory and displays files by their modification date. You can observe that snapshots first commit their data to the parent file recursively and finally to the base disk.


The output looks like:

Every 2.0s: ls -touh --full-time *.vmdk Thu Sep 2 09:10:00 2010


-rw------- 1 root 56G 2010-09-02 09:10:00.000000000 -0400 host1-000002-delta.vm
dk

-rw------- 1 root 113M 2010-09-02 08:26:47.000000000 -0400 host1_1-000001-delta.
vmdk

-rw------- 1 root 1.6G 2010-09-02 08:26:46.000000000 -0400 host1-000001-delta.vm
dk

-rw------- 1 root 500G 2010-09-02 08:26:44.000000000 -0400 host1-flat.vmdk

-rw------- 1 root 370 2010-09-02 07:16:31.000000000 -0400 host1_1-000001.vmdk

-rw------- 1 root 364 2010-09-02 07:10:16.000000000 -0400 host1-000001.vmdk

-rw------- 1 root 7.9M 2010-09-02 07:10:16.000000000 -0400 host1_1-000001-ctk.vm
dk

-rw------- 1 root 7.9M 2010-09-02 07:10:16.000000000 -0400 host1-ctk.vmdk

-rw------- 1 root 579 2010-09-02 07:10:16.000000000 -0400 host1.vmdk

-rw------- 1 root 7.9M 2010-09-02 07:10:15.000000000 -0400 host1-000001-ctk.vmdk

-rw------- 1 root 7.9M 2010-09-02 07:10:15.000000000 -0400 host1-000002-ctk.vmdk

-rw------- 1 root 7.9M 2010-09-02 07:10:14.000000000 -0400 host1_1-000002-ctk.vm
dk

-rw------- 1 root 14G 2010-09-02 07:10:10.000000000 -0400 host1_1-000002-delta.
vmdk

-rw------- 1 root 442 2010-09-02 01:15:08.000000000 -0400 host1_1-000002.vmdk

-rw------- 1 root 380 2010-09-02 01:11:03.000000000 -0400 host1-000002.vmdk



Also reference VMWare
KB Article: 1007566

Thursday, January 21, 2010

last history on Solaris resets itself nightly

The fix to this problem is found in this SunSolve document:


http://sunsolve.sun.com/search/document.do?assetkey=1-61-205225-1

Solaris 8 and above:

Edit the /usr/lib/acct/runacct script.

Find the "nulladm ${_wtmpx}" line and comment it out.