Shrink Linux LVM volume

The drive must not be booted (boot from a live CD)

Run lvs to check the name of the volumes and volume groups and their sizes.

[root@freepbx ~]# lvs
LV          VG                     Attr LSize Pool Origin Data% Move Log Cp y%Sync Convert
lv_root vg_freepbx -wi-ao—- 17.54g
lv_swap vg_freepbx -wi-ao—- 1.97g

Initiate (or what have you) the VG

vgchange -a y

check the file system

e2fsck -f /dev/<volume group>/<logical volume>

e.g. e2fsck -f /dev/vg_freepbx/lv_root

Resize the filesystem – but make this number 10% smaller than what you actually want. (e.g. put 8G for 8GB if you want to end up with 10GB)

resize2fs /dev/vg_freepbx/lv_root 8G

Reduce the LV size (use the actual amount you want)

lvreduce -L 10G /dev/vg_freepbx/lv_root

Expand the file system to the maximum possible size.

resize2fs /dev/vg_freepbx/lv_root

Set up Windows Deployment Services WDS

Set up the server OS and install the WDS role.

Go through the initial set up process. You need to take the d:sourcesboot.wim file from a Windows installation disc to create the boot image.

There are some other steps that I can’t remember.

Once that’s done, you have to right click the server name in the WDS console, Properties, Advanced, and register the DHCP server in Active Directory.

To slipstream network drivers, download and extract the driver file so you get the .inf.

Right click Drivers in the left pane, Add Driver Package…, then find the inf file. You can add to a driver group, doesn’t really matter.

Then, go to the Boot Images, right click your boot image, click Add Driver Packages to Image, then click the Search for Packages button. Find the driver in the lower pane, click next and stuff. Then that’s done.

That’s the setup image done. To create a capture image, right click the boot image, click Create Capture Image, then in the path box, type a new path. It should be in the c:remoteinstallimages etc…folder, same as the existing boot.wim that has been created, but give it a new name (capture.wim).

If the capture file fails to boot, error 0xc000000f in winload.exe, then mount the WIM on the server and commit the changes as detailed below.

Mount the WIM file with the command

dism /mount-wim /wimfile:<path to capture WIM> /mountdir:<create a temporary directory first> /index:1

Unmount the WIM file, committing changes (even though you didn’t make any) with the command

dism /unmount-wim /mountdir:<temp path> /commit

60% of the time, it works every time. Actually, it has worked 2 out of 2 times for me. Why they have this stupid problem, I don’t know, but they do.

Once you’ve created the capture image, create an Install Image group. Boot to the capture image, connect to the server and choose image group, then specify a local drive where the image can be saved. I used an external hard drive.

Reset AD password from PowerShell

Set-ADAccountPassword ‘CN=<User’s Full Name>,OU=something,DC=corp,DC=domain,DC=com’ -Reset -NewPassword (ConvertTo-SecureString -AsPlainText “YourPasswordHere” -Force)

You can get the full CN/OU/DC path by running Get-ADUser <username>

Slipstream Windows updates into installer

Download the MSU from the Windows Update Catalog website.

Extract the contents of the Windows disc into a folder.

The file into which you’ll slipstream is sourcesinstall.wim

Mount the WIM with the following instructions. Create a directory first, like c:mount, where the WIM will be mounted. Then mount the WIM. Example: dism /mount-wim /wimfile:”C:\Users\chris\Desktop\win7pro\sources\install.wim” /mountdir:c:mount /index:1

  1. MD 
    DISM /Mount-Wim /WimFile:  /Index:  /MountDir: 
  2. Apply the update package (.msu) file by typing the following at a command prompt, replacing with the directory your image is mounted to and with the full path of the update file:
    DISM /image:  /Add-Package /Packagepath: 
    dism /image:C:\Mount /add-package /packagepath:"C:Users\chris\Desktop\Update for Windows 7 for x64-based Systems (KB3125574)\updateblahblah.msu"
  3. You’ll see “Processing 1 of 1 – Adding package” for a while.
  4. Unmount the image and commit your changes by typing the following at a command prompt, replacing with the directory your image is mounted to:
    DISM /Unmount-Wim /MountDir:  /Commit

*Update: It didn’t work. I’m trying something else now.

Another update is required to be installed/slipstreamed before the cumulative update will work.

I had to do this:

expand -f:* “C:Users\chris\Desktop\Update for Windows 7 for x64-based Systems (KB3125574)\Windows6.1-KB3020369-x64.msu”

Then add it to the image like this:

dism /image:C:\Mount /add-package /

Deployment Image Servicing and Management tool
Version: 10.0.10586.0

Image Version: 6.1.7600.16385

Processing 1 of 1 – Adding package Package_for_KB3020369~31bf3856ad364e35~amd64~~
The operation completed successfully.

THEN do the same thing (expand and add package using the CAB file) with the cumulative update. That reported success.


Dism /Unmount-Image /MountDir:C:\mount /commit

Secure erase a hard drive – ATA Secure Erase

  1.  Boot into any kind of Linux
  2. Run hdparm -I /dev/sda where /dev/sda is the device to be wiped
  3. At the end of the output, look for this:
    1. Security:
      	Master password revision code = 65534
      	not	enabled
      	not	locked
      	not	expired: security count
      		supported: enhanced erase
    2. If you see frozen, this process will not work. Try putting the system to sleep and then waking it up again, then run the above command again. If it says NOT frozen, then you’re good to go.
  4. Run this command to set the password
    sudo hdparm --user-master u --security-set-pass Password /dev/sda

    Bold text is a password you create.

  5. As long as you don’t see SECURITY_SET_PASS: Input/output error, it worked.
  6. Run
    time hdparm --user-master u --security-erase Password /dev/sda

    to start the process.

  7. Once it’s done, you’ll see the time listed afterwards, i.e.
    real 69m29.540s

Run gparted and make sure there are no partitions listed to be certain that the erasure was successful.

Create a free website or blog at

Up ↑