image_alt_text

Archive for the 'Windows' Category

22

Feb/10

Separating User & Windows On Different Drives

Monday, February 22nd, 2010

Overview

I wanted to have the Windows partition and the user partition on separate drives. I have done this in the past on a Linux computer and it was very painless.

The advantage to this setup is that most of the personal data such as things stored in My Documents, My Music, etc and the Windows specific stuff like installed programs, patches, etc are stored on a separate partition whether it’s on the same or different drive. This degree of separation allows the Windows partition to be wiped and started fresh without affecting the personal files.

I had time during my fresh install to play about with various setups and have listed the options in the following section.

Be aware that not all programs store settings/preferences in the user directory so this is no replacement

I am not responsible for any damage or problems caused by the below procedure.

Final note is that I tried many combinations but some how managed to get it to work. Whilst the steps may not be 100% correct it should be a good guideline to see the process through. I shall update it should I come across it again.

Prerequisites

Before starting ALWAYS ALWAYS back up all the necessary files. Even though this design is suppose to negate the need to back it is still advised to backup in case something goes wrong.

Have a Windows 7 Install CD and CD Key ready.

Time!

Mounting Options

  1. Mounting a drive to a directory – I was very keen on using this technique when I saw in the Disk Management utility. It sounds like the method used in Linux and would make it fairly transparent to the user.
  2. Separate sub directories within users – This option makes it very simple to do because Windows 7 has the option of moving all the directories under the users one such as Pictures, Music, Search, etc. Just specify the new location and Explorer will move the files creating the directory along the way and taking care of permissions.
  3. Change the %UserProfile% in the registry so that it is pointing to another drive.

Mounting A Drive To A Directory

This was my first choice so I wiped my system and went about to do this. The steps described in the superuser website are as follows:

1. You boot with the install media.
2. At the screen with the “Install Now” choose “Repair your computer”
3. You will be asked if you want to “Repair and Restart” by the System Recovery options, choose “No”.
4. Then Make sure that Windows 7 is listed as one of the installed OS’s available for recovery, it’s selected and them press next.
5. You will be given a list of recovery tools, chose “Command Prompt”.
6. In the command prompt you will be using Robocopy to copy c:\Users to d:\Users
7. Type robocopy c:\Users d:\Users /mir /xj
8. /mir tells robocopy to mirror the directories, this will copy all files and permissions.
9. /xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.
10. Make sure no files failed to copy (FAILED column = 0).
11. Remove the old Users Folder from the c: drive: rmdir /S /Q C:\Users
12. Create a NTFS Junction that points to the new Users folder: mklink /J C:\Users D:\Users

The problem with the above method is the drives letters in recovery mode may not be using the correct drive letters when in normal Windows. For example drive C: is the windows drive and drive Z: was the user drive. In recover mode it generally assigns drive letters incrementally so in order to get the drive to mount on Z: the user drive needs to be on the 24th SATA port. This is unrealistic.

Also after performing those steps you would find the user to be locked out because of the user mapping has changed. To fix this boot into safe mode and login and do the following steps outlined in Nigel’s blog

What now? Well I found additional registry entries with REGEDIT under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

There was 1 line for each profile. Crucially if a profile is bad there are 3 things worth checking
a) Ensure the key name doesn’t end in “.bad”
b) Ensure the RefCount value is 0
c) Ensure the State value is 0

Having gone through all those steps it made the OS unstable. I’m not sure if it’s a hardware issue but there seemed to be long seek times or Windows was taking a lot longer to follow the symbolic link. Whilst it worked, it hangs and long load times was not acceptable to me.

Separate Sub Directories Within Users

This is the easiest setup and I started with using this as my solution when the above method did not work for me. The problem with this was that it left the user directory e.g C:\Users\Danny on the same drive as the Windows partition and I do use that directory (as well as my Desktop which can be mapped to another drive) as my dumping ground. Not totally satisfied I found a workable solution described below.

Change the %UserProfile%

This is the final approach I took. It worked in the end but there was a lot of confusion when I did it but I ended up with the result I wanted.

Before changing the variable the files must be copied to the new drive. To do this I used the above method of dropping into command line, copying the files to the new location. Follow steps the steps in Mounting A Drive To A Directory section. Before closing the registry edit the attribute ProfileImagePath in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList to the path of the new user directory. Reboot and it should be done.

Summary

Whilst the last method worked. I’d like to go through it again to ensure the steps are correct but I’m sure it more or less sums it up. I’m happy I got the result I wanted but wished the symbolic link worked. I’m looking at separating the install directories as well such as the typical C:\Program Files directory so that the Windows partition only contains Windows related files.


Mount second drive as c:/Users in Windows 7.

Fixing User Profiles in Vista

16

Feb/10

WordPress 2.9.2

Tuesday, February 16th, 2010

Minor update to WordPress.

12

Feb/10

NFS Server

Friday, February 12th, 2010

Overview

Network File Share (NFS) is a protocol for sharing storage. It is quite common in Network Attached Storage (NAS) devices and is a standard compared to Samba which is Microsoft specific but has been ported to Linux.

Install NFS Server

Install the relevant software:
sudo apt-get install nfs-kernel-server nfs-common portmap

Configure NFS Server

Configuring NFS server is relatively simply. Edit the file /etc/exports file and add all the directories available as a share. The format should be as follows

/media/cdrom 192.168.0.1/24(rw,async)

  • mount point on local system.
  • host
  • permissions
  • Using the above string this would share the CDROM to any computer with the IP range 192.168.0.1-192.168.0.254 that has read and write permissions and requests can be process asynchronously.

    Specific IPs can be given to each share like this:

    /media/cdrom 192.168.0.1(rw,async) 192.168.0.1(ro,async)

    Computer 192.168.0.1 has the permissions described in the above example and the computer with 192.168.0.2 only has asynchronous requests and read only access to files for that share.

    When specifying mount points note where the spaces are and are not because spaces are read by the system so

    /media/cdrom 192.168.0.1 (rw,async)

    is invalid because there is a space between the IP address and the parenthesis.

    Once all the shares have been configured it is necessary to restart NFS to see the changes:
    sudo /etc/init.d/nfs-kernel-server restart

    Mount NFS Share On Linux

    Install the NFS client if the computer does not have a NFS server itself:
    sudo apt-get install portmap nfs-common

    To mount the share manually from the terminal type the following:
    sudo mount 192.168.0.1:/media/cdrom /media/share
    First is super user command sudo then mount command, IP address of NFS server followed by the path to share. The last parameter is the local mount point so in the above example it will mount the CDROM drive from the server onto /media/share directory of the client computer.

    To make the mount more permanent edit the /etc/fstab file and the following line, one for each NFS share.

    192.168.0.1:/media/cdrom /media/share nfs rsize=8192,wsize=8192,timeo=14,intr

    The only part that needs to be changed is the IP address, NFS share point and the mount point. This is highlighted in bold in the example above. The rest should be fine left as is. This change should mount the share when the computer is started.

    Mount NFS Share On Windows 7 Ultimate Edition

    NFS support does not come as standard with Windows so it has to be installed. Also I only found the feature in Windows 7 Ultimate Edition and not the Professional. I believe there is a Business Edition in between but do not know if it has the support for NFS.

    Go to the Control Panel and on the left hand side click on Turn Windows features on or off hyper link. It will load a list of software in a tree / node structure. Find Services for NFS and tick Client for NFS as a minimum.

    On the start menu right click on Network and select Map network drive. If this option is not in the start menu go to Computer and right click on Network from the left hand panel. A wizard will start for mapping a network drive.

    Select the drive letter to be assigned to the NFS share and for the Folder enter the address [server]:[path] for example 192.168.0.1:/media/cdrom
    Tick Reconnect at logon if you want it to connect on start up and click Finish to end the wizard.

    The only problem with mounting the NFS on Windows is every time Computer it takes a longer to scan and load the drives because it scans the NFS to get the size and amount used on the NFS.

    Summary

    NFS between Linux machines is perfect and a good way to share files. Mounting a NFS makes the local share look as if it was it was local drive.

    For Windows I’d stick to using Samba because it doesn’t take a while to scan the shared drive every time the drive is highlighted to get the drive information such as amount of space available. It’s not a nice to administer two services doing the same thing but it works.

    NFS Server and Client Configuration in Ubuntu

    11

    Feb/10

    Change MAC Address In Windows

    Thursday, February 11th, 2010

    It is possible to spoof the MAC address in Windows without going into the registry.

    The network will go down during this process so it’s best to stop or wait till all downloads or any other network related activity has stopped.

    Right click on Computer and select Manage.

    Go to Device Manager on the left hand side list to display all the hardware usually categorised by type. Drill down into Network adapters and select the Network Interface to be changed.

    Right click on the Network card and select Properties.

    Go to the Advanced tab and look for Network Address in the Property: list. In some cases if this property is not listed it can be added in from the same window. Selecting the Network Address will change the right hand side to what can be changed. By default this is set to Not Present. To enter a custom MAC address select the Value radio button and enter in the MAC address with no spaces or colons in the textbox provided. OK all the windows to accept the changes. To undo this change simply change the selection of the radio buttons from Value to Not Present.

    The optional steps below allows a reserved IP address to be re-assigned to the new MAC address.
    Either restart of go to Start Menu > Run…. type in cmd and press enter. A DOS window should appear. type in ipconfig /release to disconnect all network adapters and ipconfig /renew to get a new IP.

    How to Change or Spoof MAC Address in Windows XP, Vista, Server 2003/2008, Mac OS X, Unix and Linux

    27

    Jan/10

    Windows 7 Monitor Power Test

    Wednesday, January 27th, 2010

    There is a report generator in Microsoft Windows 7 which can help you track down what is being used in terms of power. The report tells you what is stopping the computer going into sleep mode (if sleep mode is turned on) as well as devices that do not “suspend”.

    Go to the command line as an administrator. This can be achived by going to Start Menu and typing cmd in the search bar. Search for cmd.exe under Programs, hold Shift key and right click on cmd.exe. At this point you can let go of the shift key and select Run as administrator.

    A dialogue box may warn you when starting the the program but OK it to start the program. Type:
    powercfg -energy
    and press enter to start it. The program will monitor your computer for 1 minute. In this time do what you wish.

    Once it has finished it will print out the location of the report which is in a HTML (web page) format. You may need to copy to a suitable folder for your browser to open it.

    Tekzilla Daily Tip #511