Showing posts with label partition. Show all posts
Showing posts with label partition. Show all posts

Tuesday, September 22, 2009

Resizing an NTFS partition with free tools

The guy that set up some of the Windows XP systems at work partitioned the drives to theoretically separate the OS (C:) from the data (D:). However, he didn't complete the process; i.e. he didn't move the default "Documents and Settings" folder, nor the "Program Files" folder to the "data" disk.

So, of course the "OS" partition eventually filled up with user data. A few months ago I moved the main user's Documents and Settings folder to the data drive, and used a junction point in the original location to point to it. That only staved off the disk filling up for a while -- this week I finally got around to deploying Office 2007, and the system didn't have enough space to install it.

I wanted to delete the "data" partition and consolidate everything into one partition. The old version of Partition Magic we had wouldn't boot the system for some reason, so I needed to find another tool to do it.

The answer: a Ubuntu 9.04 Desktop CD. The process is pretty simple. In summary, backup the data, delete all the NTFS partitions, recreate a single NTFS partition in the same cylinder space, then use ntfsresize to fix the NTFS partition.

  1. Boot the system from the Ubuntu CD. At the boot menu, select "Try Ubuntu".
  2. Open a terminal (Applications, Accessories, Terminal) and sudo to root with
    sudo -s
  3. Figure out which disk is the one you want. Likely candidates are /dev/hda (IDE) or /dev/sda (SATA). If you're not sure, use
    dmesg | less
    to find the disk device.
  4. Start fdisk on the device (e.g. fdisk /dev/sda), and print the existing partition table. Note the cylinder numbers for where the current NTFS partitions start and end (especially the start of the first NTFS partition, and the end of the last NTFS partition).
  5. Delete all of the existing NTFS partitions. Then create a single new partition, starting at the same cylinder as the first partition, but ending at the cylinder number for the last NTFS partition.
  6. Mark the NTFS partition as bootable! Exit fdisk.
  7. Resize the partition to its maximum size using ntfsresize. Read the ntfsresize man page to learn how. You may also refer to this page on shrinking an NTFS volume (starting at step 8). For example, if the device size is 32079 MB, you may try
    ntfsresize -n -s 32079M /dev/sda 
    If you don't get any errors, proceed by removing the -n option. If you get an error that the partition size cannot exceed the device size, reduce the size by 1MB (e.g. 32078M).
  8. Reboot the system with reboot. Windows will run chkdsk, reboot, and then everything should work as before.
  9. Restore the data from the lost partition (D:).

Thursday, July 16, 2009

Setting up a Linux system with a 3.5TB disk

As mentioned in my last post, I have this remote linux system with 3.5TB of disk, but broken into two LVMs. I want most of the storage to be in one big disk.


Today I had my remote monkey put the RHEL4 WS DVD in the machine and rebooted it. I entered the RAID BIOS (Dell PERC 5/i) to delete the existing virtual disks. I then created two new virtual disks -- one of 250GB for the OS, and one of the remaining 3.4TB for the data.

I booted from the RHEL DVD and entered "rescue" mode, because anaconda does not support making GPT disks. Then I entered
parted /dev/sdb
mklabel gpt
mkpart primary 0 3571900M
quit
Then:
mkfs.ext3 /dev/sdb1
Making the EXT3 FS took about 22 minutes.

That's mostly it! I rebooted and ran anaconda this time, setting up LVM on /dev/sda (except /boot, of course). I left /dev/sdb alone.