How To: Move WSUS Database and Content Directory

Having been implemented before my time the server on which the WSUS \Content volume resides ran out of space the other day. This of course needed to be rectified as soon as possible and the only way to do so in my case was to move the database over to another partition on the same drive (the location it should have been installed on in the first place). However in order to do so I first needed to move the WSUS contents folder and then the susdb database itself. The following are notes on the process that I took as it's likely something that will likely come in handy again sooner rather than later.

Movement of the WSUS Content Folder

The best way to proceed is to use the movecontent command of WSUSutil.exe, a command-line tool that is copied to the file system of the WSUS server during WSUS Setup. By default, Setup copies WSUSutil.exe to the following location:

WSUSInstallationDrive:\Program Files\Microsoft Windows Server Update Services\Tools

You must be a member of the local Administrators group on the WSUS server to use the movecontent command of WSUSutil.exe, and these operations can only be run from the WSUS server itself which must be a 32-bit platform. You must also create the new path for local WSUS update storage prior to using WSUSutil.exe.

The movecontent command takes an optional -skipcopy parameter which enables you to change the location of local WSUS update storage without copying any files. To change the location of local WSUS update storage complete the following steps:

1. Click Start, and then click Run.
2. In the Open box, type cmd, and then click OK.
3. At the command prompt, navigate to the directory that contains WSUSutil.exe as listed above.
4. Type the following, and then press ENTER:

wsusutil.exe movecontent contentpath logfile [-skipcopy]

For example, if E:\WSUS is the new path for local WSUS update storage and D:\move.log is the path to the log file (as is the case with my new partition) and you wanted to copy the old files to the new location, you would type:

wsusutil.exe movecontent D:\WSUS1\ D:\move.log

    Moving the SUSDB Database

    The SUSDB is by default located in the SQL Server Express Instance. In order to open this we first have to stop a few services.

    1. Click Start, and then click Run.
    2. In the Open box, type services.msc, and then click OK.
    3. Navigate to and stop each of the running services; Update Services, Update Services Notifications amd IIS Administration (with WWW-Publishing and HTTP-SSL).

    Once these services have been stopped opne SQL Server Management Studio Express and enter the following into the 'Server name' path.

    "Servername": \\.\pipe\mssql$microsoft##ssee\sql\query


    Find the SUSDB database under 'Databases' from where you will need to detach the database. You'll notice that once you have detached the database it will vanish from the left-hand tree structure. It is only now safe to move the two database files SUSDB.mdf and SUSDB_log.ldf to their new location.



    Once you have moved the two database files it is time to re-attach them by using the below database query. From the SQL Server Management Studio Express menu click on the 'Databases' folder in the left hand tree structure and then select 'New Query' from the main menu. In the new tab screen that pops up enter the below database query and execute by clicking on the 'Execute' button from the main menu. Start the services that we stopped above and and go to the WSUS Console to make sure that everything is back to normal, that's it...

    use master
    go
    sp_attach_db‚SUSDB','E:\WSUSNEW\SUSDB.mdf','E:\WSUSNEW\SUSDB_log.ldf'
    go

    1 comment:

    1. This won't work because you can't move the contents without having access to the database first. If you try to move the contents you will get the below.

      Content move failed. Please refer to the log file for more details.
      Fatal Error: Cannot open database "SUSDB" requested by the login. The login failed.

      ReplyDelete