Bios Password

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, March 1, 2009

Partition and Disk Management: Part I – Dancing with Diskpart

Posted on 12:15 PM by Unknown

Sometimes I find myself on a technical issue and end up puzzling it out.

The aftermath finds me overwhelmed with linkage.  Sometimes due to the interrelatedness of the issues, I struggle a bit to get it all organized in a logical manner.

I’m having to “punt” this time and do another multi-part post.

This isn’t intended to be a end-all post series regarding Windows hard disk partitioning, but the deeper I become involved at work with disk-image deployments, whole-disk encryption, and secure data-wiping, I also seem to come back to partition and disk-management.

In the Beginning…

As part of the workplace response to Hurricane Ike smashing into our region some time ago, our disaster response was to obtain and deploy a large number of laptops for mobile data-processing support.

When their need had passed, the laptops were returned and needed to be secure wiped, repartitioned, imaged, and returned to their original owners.

That should have been a fairly easy process.  The only “complication” was that I had to deal with mass-quantities of them.

So to save time, I used my custom Win PE 2.0 boot USB stick, fired up DiskPart.exe (part of the Win2K/XP/Vista System32 components) and planned on following my usual routine:

        1. Diskpart
        2. select disk 0
        3. clean all
        4. create partition primary
        5. select partition 1
        6. active
        7. assign letter = C
        8. exit

Followed up by a final

format C: /fs:ntfs /q /y

And then an ImageX session dumping a sysprepped WIM image on them.

Only this time when I got to step 6 I got the following error:

DISKPART> assign letter = c

DiskPart has encountered an error: The directory is not empty.
See the System Event Log for more information.

I kept going back and forth deleting the partition, re-cleaning the disk, recreating the partitions but got nowhere.  That same crazy error.  I was completely stumped as no data should be on the disk/partition. 

As far as I knew, that “clean all” command should have zero’ed out the disk.

Granted, in the past I normally did only a “clean” command and not a “clean all” but I wanted to zero-out these drives as they were leaving our purview and I wanted to be be sure any confidential customer data was scrubbed and irrecoverable.

I really like using DiskPart for these tasks, even though it is CLI since it is fast and always at hand as part of the WinPE system files.

I had a quick turnaround required on these systems so I just pulled my GParted boot cd, booted each system, made some notes and observations, then used it to successfully recreate my NTFS partitions and move on to the imaging phase.  GParted made it a piece of cake and seemed to care less about any issues I was having in DiskPart with rebuilding the partition information and formatting them in NTFS.

I set the issue aside figuring it must be something strange with Dell system drives and the “clean all” command.

Months later….

Time allowed me last week to go back and try to study this issue some more due to concerns I had noted on the Dell drives related to the GParted work.  More on that in Part II.

I was servicing another laptop and going through the wipe, re-partition, and re-image process when I ran into the error yet again.

This time I had more time (and patience) to try to understand what was going wrong.

Let’s pick up after I had cleaned the sole system hard-drive (Disk 0) following steps 1-3 listed previously.  Note: Disk 1 is my bootable WinPE 2.0 boot USB flash drive, and Disk 2 is a USB portable hard-drive that contains my various system images.  Disk 0 was already selected and the focus (as noted by the asterisk in DISKPART output).

DISKPART> list disk

  Disk ###  Status      Size     Free     Dyn  Gpt
  --------  ----------  -------  -------  ---  ---
* Disk 0    Online        56 GB    56 GB
  Disk 1    Online      7872 MB      0 B
  Disk 2    Online       298 GB      0 B

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> active

DiskPart marked the current partition as active.

DISKPART> assign letter = c

DiskPart has encountered an error: The directory is not empty.
See the System Event Log for more information.

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> select volume 1

Volume 1 is the selected volume.

DISKPART> detail partition

Partition 1
Type  : 06
Hidden: No
Active: Yes

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1                      RAW    Partition     56 GB  Healthy

DISKPART> select volume

Volume 1 is the selected volume.

DISKPART> detail volume

  Disk ###  Status      Size     Free     Dyn  Gpt
  --------  ----------  -------  -------  ---  ---
* Disk 0    Online        56 GB      0 B

Read-only              : No
Hidden                 : No
No Default Drive Letter: No
Shadow Copy            : No
Dismounted             : No
BitLocker Encrypted    : No

Volume Capacity        :   56 GB
Volume Free Space      :   56 GB

DISKPART> delete volume

DiskPart successfully deleted the volume.

DISKPART> list disk

  Disk ###  Status      Size     Free     Dyn  Gpt
  --------  ----------  -------  -------  ---  ---
* Disk 0    Online        56 GB    56 GB
  Disk 1    Online      7872 MB      0 B
  Disk 2    Online       298 GB      0 B

DISKPART> list partition

There are no partitions on this disk to show.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D                       DVD-ROM         0 B  No Media
  Volume 2     C   USBBOOTSTICK   NTFS   Removable   7872 MB  Healthy
  Volume 3     E   MYIMAGESUSB  NTFS   Partition    298 GB  Healthy

DISKPART> list disk

  Disk ###  Status      Size     Free     Dyn  Gpt
  --------  ----------  -------  -------  ---  ---
* Disk 0    Online        56 GB    56 GB
  Disk 1    Online      7872 MB      0 B
  Disk 2    Online       298 GB      0 B

(At this point I realized what was happening, why the error was happening, and took a very simple action.)

DISKPART> rescan

Please wait while DiskPart scans your configuration...

DiskPart has finished scanning your configuration.

DISKPART> list disk

  Disk ###  Status      Size     Free     Dyn  Gpt
  --------  ----------  -------  -------  ---  ---
  Disk 0    Online        56 GB    56 GB
  Disk 2    Online       298 GB      0 B

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> active

DiskPart marked the current partition as active.

DISKPART> assign letter = c

DiskPart successfully assigned the drive letter or mount point.

DISKPART> exit

Leaving DiskPart...

X:\windows\system32>format c: /fs:ntfs /v:system /q /y

The type of the file system is RAW.
The new file system is NTFS.
QuickFormatting 57229M
Creating file system structures.
Format complete.
  58602492 KB total disk space.
  58534964 KB are available.

Mission Accomplished!

The Solution?

I’m embarrassed to confess, but I wasn’t keeping track of my letters.

See, when I made the decision to boot the system from a bootable USB drive, a RAM disk was created "drive X” from which the WinPE system runs.

It also configured the system to recognized the hosting USB drive as drive letter (volume) “C”, the portable USB hard-drive containing my images as drive letter (volume) “E”, and the system’s internal DVD-ROM drive letter (volume) as “D”.

Note another important lesson in working with DiskPart: when you “list volume” it will output all the volumes that it picks up across found disks, but it will not tell you which volume is associated with which disk.  In the output I captured you can see that.  Even though Disk 0 was my focus, when I ran the command, it listed all volumes.  I’m not sure of a good way to work around that except that in my case, all my disks were of different sizes and thus I “knew” which one went with which drive.

By puzzling on that I realized that drive C: was already claimed.  Since I was working on the RAM disk “X” I didn’t have a need (or so I thought) to care about what the other drive letters were.

I could create a primary partition on the system Disk 0, even set it to “active” all I wanted, however, since I already had a volume labeled “C” DiskPart wouldn’t let me, reporting that the (C) directory wasn’t empty, and confusing the fire out of me with the cryptic message, even though my focus disk was Disk 0.

Since I knew that the WinPE OS was running in memory off the RAM disk, my solution was to just yank the USB flash drive out of the system, rescan for drives (so the “C” would show dropped and available for assignment), then set the drive letter for Disk 0 to “C”.

Problem solved.

A simple format command and I was good to go with the image application.

Had I not been previously in a hurry using my USB drive to boot the systems, and used a WinPE bootCD instead, I might not have had this issue.  I need to go back and test that out.

Regardless, lesson learned here was to keep track of your drive/volume letters at all times when working with DiskPart.

Now, on to those notes I had taken regarding the Dell drives…I still had unfinished business with them…

--Claus V.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in boot-cd's, command-line interface, troubleshooting | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Finally! Time to Post! New material list
    After a recent text from my bro reminding me it has been since March since I’ve done a blog post, I was finally able to clear the schedule a...
  • Oscar watch Linkpost
    Alvis and Lavie are watching the Oscars tonight and I’m along for the ride. I wasn’t able to come even close to getting out some of the pos...
  • New Year’s Day - First Post 2011
    Same day I came out with my first post after a long drought, I fell upon this article Blogging Seems To Have Peaked, Says Pew Report over a...
  • Utility Gumbo
    There’s a lot in this pot.  Probably something everyone can find to enjoy. I’m serving it up tonight out of the back of the truck on the s...
  • iodd : Multi-boot madness!
    Like many computer technicians and responders, I seem to always have at hand a collection of bootable media; CD’s, DVD’s, USB-HDD’s, flash m...
  • Ubuntu 13.10 Upgrade - Lessons Learned & VIDMA utility found
    A few weeks ago a new release of Ubuntu came out. Naturally that meant it was update time! I have been getting pretty good at this now so ...
  • Interesting Malware in Email Attempt - URL Scanner Links
    Last weekend I spent some time with extended family helping confirm for them that their on-line email account got hacked and had been used t...
  • Windows 8 Linkage: A Bit Behind the Ball
    CC attribution: behind the eight ball by Ed Schipul on flickr . OK. Confession time. I’m more than a bit exhausted this weekend. Besides a...
  • Lego MiniFig Extravaganza
    picture clipped from Wired’s clip from Gizmodo clip… Thanks in no small part to the Windows 7 RC release, XPM mode research, and a big “l...
  • This Week in Security and Forensics: Beware the cake!
    Cube Party! image used with permission from John Walker at "rockpapershotgun.com" Yeah, the cake is a Portal thing.  Let’s d...

Categories

  • Active Directory
  • anti-virus software
  • Apple
  • architecture
  • art
  • AVG
  • Blogger
  • blogging
  • books
  • boot-cd's
  • browsers
  • cars
  • cell-phones
  • cheat sheets
  • Chrome/Chromium
  • command-line interface
  • cooking
  • crafts
  • crazy
  • curmudgeon
  • DHC
  • Dr. Who
  • E-P1
  • Education
  • family
  • Firefox
  • firewalls
  • For the Gentleman
  • forensics
  • Gmail
  • Google
  • graphics
  • hacks
  • hardware
  • humor
  • hurricanes
  • imagex
  • Internet Explorer
  • iOS
  • iPhone
  • iPod
  • iTunes
  • Kindle
  • Learning
  • Link Fest
  • Linux
  • malware tools
  • Microsoft
  • movies
  • music
  • networking
  • NewsFox
  • NFAT
  • Nook
  • Opera
  • organization
  • PDF's
  • photography
  • politics
  • PowerShell
  • recipes
  • Remote Support
  • RSS
  • science
  • Scripting
  • search engines
  • security
  • Shuttle SFF
  • software
  • Texana
  • Thunderbird
  • troubleshooting
  • TrueCrypt
  • tutorials
  • utilities
  • VBscript
  • video
  • Virtual PC
  • virtualization
  • viruses
  • Vista
  • Vista mods
  • wallpapers
  • Win FE
  • Win PE
  • Win RE
  • Windows 7
  • Windows 8
  • Windows Home Server
  • Windows Live Writer
  • Windows Phone
  • writing
  • XP
  • XP mods
  • Xplico

Blog Archive

  • ►  2013 (83)
    • ►  November (8)
    • ►  October (8)
    • ►  September (14)
    • ►  August (6)
    • ►  July (10)
    • ►  June (10)
    • ►  April (11)
    • ►  March (6)
    • ►  February (7)
    • ►  January (3)
  • ►  2012 (96)
    • ►  December (8)
    • ►  November (4)
    • ►  October (9)
    • ►  September (8)
    • ►  August (12)
    • ►  July (4)
    • ►  June (3)
    • ►  May (7)
    • ►  April (13)
    • ►  March (3)
    • ►  February (5)
    • ►  January (20)
  • ►  2011 (41)
    • ►  December (8)
    • ►  November (7)
    • ►  September (4)
    • ►  August (4)
    • ►  July (2)
    • ►  June (6)
    • ►  March (5)
    • ►  February (1)
    • ►  January (4)
  • ►  2010 (69)
    • ►  December (1)
    • ►  October (3)
    • ►  September (2)
    • ►  August (13)
    • ►  July (17)
    • ►  June (3)
    • ►  May (3)
    • ►  April (3)
    • ►  March (11)
    • ►  February (1)
    • ►  January (12)
  • ▼  2009 (177)
    • ►  December (20)
    • ►  November (11)
    • ►  October (7)
    • ►  September (7)
    • ►  August (21)
    • ►  July (17)
    • ►  June (7)
    • ►  May (18)
    • ►  April (9)
    • ▼  March (17)
      • IT Phone Home: PC Auditing to Go
      • Windows FE “Live CD” Posts Followup
      • Blocking IE 8 "InPrivate" Mode – Updated
      • A “Suddenly it’s Sunday” Linkfest
      • Windows FE: Forensically Sound?
      • GSD How To: Dual Boot Windows 7 on Vista via VHD file
      • Custom WinPE Building: Post-Script and PE 3.0
      • GSD’s Weekly Briefs…the clean ones
      • WIM tool enhancements and Fiddling with VHD’s
      • Last Gasp Linkpost: Security/Forensics, Microsoft,...
      • File and Registry Change Watchers
      • System Stress Testing Suites
      • Partition and Disk Management: Part V – HDD Sector...
      • Partition and Disk Management: Part IV – Secure Wi...
      • Partition and Disk Management: Part III – Pesky De...
      • Partition and Disk Management: Part II – Free and ...
      • Partition and Disk Management: Part I – Dancing wi...
    • ►  February (23)
    • ►  January (20)
  • ►  2008 (35)
    • ►  December (23)
    • ►  November (12)
Powered by Blogger.

About Me

Unknown
View my complete profile