1

i have to increase the size of my ext3 partition (sdd1) mounted on NetApp LUN (disk sdd, no other partition is mounted here). I already resized the LUN and refreshed new size with iscsiadm. Empty space is already visible on the disk level (fdisk -l -> dev/sdd).

Now, while i am not using LVM, i'am forced to use either fdisk or parted to resize my partition and then use resize2fs to resize filesystem. Is it correct?

Now, the data on this partition is not critical, however i don't like to loss it. Which tool/method is then safer for resizing - with fdisk (recreating partition with new size at the same place), or with parted (resize command, seems to me easier). Resize2fs on my kernel would work even online, and i consider it pretty harmless.

0

I usually just use fdisk. First, run fdisk -l (or use the "p" command from interactive mode) and note down the first sector of the partition. It should be 2048 if your partition was created with a recent version of fdisk.

Then you have to delete (yes, delete) the partion. Finally, you have to recreate the partition having care to specify the starting sector you have noted on step 1.

If you make an error, just quit fdisk without saving. No modification will be made if you don't save.

When all is correct, write the modification. You may have to reboot the system to actually view the new partition size.

The last step is to resize (resize2fs) the filesystem.

As an example, let's say I have this layout:

fdisk /dev/xvda

Command (m for help): p

Disk /dev/xvda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00063f28

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1            2048     1953791      975872   82  Linux swap / Solaris
/dev/xvda2         1953792    16775167     7410688   83  Linux

If you expand the disk, you can delete the second partition, create a new second partition xvda2, specifing 1953792 as first sector. Write (w) the modification, reboot, and then

resize2fs /dev/xvda2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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