partitioning interview questions

Top partitioning frequently asked interview questions

What utility can move my Windows boot partition over to another hard drive? [closed]

Can anyone recommend a cheap/free utility that can do this without very much effort?

My preference is that it would be really easy.

  • Boot into Windows
  • Pick drive to move
  • Pick target drive
  • It copies everything over, and reboots to the correct partition.

Source: (StackOverflow)

What is the maximum number of partitions that can be made on a hard drive?

What is the maximum number of partitions we can make on hard disk in Windows?

If it is limited to some particular number, why can we assign all the letters C through Z to drives? If it is a special case, what's that?

Source: (StackOverflow)


VirtualBox: using physical partition as virtual drive

Background: I am using VirtualBox installed on Windows 7. From within VirtualBox I am using Xubuntu as a virtual OS. The reason I chose this approach is so that I don't have to keep turning off Windows and rebooting from Xubuntu every time I needed to switch OSes. And VirtualBox's seamless mode is pretty amazing to allow me see Xubuntu and Windows 7 all in one screen.

Issue: Now I am thinking of a way to have Xubuntu more integrated into my system. By this I mean I want to have a physical partition for Xubuntu. But I want to still have the feeling of the seamless mode.

Question: So finally, my question is: is it possible to load a partition in VirtualBox as a virtual OS?

Case examples: Ideal scenario would be: I physically boot up and login to Windows 7. Now I want to access Xubuntu, so I load VirtualBox and access my Xubuntu partition without rebooting. And the other way around too, i.e. I boot up the system, login to Xubuntu, and can access the actual Windows 7 partition through VirtualBox.

Other info: Please note that I am not talking about getting access to files, as I have a completely separate partition for my files, and am very familiar with VirtualBox's Shared Folders option.

Source: (StackOverflow)

How to move a partition to the end in gparted?

I can't find a way to move the partition /dev/sdb2 to the end, where 12GB are free.

enter image description here

I can resize (expand) the partition, but not create (insert) any free space in front of it.

How to do the trick?

(There are 2 small black arrows on the top of the popup window in the screenshot at the side of the blue box that represents the 400 GB sdb2 - I can only move the right arrow to the right, which extends the size, but I cannot move the left arrow. When I enter something in the free space preceding box it is always reset to zero by the programm immediateley)

I hope I explained this well enough, please feel free to ask for details.

This is serious for me as I am expanding a live image.

Maybe there is another solution with linux commandline tools ?

Source: (StackOverflow)

Do partitions on SSDs map to physical addresses?

One of the reasons that some folk partition hard drives is that certain parts of the hard drive are supposed to be faster than others. Considering that HDDs are a serial access medium, partitioning, in addition to creating logical partitions, also map to a particular physical set of clusters/blocks on the hard drives

Now, with SSDs, its a whole different ballgame - wear leveling would rely on data being writable anywhere on disk, and with serial access, fragmentation has less of an effect

So.. do partitions on SSDs correlate to physical sectors on a disk like HDDs, or is it abstracted away at a higher level?

Source: (StackOverflow)

EFI Partition vs /boot partition

I have just sat down to install debian 7, which contains something called 'EFI' which is entirely new to me.

I went through the install as I usually do;

  • 256MB /boot partition, bootable, unencrypted
  • Remaining disk size as / partition, encrypted

The installer warned me about 'no EFI partition found' but I ignored it, because I like to live dangerously.

But that installation isn't bootable, grub complains about 'ELF magic' and drops me into rescue mode.

So I'm now running through the installation again, and have found the option for creating an EFI partition. My questions are as follows;

  • What is it?
  • Why do I seem to require one now?
  • Do I still need a separate /boot partition?
  • I have windows 7 installed on the same disk, which always worked fine with grub2 from the mbr, is it possible to rescue that installation as well?

Source: (StackOverflow)

Why is FAT32 limited to just under 2^28 clusters?

With FAT16 the maximum partition size is 2GB when your maximum cluster size is 32K.

This is calculated by multiplying the number of addressable units by the cluster size.

(216 Allocation units) * (215 bytes/cluster) = 2 GiB

However with FAT32, when I do the same calculation I get a much larger number than the 8 TiB maximum when using 232 clusters.

(232 Allocation units) * (cluster size)

If I use a cluster size of 512 bytes, I've already arrived at 2 TiB.

In an XP TechNet article, Microsoft says

The maximum possible number of clusters on a FAT32 volume is 268,435,445, and there is a maximum of 32 KB per cluster, along with the space required for the file allocation table (FAT).

This puts the maximum cluster size at 228 - 11.

Why is the maximum number of clusters in FAT32 228-11 and not 232, given that it was 216 in FAT16?

Source: (StackOverflow)

Are GPT partitions less likely to get corrupted than MBR-based partitions?

GPT (GUID Partition Table) partitioning has some benefits over MBR (Master Boot Record), including Support for:

  1. More partitions (128)
  2. Drives larger than 2 TB

But are there any other benefits like less likelihood of corruption? (The two HD failures I've had were corrupt MBRs). Or are you just playing wack-a-mole where the GPT then gets corrupt in the same way?

Source: (StackOverflow)

Why create many partitions?

I have noticed that when installing Ubuntu some people create multiple partitions for directories. Like one for root, one for home, one for boot. What is the advantage to doing this over installing them all on one partition, assuming there is only one hard drive?

Source: (StackOverflow)

What happened to the B: drive in Windows and why does the hard drive default to C?

Why is it that I see an A: drive and a C: drive but not a B: drive?

Is there a reason why the disk partitions start at C? And is it possible to change that letter designation?

Source: (StackOverflow)

Moving the swapfiles to a dedicated partition in Snow Leopard

I have been able to move Apple's virtual memory swapfiles to a dedicated partition on my hard drive up until now. The technique I have been using is described in a thread on forums.macosxhints.com.

However, with the developer preview of Snow Leopard, this method no longer works. Does anyone know how it could be done with the new OS?

Update: I have marked dblu's answer as accepted even though it didn't quite work because he gave excellent, detailed instructions and because his suggestion to use plutil ultimately pointed me in the right direction. The complete, working solution is posted here in the question because I don't have enough reputation to edit the accepted answer.

Update #2: Changed the procedure to illustrate ekl's technique, which greatly simplifies the whole thing by eliminating the need for an intermediate shell script:

Complete solution:

1. Open Terminal and make a backup copy of Apple's default dynamic_pager.plist:

$ cd /System/Library/LaunchDaemons
$ sudo cp com.apple.dynamic_pager.plist{,_bak}

2. Convert the plist from binary to plain XML:

$ sudo plutil -convert xml1 com.apple.dynamic_pager.plist

3. Open the converted plist with your text editor of choice. (I use pico, see dblu's answer for an example using vim):

$ sudo pico -w com.apple.dynamic_pager.plist

It should look as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">

4. Modify the ProgramArguments array (lines 13 through 18) to use the wait4path shell command (as suggested by ZILjr) prior to launching dynamic_pager. See note #1 for details on why this is necessary. In the following example, my partition is called 'Swap', and I chose to put the swapfiles in a hidden directory on that partition, called '.vm' be sure that the directory you specify actually exists. The XML should look as follows:

    <string>/bin/wait4path /Volumes/Swap/ &amp;&amp;
/sbin/dynamic_pager -F /Volumes/Swap/.vm/swapfile</string>

5. Save the plist, and return to the terminal prompt. Using pico, the commands would be:

<ctrl+o> to save the file
<enter>  to accept the same filename (com.apple.dynamic_pager.plist)
<ctrl+x> to exit

6. Convert the modified plist back to binary:

$ sudo plutil -convert binary1 com.apple.dynamic_pager.plist

7. Restart your Mac. If you run into trouble, switch to verbose startup mode by holding down Command-v immediately after the startup chime. This will let you see all of the startup messages that appear during startup. If you run into even worse trouble (i.e. you never see the login screen), hold down Command-s instead. This will boot the computer in single-user mode (no graphical UI, just a command prompt) and allow you to restore the backup copy of com.apple.dynamic_pager.plist that you made in step 1.

8. Once the computer boots, fire up Terminal and verify that the swap files have actually been moved:

$ cd /Volumes/Swap/.vm
$ ls -l

You should see something like this:

-rw-------  1 someUser  staff  67108864 18 Sep 12:02 swapfile0

9. Delete the old swapfiles:

$ cd /private/var/vm
$ sudo rm swapfile*

10. Profit!

Note 1

Modifying the arguments to dynamic_pager in the plist without using wait4path does not always work, and when it fails, it does so in a spectacularly silent way. The problem stems from the fact that dynamic_pager is launched very early in the startup process. If your swap partition has not yet been mounted when dynamic_pager is first loaded (in my experience, this happens 99% of the time), then the system will fake its way through. It will create a symbolic link in your /Volumes directory which has the same name as your swap partition, but points back to the default swapfile location (/private/var/vm). Then, when your actual swap partition mounts, it will be given the name Swap 1 (or YourDriveName 1). You can see the problem by opening up Terminal and listing the contents of your /Volumes directory:

$ cd /Volumes
$ ls -l

You will see something like this:

drwxrwxrwx  11 yourUser  staff   442 16 Sep 12:13 Swap -> private/var/vm
drwxrwxrwx  14 yourUser  staff     5 16 Sep 12:13 Swap 1 
lrwxr-xr-x   1 root      admin     1 17 Sep 12:01 System -> /

Note that this failure can be very hard to spot. If you were to check for the swapfiles as I show in step 12, you would still see them! The symbolic link would make it seem as though your swapfiles had been moved, even though they were actually being stored in the default location.

Note 2

I was originally unable to get this to work in Snow Leopard because com.apple.dynamic_pager.plist was stored in binary format. I made a copy of the original file and opened it with Apple's Property List Editor (available with Xcode) in order to make changes, but this process added some extended attributes to the plist file which caused the system to ignore it and just use the defaults. As dblu pointed out, using plutil to convert the file to plain XML works like a charm.

Note 3

You can check the Console application to see any messages that dynamic_pager_init echos to the screen. If you see the following lines repeated over and over again, there is a problem with the setup. I ran into these messages because I forgot to create the '.vm' directory that I specified in dynamic_pager_init.

com.apple.launchd[1]  (com.apple.dynamic_pager[176]) Exited with exit code: 1
com.apple.launchd[1]  (com.apple.dynamic_pager) Throttling respawn: Will start in 10 seconds

When everything is working properly, you may see the above message a couple of times only, and then no more of the "Throttling respawn" messages. This means that the system did have to wait for the partition to load, but in the end it was successful.

Source: (StackOverflow)

What is the recommended boot partition size for Windows 7?

I started using one big partition for everything and separating data out with folders when I got my current computer years ago. I'm preparing to upgrade my system from Windows XP to Windows 7, and I thought I might go back to putting my data on a separate partition.

Most likely I'll just use the default OS install. My current Program Files tree has ~16 GB of stuff.

Thinking ahead though, I've had Windows XP installed for years. Who knows what applications I'm going to install down the line?

This, of course, begs the question: How big do I make my Windows 7 install partition?

Source: (StackOverflow)

Windows detects GPT disk as MBR in EFI boot

This disk is OCZ VERTEX 128GB SSD. It is formatted as GPT from OSX. The disk layout is,

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *128.0 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                 Apple_RAID                         63.8 GB    disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3
   4:       Microsoft Basic Data ssdwin                  63.9 GB    disk1s4

I'm trying to install windows7 in the "ssdwin" partition but when i EFI Boot windows 7 64bit USB installer, it says,

Windows cannot be installed to this disk. The selected disk has a mbr partition table, On EFI system window can only be installed to GPT disks.

But my disk is GPT disk. any idea how i can recover from this ?

Source: (StackOverflow)

Easiest way to move my Windows installation to an SSD?

I've taken the plunge and bought an SSD and want to move my existing Windows installation over. The current hard disk is 500Gb, but I've trimmed the contents down to about ~40Gb. I'm transferring it across to a 100Gb SSD and looking for the easiest way just to copy everything across and set the SSD up as a boot device.

I've looked at a few tools like Macrium Reflect, but they don't seem able to restore to a smaller drive. Do I need to go for something like PING to do this? I'm trying to avoid scary Linux-based boot utilities if possible, does anyone know of an easier way?

Source: (StackOverflow)

How to rename a partition in OS X?

I'm able to erase a partition using the Disk Utility, but I want to change the name without losing data. How is it possible?

Source: (StackOverflow)