Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a partition table that looks like this:

[root@tower ~]# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x44fdfe06

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          13      104391   83  Linux
/dev/sda2              14         275     2104515   82  Linux swap / Solaris
/dev/sda3             276       36828   293611972+  83  Linux
/dev/sda4   *       36829       38914    16748544    7  HPFS/NTFS

/dev/sda3 is mounted to /. I would like to shrink the ext3 volume /dev/sda3so I can expand the NTFS volume /dev/sda4 and add about 15GB or so. How would I go about this? I would like to shrink the ext3 partition online if possible, so I don't have to bring down the server. I imagine my steps would be something like this:

  1. Delete the sda3 partion with fdisk.
  2. Create a new partition 3 with start cylinder of 276 and end cylinder of 35000 or so.
  3. Delete sda4 partition.
  4. Create new partition 4 with start cylinder of 35001 and end cylinder of 38914.
  5. Write changes.
  6. resize2fs /dev/sda3
  7. ntfsresize -size 35GB /dev/sda4 (35GB would equal whatever my partition is sized to in fdisk)

Can anybody double check my steps? I'm too scared to try. :)

share|improve this question
    
Step 0. Backup all important stuff –  Linker3000 Oct 23 '11 at 9:45
add comment

1 Answer

resize2fs can't shrink mounted filesystems.

Also, I'd suggest you shrink the filesystem before making the partition table change; if you have trouble in the middle, the filesystems still match the partition table enough to be usable normally.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.