windows - Permanently lock or remove disk partition

07
2014-07
  • mohamed87

    I have a 320GB hard drive and after testing it I found that the first 20GB have many bad sectors, and the rest of the disk is healthy. Now I want to sell it to a friend, I will format it and install windows myself. Here I will create a 20GB partition that will not be used and it will be hidden. But what if my friend tries to reinstall it himself. He will overwrite the partitions and get windows files written on the bad sectors.

    Now, is there a way to permanently lock/hide the 20GB partition to prevent access to it even with a new installation of windows?

    Thank you.

  • Answers
  • smc

    As far as I know what can be programmatically blocked, can later be programmatically unblocked provided user has enough technical knowledge and spare time.

    Any software method you will use to block the corrupt area of the disk can later be overridden.

    If you hide the partition using DiskPart, your friend can use DiskPart to unhide it If you leave the space unpartitioned your friend can use Disk Management to create a volume.

    Your best bet is to repartition the disk so that the area with bad sectors are left out as unpartitioned space and explicitely explain the situation to your friend to make sure he does not try to use it. It is only 20 GB after all.

  • Rod Smith

    A disk with bad sectors is not reliable. Modern disks have the capacity to transparently map out a handful of bad sectors -- as many as are deemed acceptable in terms of manufacturing defects, etc. When the number of bad sectors exceeds that value, it means that the disk is on its last legs. Although the disk might last a significant period of time without having the bad sectors spread, it's just as likely, if not more so, that new bad sectors will appear in the near future.

    You say you plan to sell the disk to a friend of yours. If he's really your friend, you won't do so; instead, you'll wipe the disk of sensitive data and take it somewhere for recycling. At this point, it's really only safe as raw materials. (Of course, that leaves aside the question of the environmental and social impacts of "recycling" of electronics as it's often done today, but that's another matter.)

  • arielnmz

    You can indeed hide those sectors, but that won't prevent the disk to continue failing. You can create a new partition table, which effectively wipes all the information on the drive, and make a partition that starts at 20GB and goes up to the end of the disk, but there's no way to prevent your friend to create a new partition that starts at the very beginning of the drive and thus, discovering the bad sectors.

    But anyway, if you insist; I suggest you use a proper tool, like GParted. Just burn the ISO to a disk (or make a bootable USB stick) and boot from it. It requires some knowledge about filesystems and partition tables, and how to operate this application.


  • Related Question

    hard drive - How to image a Windows partition so I can browse the files later?
  • haferje

    My laptop's current setup dual boots into Windows XP and Linux Mint. The harddrive seems to be going bad, so I want to backup all the data from the Windows partition.

    This laptop was a loyal servant for my 5 years in college for Computer Science, and as you can imagine, I have a lot of development files spread across all parts of the filesystem, so picking and choosing directories to copy to my thumbdrive will be very time consuming.

    My ideal solution would be to create an image of the partition on an external harddrive, in a way so that I can later browse the files, should i ever need to find some old code files I had written.

    It seems that my two options are to either create a disk image that I can later restore on another machine (via Clonezilla, DriveImage XML, TrueImage, or Ghost) , or create a virtual image where I can later mount in a virtual machine (via VirtualBox, VMWare, Virtual PC).

    My question is: Can I create a partition image in a way that I can simply browse and run file searches on the file structure, without having to reload/restore the entire OS on another machine, load the entire image in a virtual machine, or extract the entire .iso file in a program like MagicISO, each time I want to access it? I just want to jump right in to view the files. I do not expect to write to the image - only read from.

    Thanks for reading!!


    UPDATE:

    the path I have chosen thus far is to use the linux 'dd' tool (as recommended by Gilles). the reason is because I tried to install on my Windows partition Macrium Reflect and DriveImage XML or creating an image, and Disk2vhd for creating a virtual/mountable harddisk, but windows craps out on me when I do certain tasks related to explorer.exe and other processes. this is obviously due to the failing drive. the only downside is that I have to do this from a live Linux Mint disk, as the linux partition on the laptop won't even load because of corrupt/dirty disk sectors - a problem i once circumvented to obtain some files long ago, but don't have time to deal with now. which brings me to the task of having to monitor the two hour process each couple of minutes so the live cd screensaver doesn't come on and crap out the entire process... (oy vey!)

    for anyone who wants to know, this is the command line process i put together:

    create a mount location

    sudo mkdir /mnt/usbdrive
    

    find the location of my external usb harddrive (sdb1)

    sudo fdisk -l
    

    mount it as a drive

    sudo mount /dev/sdb1 /mnt/usbdrive
    

    perform the backup command, disregarding any errors

    sudo dd if=/dev/sda2 of=/mnt/usbdrive/sda2.image bs=16M conv=noerror
    

    in another terminal window, while 'dd' is working, we can trigger the process to spit out status updates every 2 minutes:

    watch -n 120 sudo pkill -USR1 dd
    

    Thanks for all the suggestions, and Happy Linux-ing! :)


  • Related Answers
  • Gilles

    If you create a raw image of the partition as a file, you can mount it later from Linux as if it was a partition:

    mount -o loop partition.image /mnt
    

    This won't (easily) work if you have a compressed image.

    By the way one way (out of many!) to create the image from Linux is

    dd if=/dev/sda1 of=/media/usb/sda1.image bs=16M
    

    where /dev/sda1 is the partition you want to back up (fdisk -l lists your partitions, make sure you select the right one), /media/usb is where the external drive you're backing up to is mounted, and bs=16M says how much to copy in one go and is only there for efficiency.

  • deed02392

    I would highly recomend using Microsoft's free imaging tool imagex, it will grab all the files, and you can mount the image later and make changes if need be.

    From WinPE:

    imagex /capture d: d:\imaging\data.wim "Drive D" /verify
    

    Then to mount:

    imagex /mount d:\imaging\data.wim 2 c:\mounted_images
    

    see below for more info and examples:

    http://technet.microsoft.com/en-us/library/cc749447(v=ws.10).aspx

  • Neal

    I wouldn't bother with an image but would create a folder on the external hard drive and copy everything from the Windows partition into it. You could either not bother copying or delete the \Windows and \Program Files and any other unneeded directories.

    Alternatively, how about just whacking the whole partition into a zip file if space is at a premium (how long would it take to open the zip?), the zip file managers I use allow one to look at a single file within the whole.

  • barlop

    Norton Ghost can. You use Ghost Explorer http://service1.symantec.com/support/on-technology.nsf/docid/2001110808002125?Open&src=w

    No doubt acronis trueimage can (since many people prefer it to Ghost)

    Maybe the other ones you mention can too. Including freeware ones.

  • Moab

    I use Acronis to do exactly what you want, the image created can be mounted as a drive letter in Windows Explorer, files and folders can then be read or copied, even modified within the image if needed.

    http://www.acronis.com/homecomputing/products/trueimage/index.html