Use dmidecode or wmic bios to remotely get serial numbers from your servers or from a PC that is buried under a desk etc.
For Linux/Unix use dmidecode and for Windows use wmic bios.
#dmidecode | grep “Serial Number”
c:\wmic bios get serialnumber
Run either command without arguments and you get much more than just serial numbers, for example you can get motherboard details and bios versions. If you are running some generic system it might not have a serial number available but Dell, HP, etc should return the info.
This is my Beer Fueled general purpose Sys Admin Blog, no fancy stuff just the fixes and other relevant things I come across as a Sys Admin. If there are better ways to handle some things I write about please share.
Monday, July 30, 2012
Sunday, July 29, 2012
Mount foreign LVM partition from USB drive to recover a VM
Ok got the urge to play Riven but couldn't install it on a Windows 7 64bit system since it is an old 32bit game. No biggie I kind of suspected that so I decided to go Virtual. My Win7 system is the Home version and it does not have XP mode available so I settled on Oracle Virtual Box. I loaded Virtual Box and was just getting ready to break out the 32bit XP install disk when I decided to make the job harder than it needed to be.
Just a few months ago on the same PC I was running Fedora 16 on a 1TB disk that was dual partitioned for Linux EXT3/LVM2 and NTFS. Since then the system was rebuilt with a new Drive running Win7 64bit. I was also running Virtual Box on the Fedora 16 system and had a fully configured XP VM already setup and updated to that point in time. So instead of starting from scratch I decided to see if I could get that VM off the old Fedora system.
I put the old drive in one of those USB Drive docks and hooked it to my Win 7 system then tried to access it via a couple versions of Linux Live running on a Virtual Box vm but had no luck in mounting the partitions so I decided to use my full time Fedora 17 system to do the job.
On my Fedora 17 system I hooked up the USB drive had some problems seeing the new drive so I rebooted and all was well. To get to the files I needed to get into the lvm partition on the disk. So here are the steps based on LVM2 (LVM1 slightly different):
#pvscan with this command I could verify that I can see the old lvm and what name it had
In my case pvscan returned my target as vg_fedormedia on /dev/sde5
To import the volume group you need to export and import the group.
#umount /dev/blah/blah First it needs to be unmounted which mine was not.
#vgchange -an vg_fedormedia Marks the group as inactive
#vgexport vg_fedormedia Exports the group
#vgimport vg_fedormedia Imports the group
#vgchange -ay vg_fedormedia Activates the group
Now I was ready to mount the directory holding my XP VM
#mkdir /mnt/oldXP
#mount /dev/vg_fedormedia/lv_home /mnt/oldXP
Once mounted I could navigate to the target folder and there was my XP VM. Now I needed to copy the VM to removable media. Since the drive in the usb-dock drive was dual partitioned with NTFS I decided to copy the VM to the NTFS partition. Fedora had already mounted the NTFS partition so all I had to do was use Nautilus to copy from the mounted directory to the NTFS partition and I was done. Essentially what I did was copy the VM off the linux partition on the drive back to the NTFS partition on the same drive.
After that I unmounted the old home and deactivated the volume group
#umount /dev/vg_fedormedia/lv_home
# vgchange -an vg_fedormedia (not sure if that was necessary but did all the same.)
In all it took about 30-40 minutes to get the 7gig VM off the old drive and copied back to the NTFS partition and another 8 minutes or so to copy it to the Win 7 box. This still saved me the many hours it would take to build a new XP VM and download all the updates.
To import the XP VM into Virtual Box:
Start a new VM make sure it is set to Windows and XP give a name (must be different than the the VM you are importing or you get an error).
Set the RAM, 1024M in my case
Select use existing Hard Disk navigate to the folder where located select and create.
Done
Just a few months ago on the same PC I was running Fedora 16 on a 1TB disk that was dual partitioned for Linux EXT3/LVM2 and NTFS. Since then the system was rebuilt with a new Drive running Win7 64bit. I was also running Virtual Box on the Fedora 16 system and had a fully configured XP VM already setup and updated to that point in time. So instead of starting from scratch I decided to see if I could get that VM off the old Fedora system.
I put the old drive in one of those USB Drive docks and hooked it to my Win 7 system then tried to access it via a couple versions of Linux Live running on a Virtual Box vm but had no luck in mounting the partitions so I decided to use my full time Fedora 17 system to do the job.
On my Fedora 17 system I hooked up the USB drive had some problems seeing the new drive so I rebooted and all was well. To get to the files I needed to get into the lvm partition on the disk. So here are the steps based on LVM2 (LVM1 slightly different):
#pvscan with this command I could verify that I can see the old lvm and what name it had
In my case pvscan returned my target as vg_fedormedia on /dev/sde5
To import the volume group you need to export and import the group.
#umount /dev/blah/blah First it needs to be unmounted which mine was not.
#vgchange -an vg_fedormedia Marks the group as inactive
#vgexport vg_fedormedia Exports the group
#vgimport vg_fedormedia Imports the group
#vgchange -ay vg_fedormedia Activates the group
Now I was ready to mount the directory holding my XP VM
#mkdir /mnt/oldXP
#mount /dev/vg_fedormedia/lv_home /mnt/oldXP
Once mounted I could navigate to the target folder and there was my XP VM. Now I needed to copy the VM to removable media. Since the drive in the usb-dock drive was dual partitioned with NTFS I decided to copy the VM to the NTFS partition. Fedora had already mounted the NTFS partition so all I had to do was use Nautilus to copy from the mounted directory to the NTFS partition and I was done. Essentially what I did was copy the VM off the linux partition on the drive back to the NTFS partition on the same drive.
After that I unmounted the old home and deactivated the volume group
#umount /dev/vg_fedormedia/lv_home
# vgchange -an vg_fedormedia (not sure if that was necessary but did all the same.)
In all it took about 30-40 minutes to get the 7gig VM off the old drive and copied back to the NTFS partition and another 8 minutes or so to copy it to the Win 7 box. This still saved me the many hours it would take to build a new XP VM and download all the updates.
To import the XP VM into Virtual Box:
Start a new VM make sure it is set to Windows and XP give a name (must be different than the the VM you are importing or you get an error).
Set the RAM, 1024M in my case
Select use existing Hard Disk navigate to the folder where located select and create.
Done
Red Hat Satellite Server satellite sync fails DATA_TBS
I was running a satellite-sync on a Red Hat Satellite Server v5.4 when I ran into an Oracle error: 'ORA-01654: unable to extend index ... in tablespace DATA_TBS'. Turns out that I needed to extend the DATA_TBS table in Oracle, which was an easy fix.
I picked up the info at http://www.redhat.com/magazine/023sep06/features/tips_tricks/?intcmp=bcm_edmsept_007
You should backup the database first but since this satellite-server is a VMWare VM I simply snapshot the server first.
First kill all satellite related processes, this also stops Oracle: #rhn-satellite stop
Once the shutdown is done restart oracle then su to the oracle user:
#service oracle start
#su - oracle
Then run a db-control report:
$db-control report
The DATA_TBS table had only 200M space so I decided to grow that to over a gig. There probably is a correct size but a short search in Red Hat docs did not make it clear. The extend command only adds about 500M at a time to the tablespace so I ran it a couple times then exited from oracle’s login:
$db-control extend DATA_TBS
$exit
After that was accomplished I restarted rhn-satellite. Since oracle was already running a Bitchin-Betty message appeared saying satellite might have crashed, this can be ignored:
#rhn-satellite start.
I picked up the info at http://www.redhat.com/magazine/023sep06/features/tips_tricks/?intcmp=bcm_edmsept_007
You should backup the database first but since this satellite-server is a VMWare VM I simply snapshot the server first.
First kill all satellite related processes, this also stops Oracle: #rhn-satellite stop
Once the shutdown is done restart oracle then su to the oracle user:
#service oracle start
#su - oracle
Then run a db-control report:
$db-control report
The DATA_TBS table had only 200M space so I decided to grow that to over a gig. There probably is a correct size but a short search in Red Hat docs did not make it clear. The extend command only adds about 500M at a time to the tablespace so I ran it a couple times then exited from oracle’s login:
$db-control extend DATA_TBS
$exit
After that was accomplished I restarted rhn-satellite. Since oracle was already running a Bitchin-Betty message appeared saying satellite might have crashed, this can be ignored:
#rhn-satellite start.
Saturday, July 28, 2012
How to Hide a Drive in Windows 7
I needed to hide a drive from users on a Win7 baseline This will probably work on other Windows versions as well if they support the policy.
To hide a drive from users edit this group policy
User Configuration> Administrative Templates> Windows Components > Windows Explorer>
Click "Hide these specified drives in My Computer" then pick the option you want in the drop-down box.
This only hides the drive in "My Computer/Explorer" and a determined user can get to the drive if they want so make sure you have permissions set correctly. For me the main goal was to just not make it easy for users to see the drive.
To hide a drive from users edit this group policy
User Configuration> Administrative Templates> Windows Components > Windows Explorer>
Click "Hide these specified drives in My Computer" then pick the option you want in the drop-down box.
This only hides the drive in "My Computer/Explorer" and a determined user can get to the drive if they want so make sure you have permissions set correctly. For me the main goal was to just not make it easy for users to see the drive.
Can't Boot Windows 7 After Clonezilla Re-image
After re-imaging a Dell laptop with Clonezilla I could not get it to boot. I have used the same Win7 image on many systems so I knew it was good.
The first thing I did was boot to a Windows 7 rescue disk and let it try to auto fix the problem which ended up making it worse. I should have checked the BIOS setting and active partition first as described next and then I think Windows would have rebooted no problem. But when I ran the auto fix it rewrote the BCD file based on bogus info and broke it.
Here are the steps I used to troubleshoot and fix:
Verified the SATA settings in the BIOS, turned out it was set to RAID and should have been AHCI. After the BIOS fix I still could not boot so I ran the Win7 Rescue disk auto-repair again which failed. From there I called up the repair console command window. First thing I checked was whether the boot partition was active with diskpart At the prompt type diskpart and enter then you will be in a diskpart console with a '>' prompt
>list disk
Tells you what disks and their id number starting at disk 0
>select disk 0
Selects your target disk
>list partition
Tells you what partitions are on the drive in my case 2. I had a larger system partition which was partition 1 and a very small boot (BCD) partition which was partition 2.
>select partition 2
Selects your target partition
>detail partition
Gives details about the partition including whether it is hidden or active. In my case the partition was visible but not active. I needed to set it to active
>active
This is what you type to set the partition active
>exit quit or whatever
At this point a reboot and now Windows 7 tried to boot and failed so I went into recovery mode. I let it try to auto fix the system but it failed so back to the command line.
Aat the command line I tried these steps:
BOOTREC /FIXMBR result good
BOOTREC /FIXBOOT result good
BOOTREC /SCANOS bad total identified windows installations 0
BOOTREC /REBUILDBCD bad total identified windows installations 0
This did not work so I decided to look at the boot configuration using bcdedit
at the command line type bcdedit and enter
Results something like this:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>bcdedit
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume2
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {0542b908-aad8-11e1-a78f-ce537be42191}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
Windows Boot Loader
-------------------
identifier {current}
device partition=D:
path \Windows\system32\winload.exe
description Windows 7
locale en-US
inherit {bootloadersettings}
recoverysequence {0542b90a-aad8-11e1-a78f-ce537be42191}
recoveryenabled Yes
osdevice partition=C:
systemroot \Windows
resumeobject {0542b908-aad8-11e1-a78f-ce537be42191}
nx OptIn
In my case I found that the Windows boot loader was pointing to d: not c:. I knew it should be c: so I used bcdedit to fix.
Bcdedit /set {Default} device partition=C:
Once done I rebooted successfully to Win7
Done
Here are the steps I used to troubleshoot and fix:
Verified the SATA settings in the BIOS, turned out it was set to RAID and should have been AHCI. After the BIOS fix I still could not boot so I ran the Win7 Rescue disk auto-repair again which failed. From there I called up the repair console command window. First thing I checked was whether the boot partition was active with diskpart At the prompt type diskpart and enter then you will be in a diskpart console with a '>' prompt
>list disk
Tells you what disks and their id number starting at disk 0
>select disk 0
Selects your target disk
>list partition
Tells you what partitions are on the drive in my case 2. I had a larger system partition which was partition 1 and a very small boot (BCD) partition which was partition 2.
>select partition 2
Selects your target partition
>detail partition
Gives details about the partition including whether it is hidden or active. In my case the partition was visible but not active. I needed to set it to active
>active
This is what you type to set the partition active
>exit quit or whatever
At this point a reboot and now Windows 7 tried to boot and failed so I went into recovery mode. I let it try to auto fix the system but it failed so back to the command line.
Aat the command line I tried these steps:
BOOTREC /FIXMBR result good
BOOTREC /FIXBOOT result good
BOOTREC /SCANOS bad total identified windows installations 0
BOOTREC /REBUILDBCD bad total identified windows installations 0
This did not work so I decided to look at the boot configuration using bcdedit
at the command line type bcdedit and enter
Results something like this:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>bcdedit
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume2
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {0542b908-aad8-11e1-a78f-ce537be42191}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30
Windows Boot Loader
-------------------
identifier {current}
device partition=D:
path \Windows\system32\winload.exe
description Windows 7
locale en-US
inherit {bootloadersettings}
recoverysequence {0542b90a-aad8-11e1-a78f-ce537be42191}
recoveryenabled Yes
osdevice partition=C:
systemroot \Windows
resumeobject {0542b908-aad8-11e1-a78f-ce537be42191}
nx OptIn
In my case I found that the Windows boot loader was pointing to d: not c:. I knew it should be c: so I used bcdedit to fix.
Bcdedit /set {Default} device partition=C:
Once done I rebooted successfully to Win7
Done
Labels:
bcdedit,
boot,
bootrec,
Clonezilla,
rescue disk,
Windows 7
Sunday, July 8, 2012
Fedora 17 XFCE Desktop Corrupt
Out the blue applications lost the maximize, close, reduce buttons in the top right of Window. New terminal Windows start at top left of screen and can't be moved.
The chooser applet at the bottom of screen was gone and the 4 desktop buttons were gone. Also terminal windows and menu options in all apps would loose focus the second the mouse was moved so I could not type in a command window or pick a menu option A quick Google gave a quick answer to the fix. I got a crippled terminal window opened and typed:
$sudo xfwm4
And the problem was fixed The command instantly fixed the issues but there were some residual error messages that I ignored since my goal was met.
xfwm4 is the xfce window manager and "is responsible for the placement of windows on the screen, provides the window decorations and allows you for instance to move, resize or close them."http://docs.xfce.org/xfce/xfwm4/introduction"
$sudo xfwm4
And the problem was fixed The command instantly fixed the issues but there were some residual error messages that I ignored since my goal was met.
xfwm4 is the xfce window manager and "is responsible for the placement of windows on the screen, provides the window decorations and allows you for instance to move, resize or close them."http://docs.xfce.org/xfce/xfwm4/introduction"
Subscribe to:
Comments (Atom)