Pages

Monday, 18 February 2013

Grub Appendix Commands


Use caution when following the built in help information - it is based on GNU GRUB and contains some legacy commands (and information) that do not always apply to Grub4dos. The following example is the output from typing help default -
grub> help default
default: default [NUM ¦ 'saved' ¦ FILE]
   set the default entry to entry number NUM (if not specified, it is 0,
   the first entry), or to the entry number saved by savedefault if the
   key word 'saved' is specified, or to the entry number previously saved
   in the specified file FILE. When FILE is specified, all subsequent
   'savedefault' commands will save default entry numbers into FILE.
Although the default [NUM] parameter works within a configuration file, using default saved does not. In addition the default [FILE] command only works with the default file included in the grub4dos download - e.g. default /default.
The following (66) commands are all recognised by Grub4dos - version 0.4.4 (build 2009-03-31)

GRUB Embedded Menu

To summarise,
(cd) and (fd) devices are not scanned for either grldr or menu.lst, unless they are the boot device.

If grldr is loaded from a (hd) device via Grub4dos code in the MBR or partition boot sector, then the partition from which it is loaded becomes the root device. This partition is scanned for menu.lst at the root of the partition and in the directories /boot/grub/ and /grub/. If menu.lst is not found in any of these locations then all supported hard disks and partitions are scanned for menu.lst (at root and in /boot/grub/ and /grub/ directories) - (cd) and (fd) devices are not searched. If menu.lst is not found then the device from which grldr was loaded remains the root device. If menu.lst is found then the partition from which it was loaded becomes the root device. menu.lst does not therefore have to be contained in the same partition as grldr.

If grldr is loaded from a (cd) device then (cd) becomes root. (cd) is then scanned for menu.lst (at root and in /boot/grub/ and /grub/ directories). If menu.lst is not present in these location then (hd) devices are scanned (at root and in /boot/grub/ and /grub/ directories) - (fd) devices are not searched. If menu.lst is found on a (hd) device then the partition from which it was loaded becomes the root device.

If grldr is loaded from a (fd) device then (fd) becomes root. (fd) is then scanned for menu.lst (at root and in /boot/grub/ and /grub/ directories). If menu.lst is not present in these location then (hd) devices are scanned (at root and in /boot/grub/ and /grub/ directories) - (cd) devices are not searched. If menu.lst is found on a (hd) device then the partition from which it was loaded becomes the root device.

A note from README_GRUB4DOS.txt if loading grldr via ntldr (the NT loader used by Windows NT/2000/XP) - "...ntldr only loads the startup code of grldr (i.e., the leading 16 sectors of grldr), not the whole grldr file". The embedding settings in the startup code consequently scans for grldr in all supported (hd) type devices. If grldr is present on more than one partition then another instance of grldr could be loaded. If for example grldr (the first 16 sectors) was initially loaded from (hd0,3) but grldr was also present on (hd0,0), then (hd0,0)/grldr would be loaded and (hd0,0) would become root.

If menu.lst is not present on the device from which grldr was loaded but multiple menu.lst files are present on other devices (e.g. on (hd0,0) and (hd1,2)) then the first instance of menu.lst is loaded - in this case (hd0,0).

Sunday, 17 February 2013

Renaming grldr


 http://diddy.boot-land.net/grub4dos/Grub4dos.htm

If loading grldr via the Windows NT/2000/XP loader (ntldr), changing the grldr filename will result in Grub4dos failing to boot. Note from README_GRUB4DOS.txt - "...ntldr only loads the startup code of grldr (i.e., the leading 16 sectors of grldr), not the whole grldr file". The embedding settings in the startup code consequently scans for grldr in all available drives - if the file was renamed it will no longer be found. The following test was carried out on a dual boot system containing Windows Vista on (hd0,0) and Windows XP on (hd0,1). (hd0,1) was set as the active partition and mygrldr (renamed grldr) was loaded via C:\mygrldr="Grub4Dos" entry in boot.ini. This resulted in the following output -
Try (hd0,0): NTFS5: No grldr
Try (hd0,1): NTFS5: No grldr
Try (hd0,3): invalid or null
Try (hd0,4): invalid or null
Try (fd0): invalid or null
Error: Cannot find grldr in all drives. Press Ctrl+Alt+Del to restart._
It is possible to change the embedded setting to search for a different file by using the grubinst/grubutil tool. The procedure is outlined in README_GRUB4DOS.txt -
  • Download the latest version of grubinst/grubutil (see here).
  • Copy grldr to C:\ drive and rename as C:\mygrldr
  • Open a command prompt and run the command grubinst -o -b=mygrldr C:\grldr.mbr - where -b=mygrldr will replace the embedded reference to grldr with mygrldr in the created file C:\grldr.mbr. Note - you can use any name for the file C:\grldr.mbr, however make sure you use the 8.3 naming convention.
  • Now load C:\grldr.mbr from Windows NT/2K/XP by adding C:\grldr.mbr="Grub4Dos" to your boot.ini file.
Alternatively, grubinst/grubutil can be used to edit an existing grldr and/or grldr.mbr file. This will require a compatible version of grubinst.
  • Copy grldr.mbr to C:\ drive and rename this file if required (making sure that you use the 8.3 naming convention). Run the command grubinst -e -b=mygrldr C:\grldr.mbr to replace the embedded reference to grldr with mygrldr. Now add entry C:\grldr.mbr="Grub4Dos" to boot.ini
  • Alternatively, copy grldr to C:\ drive and rename the file to mygrldr. Run the command grubinst -e -b=mygrldr C:\mygrldr to replace the embedded reference to grldr with mygrldr. Now add entry C:\mygrldr="Grub4Dos" in boot.ini
Unfortunately, at the time of testing, the latest version of grubinst (grubinst-1.1-bin-w32-2008-01-01) is not compatible with Grub4dos build 2009-02-05. Running command grubinst -e -b=mygrldr C:\grldr.mbr results in grubinst: Invalid input file error and grubinst -e -b=mygrldr C:\grldr results in grubinst: Version number mismatched (old=4 new=2) error.

Friday, 15 February 2013

Defragmenting boot files under Win7

Rundll32.exe advapi32.dll,ProcessIdleTasks
defrag -b %SystemDrive%
 
save it as batch file and select run as administrator
If you choose to create your own file, DO NOT NAME IT DEFRAG.BAT! 
If you do it will cause the batch file to loop over and over! 

Convert to NTFS

To convert a FAT partition to NTFS, perform the following steps.
  1. Click Start, click Programs, and then click Command Prompt.
  2. At the command prompt, type CONVERT [driveletter]: /FS:NTFS.
  3. Convert.exe will attempt to convert the partition to NTFS.

Disk Defragment Tips


Tips and tricks

  • Many users start looking for defragmentation/optimization programs when their computer becomes slow. The main reason for a slow computer is a full harddisk. A full harddisk is slow because the distance between files is greater than on a fresh practically empty harddisk. Deleting half the data on a full disk will just about double the speed. The more free diskspace, the faster your computer will be.
  • Buy a second harddisk (for example an USB harddisk) and move little used stuff from your primary harddisk to that secondary harddisk. The second disk can also be used for backing up the primary disk.
  • The first partition on a harddisk (usually the C: partition) is significantly faster than other partitions. Place your important programs on this first partition and try to use other partitions only for data that is used less often (such as music, movies, archives, backups, logfiles). From a speed perspective it is best to have only a single partition.
  • When buying a new computer, buy the biggest harddisk you can afford. Investing in a bigger harddisk gives more speed-per-dollar than investing in a faster CPU or investing in more memory. The same amount of data on a bigger harddisk is faster because the data takes up less physical space, so the harddisk heads have to travel less distance.
  • Cleanup old junk from your harddisk before running MyDefrag. You can clean Windows files with for example "Start -> Programs -> Accessories -> System Tools -> Disk Cleanup", or with something like the freeware  *  CCleaner program.
  • Reboot before running MyDefrag. This will release files that are in use, so they can be defragmented and optimized.
  • Boot into Windows safe mode by pressing F8 when booting, and then run MyDefrag. It will be slower because the Windows disk cache is off in safe mode, but MyDefrag will be able to process (a few) more files.
  • Stop your real time virus scanner before running MyDefrag. Some virus scanners check all disk activity, making defragmentation and optimization very slow.
  • Move the swap file to another volume, reboot, defragment, and move the swap file back. If you don't have a second volume then temporarily make the swap file small, for example 100Mb.
  • Package unused files with a packager such as  *  7-zip. The packagefile not only takes less harddisk space, but will also defragment and optimize much faster than the individual files. Note: This does not apply to Windows NTFS compression, which will actually make defragmentation and optimization slower.
  • If you have 2 physical harddisks of the same speed, then place the pagefile on the first partition of the second harddisk. 

Source: http://www.mydefrag.com/Manual-TipsAndTricks.html

Tuesday, 12 February 2013

PE 3.0 to USB

1. Install and configure PStart

 When the installation wizard of PStart asks you about the setup type, you should choose Portable Setup. Select your USB drive and tell the wizard to copy PStart to the root folder. Next, you can launch PStart from your USB drive with Windows Explorer.

2. Launch PStart automatically when WinPE boots up

mkdir c:\img
imagex /mountrw F:\sources\boot.wim 1 c:\img
 

c:\img\windows\system32\startnet.cmd

Add these lines to startnet.cmd after the wpeinit command 

@echo off
for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:\PStart\ set w=%%p
%w%:\PStart\PStart.exe
 

And commit changes to wim

imagex /unmount /commit c:\img

3. Add your own rescue tools

 

Monday, 11 February 2013

Understand Bcdedit

Procedure to understand bcdedit

you have to first create a store(BCD).
Add bootmgr entry.

if you are not mounting anything just specify device and boot to file path.
if you are mounting .wim or .vhd (remember guid) you have to also specify osdevice and its system root folder.

Sunday, 10 February 2013

BCDedit


Examples - Part 1


The BCD Store used to boot the operating system may be in use as the system store - if a system store is in use then this will be the default store on which all bcdedit commands are carried out. If no system store is in use, or to specify a store other than the system store, the /store switch must be used.
I personally recommend using the /store switch whenever modifying a BCD store to reduce the risk of targeting the wrong store. To specify the BCD store D:\Boot\BCD we would use the command bcdedit.exe /store D:\Boot\BCD .....
Before modifying a BCD store I recommend that you create a backup. Be aware that modifying a BCD store could result in your system not booting, I therefore recommend that you take either of the following precautions -
  • Create a BOOTMGR bootable CD/DVD/USB/Floppy with your existing (working) BCD store copied to it. BCD entries (with the exception of any devices set as BOOT) contain disk signature and partition offset information - booting the BCD store from another device will therefore still target the correct device.
  • Create a WinPE bootable CD/DVD/USB disk and use this to replace a non-working BCD store with the backup you made earlier. If you do not have access to WinPE then many Linux Live distributions can also be used.

Administrator Account on Windows 7

First you’ll need to open a command prompt in administrator mode by right-clicking and choosing “Run as administrator” (or use the Ctrl+Shift+Enter shortcut from the search box)

 Enable Built-in Administrator Account
net user administrator /active:yes
 Disable Built-in Administrator Account
net user administrator /active:no