Backup Basics in Windows Server 2008 R2

A miễn phí tool from Microsoft can make backing up data in Windows Server 2008 R2 efficient and almost hassle-miễn phí. Here's how to use it effectively.

Baông xã in the day, Microsoft"s không tính tiền backup tool was the now venerable NTBackup. However, that utility has gone lớn the great recycle bin in the sky.

Windows Server 2008 offers a new set of backup tools, and I want lớn show you how easy it is to use them with the new Windows Server 2008 R2. Be aware that the new backup feature can"t manage backups created with NTBackup.

InstallationFirst off, we need to lớn install the backup feature, as it"s not installed by mặc định. Use the Add Features wizard in Server Manager and add the Windows Server Backup Features (Figure 1). I"m going to lớn use the command-line tools sub-feature so that I can use Windows PowerShell, which I will explain in more detail later in this article.

You can also use command-line tools, including ServerManagerCMD.exe pháo, lớn install the feature:

C: servermanagercmd -install backup-features

Figure 1.

Bạn đang xem: Hướng dẫn cấu hình windows server backup

The backup feature is not installed by mặc định, so you must install it using the Add Features Wizard.

Xem thêm: Cách Khắc Phục Lỗi Idm Không Bắt Link Tải File, Tải Video, Tải Nhạc

The next step is lớn identify locations for your backups. You can bachồng up files to a network nói qua, a local volume or a dedicated disk. You can"t baông chồng up data to tape, but given the growth and widespread availability of inexpensive USB-attached storage, this isn"t that much of a setbaông xã these days.

Creating a Backup JobWindows Backup is intended to lớn provide a one-stop thiết lập to lớn protect a hệ thống. You can enable a scheduled task to lớn baông xã up files & the system state, or to lớn provide for a bare-metal restore. Microsoft assumes you"ll have one scheduled task for this purpose. I"m assuming that you"re using the Windows Backup feature because of limited budget & are after maximum protection given the utility"s constraints.

After you install the Windows Backup feature, expand the Storage node in Server Manager và select Windows Server Backup. In the Actions pane, select "Backup Schedule," which will start the Backup Schedule Wizard. Then, cliông chồng Next on the Getting Started screen.

During step two, specify what type of backup you want. Try doing a complete server backup. You can also create a custom backup và piông chồng items such as selected files & system state. I"ll show you how to vày a quichồng tệp tin backup later, but for now I"m assuming you want complete VPS protection.

In the third step, specify when you want the backup task lớn run. Most of the time, a single backup should be sufficient, but you can run it more than once a day. If you"re backing up critical files, this might be a good choice.

In step four, determine where lớn store the backup. Microsoft recommends using a dedicated hard disk. Remember, this drive sầu will be reformatted and unavailable for anything else. You can also use a volume or a network cốt truyện. Pay cthua thảm attention to lớn the warnings and limitations. You might see a warning reminding you that the disk will be reformatted. If you don"t see all the disks, clichồng the Show All Available Disks button to refresh. When you select a new disk, you"ll be warned.

Once selected, you"ll have sầu a chance khổng lồ confirm your backup settings. If anything is incorrect, use the Previous button to lớn go baông xã & correct the error. If all goes well, you should get a summary screen. The next day, you can check the Windows Server Backup node for results or errors.

You can also use Windows Backup khổng lồ run a one-time backup. Select the Backup Once option in the Actions pane. You can use the same settings as your scheduled job or pichồng something completely different. If you select the latter, the wizard runs again và you can enter new parameters. For example, you might want lớn copy files lớn a network nội dung. Remember, any existing backups to lớn the same folder will be overwritten. The backup will exeđáng yêu immediately. If this is a separate backup task you"d like to bởi often, then you"ll want lớn take advantage of a scripted solution from the command line or Windows PowerShell. I"ll cover that procedure later.

Restoring DataWindows Backup uses a time stamp as version information. Using the Recover task launches a wizard that"s easy khổng lồ follow. Select the appropriate backup source. The Recovery Wizard will display a datetime control of all available backups (see Figure 2). Select the appropriate one. Depending on the type of backup, you may only have once choice.

Figure 2. Data recovery is easy with the Recovery Wizard.

Moving on, select what type of data you want lớn recover. If you select Files và Folders, you"ll be able lớn highlight the files you want to lớn recover. Unfortunately, selecting files from multiple directories is next lớn impossible. You can easily recover everything or recover selected files from one directory. Keep that in mind when you set up the backup job.

When you recover files, you"ll need lớn specify the target thư mục, which can be the original folder or an alternate location. You can also control what happens when you restore a current tệp tin if a current version exists. You can create a copy so that you have sầu both versions; you can overwrite the existing version; or you can skip restoring if an existing version is detected. The recovery process happens immediately.

Using WBADMIN.EXEIf you installed the commvà backup tools, then you have sầu a few more options. xuất hiện a command prompt & look at help for WBADMIN.EXE. You can use the tool to lớn phối up a scheduled backup, but I think the GUI is much easier. I find this tool more useful for creating one-time backup jobs. Run the following comm& to lớn see syntax help:

C:> wbadmin start backup /?I don"t have space lớn cover all the options, but let me demonstrate how you might use the command-line tool to lớn periodically bachồng up files to lớn a network share:

eđến off::Demo-Backup.bat::demonstration script using WBADMIN.EXE on a Windows Server 2008 R2 Serverrem backup chia sẻ UNCphối backupshare=\mycompany-dc01ackuprem files & folders to lớn includephối include=c:scripts,c:filesrem define date time variables for building the folder namemix m=%date:~4,2%mix d=%date:~7,2%set y=%date:~10,4%phối h=%time:~0,2%mix min=%time:~3,2%phối sec=%time:~6,2%rem defining a new folder like \mycompany-dc01ackupRESEARCHDC12152009_132532phối newfolder=%backupshare%\%computername%\%m%%d%%y%_%h%%min%%sec%emang lại Creating %newfolder%mkdir %newfolder%rem run the backupecho Backing up %include% lớn %newfolder%wbadmin start backup -backuptarget:%newfolder% -include:%include% -quietrem Clear variablesset backupshare=phối include=mix m=set d=phối y=mix h=phối min=mix sec=set newfolder=I don"t want lớn overwrite any existing backups, so I"ll create a new thư mục that uses the computer name & a datetime stamp as part of the file name. The batch file has code to handle that task. The main function of the script is khổng lồ Hotline WBADMIN.EXE lớn create a backup on the specified tóm tắt. Look at syntax help if you want lớn tweak this step. I lượt thích this script because I can phối up my own scheduled task using the Task Scheduler. So, even though the backup wizard only lets me create one scheduled task, I can create as many as I want using WBADMIN.EXE. I can also use this tool to create system state backups, as well.

To see what backup jobs have executed, run this command:

C:> wbadmin get versionsPay attention to the version identifier; you"ll need it khổng lồ recover files using WBADMIN (you can also use the Recovery Wizard).

Backing up with PowerShellThe other command-line approach is lớn use Windows Backup PowerShell cmdlets. To access them, you"ll first need to load the Windows backup snap-in:

PS C:> add-pssnapin Windows.ServerBackupTo see which cmdlets are included, use Get-Command:

PS C:> get-command -pssnapin windows.server backupUnfortunately, creating a backup job is a multistep process. While you can type the necessary commands at the prompt interactively, I think you"ll find it easier with a scripted approach. Here"s a PowerShell version of my original batch file:

#requires -version 2.0#requires -pssnapin Windows.ServerBackup#Demo-WBBackup.ps1$policy = New-WBPolicy$files=new-WBFileSpec c:scripts,c:filesAdd-wbFileSpec -policy $policy -filespec $files$backdir=("\mycompany-dc01ackup1:MMd dyyyy_hhmmss" -f $env:computername,(get-date))write-host "Creating $backdir" -foregroundcolor Greenmkdir $backdir | out-null$backupLocation = New-WBBackupTarget -network $backdir Add-WBBackupTarget -Policy $policy -Target $backupLocationwrite-host "Backing up $files to lớn $backdir" -fore groundcolor Green$policyStart-WBBackup -Policy $policyThe PowerShell cmdlets are based around creating & executing a policy. The policy includes the files or volumes to lớn include or exclude, as well as where to lớn baông xã up the files & a few assorted options. You can also create system-state & bare-metal recovery jobs. In my demonstration, I"m simply backing up a few directories. The Start-WBBackup cmdlet carries out the backup task.

When you look at the danh sách of Windows Backup cmdlets, you"ll notice one glaring omission. There are no cmdlets for restoring data. I imagine the assumption is that you wouldn"t want to automate this step, although you can with WBADMIN.EXE. Perhaps cmdlets will be added in the future. In the meantime, you can use the Recovery Wizard or WBADMIN.EXE khổng lồ restore files.

Your TurnAs you try your hvà at these tools, I"m sure you"ll realize there"s a great khuyễn mãi giảm giá more that Windows Backup brings to the buổi tiệc nhỏ. As with any backup software, make sure you practice the restore process in a non-production setting. You don"t want to learn the process when you have khổng lồ recover for real and your trùm is breathing down your neck. Become familiar with the process so that when the time comes, you kết thúc up being the anh hùng.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation & efficiency. He is a multi-year recipient of the Microsoft MVP. Award in Windows PowerShell. He works today as an independent author, trainer và consultant. Jeff has written for numerous online sites và print publications, is a contributing editor at Petri.com, & a frequent speaker at giải pháp công nghệ conferences và user groups.