<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Allen Pomeroy &#187; lvm</title>
	<atom:link href="http://www.networkforensics.us/tag/lvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.networkforensics.us</link>
	<description>Blog of an IT security specialist  .: beta :.</description>
	<lastBuildDate>Tue, 08 Jun 2010 16:59:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=9788</generator>
		<item>
		<title>Building a web security lab (with VMware Fusion)</title>
		<link>http://www.networkforensics.us/2009/10/building-a-web-security-lab/</link>
		<comments>http://www.networkforensics.us/2009/10/building-a-web-security-lab/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 14:28:50 +0000</pubDate>
		<dc:creator>edhacker</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[lab]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=88</guid>
		<description><![CDATA[Problem: VMware machines load boot loader immediately, no BIOS banner, so can&#8217;t get into BIOS to alter boot settings. Solution: Edit the vm&#8217;s .vmx file and add the line: bios.bootDelay = "5000" which adds a 5000 millisecond (5 second) delay to the boot, or add: bios.forceSetupOnce = "TRUE" to make the VM enter the BIOS [...]]]></description>
			<content:encoded><![CDATA[<p>Problem: VMware machines load boot loader immediately, no BIOS banner, so can&#8217;t get into BIOS to alter boot settings.<br />
Solution: Edit the vm&#8217;s .vmx file and add the line:<br />
<code><br />
bios.bootDelay = "5000"<br />
</code><br />
which adds a 5000 millisecond (5 second) delay to the boot, or add:<br />
<code><br />
bios.forceSetupOnce = "TRUE"<br />
</code><br />
to make the VM enter the BIOS setup at the next boot.</p>
<p>Problem: VMware Fusion 3.0 doesn&#8217;t give a way to edit the virtual network settings via the GUI.<br />
Solution: To change the subnet used by the NAT or HostOnly networks, go root in Mac OS X and edit<br />
<code><br />
/Library/Application Support/VMware Fusion/networking<br />
</code><br />
and set the following lines to the subnets desired:<br />
<code><br />
answer VNET_1_HOSTONLY_SUBNET 192.168.35.0<br />
answer VNET_8_HOSTONLY_SUBNET 10.10.1.0<br />
</code><br />
To add additional custom isolated host only VLANs, also edit the networking file and add additional VNET definitions. There can apparently only be 8 VLANs with VLAN 1 and 8 already pre-defined.<br />
<code><br />
answer VNET_2_DHCP no<br />
answer VNET_2_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_2_HOSTONLY_SUBNET 10.10.21.0<br />
answer VNET_2_VIRTUAL_ADAPTER yes<br />
answer VNET_3_DHCP no<br />
answer VNET_3_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_3_HOSTONLY_SUBNET 10.10.22.0<br />
answer VNET_3_VIRTUAL_ADAPTER yes<br />
answer VNET_4_DHCP no<br />
answer VNET_4_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_4_HOSTONLY_SUBNET 10.10.23.0<br />
answer VNET_4_VIRTUAL_ADAPTER yes<br />
</code><br />
Now create your vm with as many network interfaces as you have separate VLANs (vnet) then edit the node.vmx vm configuration file and change the interfacename.connectionType to custom, and define the VLAN (vnet) that interface will attach to:<br />
<code><br />
#ethernet0.connectionType = "nat"<br />
ethernet0.connectionType = "custom"<br />
ethernet0.vnet = "vmnet3"<br />
</code><br />
Also realize that VMware will take the .1 host address on each vmnet &#8211; so you cannot assign .1 to any of your VMs.</p>
<p>Problem: Ubuntu 9.10 persistent network configuration (stores the MAC address of network adapters), so if you copy a machine, by default Ubuntu will setup a new logical adapter (eth1) since the MAC address has changed (when you answer I Copied It in VMware).<br />
Solution: Tell VMware you copied the machine, so it will chose a unique MAC address. Boot Ubuntu into single user mode (another article on that to follow) then edit the MAC address associated with eth0.<br />
<code><br />
sudo vi /etc/udev/rules.d/70-persistent-net.rules<br />
</code><br />
find the stanza of the network interface in question (NAME=&#8221;eth0&#8243;) and set the following ATTR tag to the new MAC address:<br />
<code><br />
ATTR{address}=="new-mac-address-here"<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.networkforensics.us/2009/10/building-a-web-security-lab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MythTV FC7 LVM on RAID1 Configuration</title>
		<link>http://www.networkforensics.us/2009/05/mythtv-fc7-lvm-on-raid1-configuration/</link>
		<comments>http://www.networkforensics.us/2009/05/mythtv-fc7-lvm-on-raid1-configuration/#comments</comments>
		<pubDate>Fri, 15 May 2009 14:48:38 +0000</pubDate>
		<dc:creator>edhacker</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[mythtv]]></category>
		<category><![CDATA[pvr]]></category>

		<guid isPermaLink="false">http://blog.networkforensics.ca/blog/?p=37</guid>
		<description><![CDATA[MythTV PVR HDD Mirroring 2008/07/24 Host: n43 (mythtv) - Two SATA 500GB drives sda sdb - current production drive is sdb Problem: I&#8217;ve done migrations of LVM2 volumes from 320GB SATA to 500GB SATA and added a redundant 500GB SATA. Now I want to get software RAID 1 setup to protect the root, swap and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MythTV PVR HDD Mirroring 2008/07/24</strong><br />
Host: n43 (mythtv)<br />
- Two SATA 500GB drives  sda  sdb<br />
- current production drive is  sdb</p>
<p>Problem:  I&#8217;ve done migrations of LVM2 volumes from 320GB SATA to 500GB SATA and added<br />
a redundant 500GB SATA.  <strong>Now I want to get software RAID 1 setup to protect the<br />
root, swap and /storage filesystems from damage if/when one of the shiny new 500GB SATA<br />
disks bite the dust.</strong></p>
<p>Followed howtoforge.com linux_lvm_p1 (start of article) to free up sda from LVM<br />
volume group VolGroup00 .. http://www.howtoforge.com/linux_lvm_p7</p>
<p><strong>0. Did a file level backup to the fileserver:</strong><br />
[root@n59 20080724]# ssh   <script type="text/javascript"><!--
 &lt;! 
 var prefix = '&amp;#109;a' + 'i&amp;#108;' + '&amp;#116;o';
 var path = 'hr' + 'ef' + '=';
 var addy10473 = 'r&amp;#111;&amp;#111;t' + '&amp;#64;';
 addy10473 = addy10473 + '192' + '&amp;#46;' + '168' + '&amp;#46;' + '1' + '&amp;#46;' + '2';
 document.write( '&lt;a ' + path + ''' + prefix + ':' + addy10473 + ''&gt;' );
 document.write( addy10473 );
 document.write( '&lt;/a&gt;' );
 // &gt;n
// --></script><a href="mailto:root@192.168.1.2">root@192.168.1.2</a><script type="text/javascript"><!--
 &lt;! 
 document.write( '&lt;span style='display: none;'&gt;' );
 // &gt;</p>
<p>// --></script><span style="display: none;">This e-mail address is being protected from spambots, you need JavaScript enabled to view it  <script type="text/javascript"><!--
 &lt;! 
 document.write( '&lt;/' );
 document.write( 'span&gt;' );
 // &gt;</p>
<p>// --></script></span> &#8220;tar cf &#8211; /lib&#8221; | dd of=mythtv-lib.tar<br />
(repeat for /boot /storage /var /etc /home)</p>
<p><strong>1. Free up sda2 LVM volume.  I know this volume is not used anymore,<br />
but it still has same-disk backup of /storage from when I was tweaking<br />
MythTV.</strong></p>
<p>[root@mythtv ~]# pvmove /dev/sda2<br />
[root@mythtv ~]# vgreduce /dev/VolGroup00 /dev/sda2<br />
[root@mythtv ~]# pvremove /dev/sda2</p>
<p>- now running on sdb only -</p>
<p>Setup RAID 1 mirroring (md)<br />
&#8211;<br />
<strong>2. Partition sda for mirroring (Auto RAID label)</strong><br />
[root@mythtv ~]# fdisk /dev/sda<br />
&lt;delete partitions&gt;<br />
&lt;add primary 1 whole disk&gt;<br />
&lt;set flag to fd &#8211; Auto RAID&gt;</p>
<p>[root@mythtv ~]# fdisk -l</p>
<p>Disk /dev/sda: 500.1 GB, 500107862016 bytes<br />
255 heads, 63 sectors/track, 60801 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sda1   *           1          19      152586   83  Linux<br />
/dev/sda2              20       60801   488231415   fd  Linux raid autodetect</p>
<p>Disk /dev/sdb: 500.1 GB, 500107862016 bytes<br />
255 heads, 63 sectors/track, 60801 cylinders<br />
Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
/dev/sdb1   *           1          19      152586   83  Linux<br />
/dev/sdb2              20       60801   488231415   8e  Linux LVM</p>
<p>Notice that sdb is still using only LVM, not RAID.</p>
<p><strong>3. Setup md devices &#8211; sdb is &#8216;missing&#8217; &#8211; its still in use for LVM so &#8216;missing&#8217;<br />
keyword is used.</strong></p>
<p>[root@mythtv ~]# mdadm &#8211;create /dev/md0 &#8211;auto=yes -l 1 -n 2 /dev/sda2 missing<br />
mdadm: array /dev/md0 started.</p>
<p><strong>4. Prepare new md volume for LVM</strong></p>
<p>[root@mythtv ~]# pvcreate /dev/md0<br />
Physical volume &#8220;/dev/md0&#8243; successfully created</p>
<p><strong>5. Now extend the VolGroup00 vg to include the new md LVM volume</strong></p>
<p>[root@mythtv ~]# vgextend VolGroup00 /dev/md0<br />
Volume group &#8220;VolGroup00&#8243; successfully extended</p>
<p><strong>6. Now move data from /dev/sdb2 to LVM volume md0</strong><br />
[root@mythtv ~]# pvmove /dev/sdb2 /dev/md0</p>
<p>&lt;long time&gt;</p>
<p><strong>7. Now we remove the sdb2 volume from LVM</strong><br />
[root@mythtv ~]# vgreduce VolGroup00 /dev/sdb2<br />
[root@mythtv ~]# pvremove /dev/sdb2</p>
<p><strong>8. Now we format /dev/sdb with fd (Linux RAID autodetect):  (make it sdb1)</strong><br />
Same as sda.<br />
<strong><br />
9. Next add /dev/sdb2 to /dev/md0</strong></p>
<p>[root@mythtv ~]# mdadm &#8211;manage /dev/md0 &#8211;add /dev/sdb2<br />
<strong><br />
10. Now the RAID array will be synchronized. This will take some time, you can check with</strong></p>
<p>[root@mythtv ~]# cat /proc/mdstat</p>
<p><strong>11. Update initrd BEFORE you reboot</strong><br />
If no /etc/mdadm.conf exists, you may choose to create it.  It appears that I needed to<br />
do that AND rebuild my initrd to support LVM on RAID1 during boot.</p>
<p>echo &#8220;DEVICE /dev/hd*[0-9] /dev/sd*[0-9]&#8221; &gt; mdadm.conf<br />
mdadm &#8211;detail &#8211;scan &gt;&gt; mdadm.conf</p>
<p>mkinitrd -f /boot/initrd-`uname -r`.img `uname -r`</p>
<p><strong>12. Copy /boot over to sda &#8211; gets the new initrd (although /dev/sdb1 is still<br />
labeled BOOT, so it is the partition that will be mounted as /boot)<br />
</strong>[root@mythtv ~]# mke2fs /dev/sda1<br />
mke2fs 1.40.2 (12-Jul-2007)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=1024 (log=0)<br />
Fragment size=1024 (log=0)<br />
38152 inodes, 152584 blocks<br />
7629 blocks (5.00%) reserved for the super user<br />
First data block=1<br />
Maximum filesystem blocks=67371008<br />
19 block groups<br />
8192 blocks per group, 8192 fragments per group<br />
2008 inodes per group<br />
Superblock backups stored on blocks:<br />
8193, 24577, 40961, 57345, 73729</p>
<p>Writing inode tables: done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 22 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.</p>
<p>[root@mythtv ~]# mkdir /tmp/newboot<br />
[root@mythtv ~]# mount /dev/sda1 /tmp/newboot/<br />
[root@mythtv ~]# cd /boot<br />
[root@mythtv boot]# find . -print | cpio -pvmd /tmp/newboot<br />
/tmp/newboot/./vmlinuz-2.6.22.4-65.fc7<br />
/tmp/newboot/./config-2.6.22.4-65.fc7<br />
/tmp/newboot/./initrd-2.6.21-1.3194.fc7.img<br />
/tmp/newboot/./System.map-2.6.21-1.3194.fc7<br />
/tmp/newboot/./initrd-2.6.22.4-65.fc7.img<br />
/tmp/newboot/./System.map-2.6.22.4-65.fc7<br />
/tmp/newboot/./lost+found<br />
/tmp/newboot/./grub<br />
/tmp/newboot/./grub/device.map.old<br />
/tmp/newboot/./grub/jfs_stage1_5<br />
/tmp/newboot/./grub/device.map<br />
/tmp/newboot/./grub/ufs2_stage1_5<br />
/tmp/newboot/./grub/e2fs_stage1_5<br />
/tmp/newboot/./grub/xfs_stage1_5<br />
/tmp/newboot/./grub/stage2<br />
/tmp/newboot/./grub/splash.xpm.gz<br />
/tmp/newboot/./grub/grub.conf<br />
/tmp/newboot/./grub/fat_stage1_5<br />
/tmp/newboot/./grub/vstafs_stage1_5<br />
/tmp/newboot/./grub/grub.conf.dist<br />
/tmp/newboot/./grub/stage1<br />
/tmp/newboot/./grub/menu.lst<br />
/tmp/newboot/./grub/reiserfs_stage1_5<br />
/tmp/newboot/./grub/iso9660_stage1_5<br />
/tmp/newboot/./grub/minix_stage1_5<br />
/tmp/newboot/./grub/ffs_stage1_5<br />
/tmp/newboot/./config-2.6.21-1.3194.fc7<br />
/tmp/newboot/./vmlinuz-2.6.21-1.3194.fc7<br />
25716 blocks<br />
[root@mythtv boot]# cd /<br />
[root@mythtv /]# umount /tmp/newboot</p>
<p><strong>13. If you&#8217;ve mucked around with the hd ordering in grub, undo it now:</strong><br />
Grub configuration:<br />
# grub<br />
grub&gt; device (hd0) /dev/sda<br />
grub&gt; device (hd1) /dev/sdb<br />
grub&gt; root (hd0,0)<br />
grub&gt; setup (hd0)</p>
<p><strong>14. Reinstall grub to ensure initrd references in grub are updated</strong><br />
[root@mythtv ~]# /sbin/grub-install /dev/sda<br />
[root@mythtv ~]# /sbin/grub-install /dev/sdb</p>
<p>NOTE: I haven&#8217;t taken this to the fall back filesystems or having the<br />
/boot filesystem on a RAID1 volume yet, but one should be able to enable<br />
RAID1 for /boot now (create md1 == /dev/sda1 and /dev/sdb1 and setup an ext2 fs<br />
on md1 to hold the RAID1 protected /boot fs). Haven&#8217;t tested<br />
that yet, but did get that to work in earlier 2.6.x kernels (Debian and Fedora).</p>
<p><strong>15. Hold breath, have Fedora Core 7 Rescue disk ready, Reboot</strong></p>
<p><strong>16. Celebrate.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.networkforensics.us/2009/05/mythtv-fc7-lvm-on-raid1-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
