Understanding Various disk mode during disk allocation in VM

In my earlier post I discussed about allocation of RDMs to VM. There is one interesting parameter Disk Mode which can be change in case of vRDM or simple disk allocation.

I am trying to show that concept using vRDM. By default dependent mode is selected.

Case 1 : Changing the disk mode from dependent to independent disk.

Step 1 : Lets change the disk mode to “independent disk”

In Independent disk changes are immediately written to disk and persist across reboots but they are not included in snapshots.

Lets see how this happen currently I am on VM on which this rdm is assigned. I have created one file.

[root@Node1 ~]# mount -t ext4 /dev/rdm_vg/rdm_lv1 /mnt
[root@Node1 ~]# cd /mnt
[root@Node1 mnt]# ls
lost+found rdmfile rdmfile1
[root@Node1 mnt]# dd if=/dev/zero of=/mnt/independentfile bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.435041 s, 241 MB/s
[root@Node1 mnt]# ls
independentfile lost+found rdmfile rdmfile1

Step 2 : After that, I was trying to take the simple snapshot it throws the message that memory snapshots can’t be taken.
I unchecked the memory snapshot option after that it start taking the snapshot. It was quite fast because memory was not included and it has not taken the snapshot of RDM disk assigned to VM.
We can confirm the same by looking into VM files.

/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # ls -lsh
total 3316752
17408 -rw——- 1 root root 16.0M Aug 31 09:30 Redhat-1-000001-delta.vmdk
0 -rw——- 1 root root 319 Aug 31 09:30 Redhat-1-000001.vmdk
0 -rw-r–r– 1 root root 82 Aug 31 09:19 Redhat-1-1a79c343.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 09:25 Redhat-1-1a79c343.vswp
1024 -rw——- 1 root root 27.9K Aug 31 09:30 Redhat-1-Snapshot1.vmsn
2111488 -rw——- 1 root root 10.0G Aug 31 09:30 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:30 Redhat-1.nvram
0 -rw——- 1 root root 519 Aug 31 09:26 Redhat-1.vmdk
0 -rw-r–r– 1 root root 476 Aug 31 09:30 Redhat-1.vmsd
8 -rwxr-xr-x 1 root root 2.9K Aug 31 09:30 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:25 Redhat-1.vmx.lck
0 -rw-r–r– 1 root root 263 Aug 31 09:16 Redhat-1.vmxf
8 -rwxr-xr-x 1 root root 2.9K Aug 31 09:30 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 09:25 Redhat-1_1-rdm.vmdk
0 -rw——- 1 root root 483 Aug 31 09:27 Redhat-1_1.vmdk
1024 -rw——- 1 root root 312.7K Aug 31 09:16 vmware-1.log
1024 -rw——- 1 root root 119.2K Aug 31 09:16 vmware-2.log
1024 -rw——- 1 root root 114.3K Aug 31 09:16 vmware-3.log
1024 -rw——- 1 root root 136.4K Aug 31 09:16 vmware-4.log
1024 -rw——- 1 root root 149.0K Aug 31 09:16 vmware-5.log
1024 -rw-r–r– 1 root root 114.4K Aug 31 09:23 vmware-6.log
1024 -rw-r–r– 1 root root 125.5K Aug 31 09:29 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:25 vmx-Redhat-1-444187459-1.vswp

Step 3 : Now I am gonna made changes to both vdisk assigned to VM(Redhat-1_1.vmdk original) and vRDM assigned to VM(Redhat-1_1-rdm.vmdk) after that will try to restore the snapshot.

I have create two files one is with name independentfileaftersnapsho on Redhat-1_1-rdm.vmdk another one named fileaftersnapshot on simple vmdk.

[root@Node1 mnt]# dd if=/dev/zero of=/mnt/independentfileaftersnapshot bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.919804 s, 114 MB/s
[root@Node1 mnt]# ls
independentfile independentfileaftersnapshot lost+found rdmfile rdmfile1
[root@Node1 mnt]# dd if=/dev/zero of=/fileaftersnapshot bs=1M count=100 100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.07967 s, 97.1 MB/s
[root@Node1 /]# ls fileaftersnapshot
fileaftersnapshot

Step 4 : Now I am reverting the snapshot VM got poweroff which was expected as snapshots are not memory snapshot.

Now If I am looking at file created in simple vmdk.

[root@Node1 ~]# cd /
[root@Node1 /]# ls fileaftersnapshot
ls: cannot access fileaftersnapshot: No such file or directory

But file present on RDM is still present that means that snapshot has not included RDM lun at step 2.

[root@Node1 mnt]# ls
independentfile independentfileaftersnapshot lost+found rdmfile rdmfile1

Step 5 : I deleted the snapshot created in previous step.

Case 2 : Now changing the vRDM type from Independent-Persistent to Independent-NonPersistent

As per definition “In the case of Independent-Nonpersistent changes to disk are discarded when you poweroff or revert the snapshot”

Step 1 : As I am using the same RDM LUN hence old files are present in it Now let me create the new file with name non-persistentfile

[root@Node1 mnt]# dd if=/dev/zero of=/mnt/non-persistentfile bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0518778 s, 202 MB/s
[root@Node1 mnt]# ls non-persistentfile
non-persistentfile

Step 2 : Now When I am doing poweroff and poweron of the VM.

After the file created in previous step is not available means the files not persist across reboots as defined in definition.

[root@Node1 ~]# mount -t ext4 /dev/rdm_vg/rdm_lv1 /mnt
[root@Node1 ~]# cd /mnt
[root@Node1 mnt]# ls non-persistentfile
ls: cannot access non-persistentfile: No such file or directory

Step 3 : I have created that file again for my snapshot verification.

[root@Node1 mnt]# dd if=/dev/zero of=/mnt/non-persistentfile bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0313793 s, 334 MB/s

Again memory snapshot is not possible. Hence unchecked the memory option while taking the snapshot.

Below files are created using snapshot.

/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # ls -lsh
total 3340304
17408 -rw——- 1 root root 16.0M Aug 31 09:43 Redhat-1-000001-delta.vmdk
0 -rw——- 1 root root 319 Aug 31 09:43 Redhat-1-000001.vmdk
0 -rw-r–r– 1 root root 82 Aug 31 09:19 Redhat-1-1a79c343.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 09:40 Redhat-1-1a79c343.vswp
1024 -rw——- 1 root root 27.9K Aug 31 09:43 Redhat-1-Snapshot2.vmsn
2117632 -rw——- 1 root root 10.0G Aug 31 09:43 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:43 Redhat-1.nvram
0 -rw——- 1 root root 519 Aug 31 09:41 Redhat-1.vmdk
0 -rw-r–r– 1 root root 476 Aug 31 09:43 Redhat-1.vmsd
8 -rwx—— 1 root root 3.0K Aug 31 09:43 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:40 Redhat-1.vmx.lck
0 -rw——- 1 root root 263 Aug 31 09:33 Redhat-1.vmxf
8 -rwx—— 1 root root 3.0K Aug 31 09:43 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 09:25 Redhat-1_1-rdm.vmdk
0 -rw——- 1 root root 483 Aug 31 09:34 Redhat-1_1.vmdk
17408 -rw——- 1 root root 16.0M Aug 31 09:43 Redhat-1_1.vmdk-delta.REDO_maJWsJ
0 -rw——- 1 root root 327 Aug 31 09:43 Redhat-1_1.vmdk.REDO_maJWsJ
1024 -rw——- 1 root root 136.4K Aug 31 09:16 vmware-4.log
1024 -rw——- 1 root root 149.0K Aug 31 09:16 vmware-5.log
1024 -rw-r–r– 1 root root 114.4K Aug 31 09:23 vmware-6.log
1024 -rw-r–r– 1 root root 146.5K Aug 31 09:33 vmware-7.log
1024 -rw——- 1 root root 137.9K Aug 31 09:35 vmware-8.log
1024 -rw——- 1 root root 139.1K Aug 31 09:40 vmware-9.log
1024 -rw——- 1 root root 127.9K Aug 31 09:42 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:40 vmx-Redhat-1-444187459-1.vswp

Step 4: Then created one more file after taking the snapshot.

[root@Node1 mnt]# dd if=/dev/zero of=/mnt/non-persistentfile1 bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 0.0454385 s, 231 MB/s

Step 5 : I removed the file which I created before taking snapshot now let me rever the snapshot.

Again VM got power off None of the file appear after that. After that power on the VM no files were present which were created in Step 3 and Step 4 of Case 2.

Step 6 : After that deleted the snapshot and below files are present in datastore on which VM is residing.

/vmfs/volumes/53d6a375-e1484298-3faa-000c29e52a9d/Redhat-1 # ls -lsh
total 3322896
0 -rw-r–r– 1 root root 82 Aug 31 09:19 Redhat-1-1a79c343.hlog
1048576 -rw——- 1 root root 1.0G Aug 31 09:49 Redhat-1-1a79c343.vswp
2118656 -rw——- 1 root root 10.0G Aug 31 09:54 Redhat-1-flat.vmdk
1024 -rw——- 1 root root 8.5K Aug 31 09:54 Redhat-1.nvram
0 -rw——- 1 root root 519 Aug 31 09:54 Redhat-1.vmdk
0 -rw-r–r– 1 root root 43 Aug 31 09:54 Redhat-1.vmsd
8 -rwx—— 1 root root 3.0K Aug 31 09:54 Redhat-1.vmx
0 -rw——- 1 root root 0 Aug 31 09:49 Redhat-1.vmx.lck
0 -rw——- 1 root root 263 Aug 31 09:49 Redhat-1.vmxf
8 -rwx—— 1 root root 3.0K Aug 31 09:54 Redhat-1.vmx~
0 -rw——- 1 root root 512.0M Aug 31 09:25 Redhat-1_1-rdm.vmdk
0 -rw——- 1 root root 483 Aug 31 09:34 Redhat-1_1.vmdk
17408 -rw——- 1 root root 16.0M Aug 31 09:54 Redhat-1_1.vmdk-delta.REDO_87xz5L
0 -rw——- 1 root root 327 Aug 31 09:50 Redhat-1_1.vmdk.REDO_87xz5L
1024 -rw——- 1 root root 149.5K Aug 31 09:49 vmware-10.log
1024 -rw——- 1 root root 149.0K Aug 31 09:16 vmware-5.log
1024 -rw-r–r– 1 root root 114.4K Aug 31 09:23 vmware-6.log
1024 -rw-r–r– 1 root root 146.5K Aug 31 09:33 vmware-7.log
1024 -rw——- 1 root root 137.9K Aug 31 09:35 vmware-8.log
1024 -rw——- 1 root root 139.1K Aug 31 09:40 vmware-9.log
1024 -rw——- 1 root root 119.6K Aug 31 09:52 vmware.log
130048 -rw——- 1 root root 127.0M Aug 31 09:49 vmx-Redhat-1-444187459-1.vswp

I left on you guys to read about redo files.

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