9

so this is the situation:

I had this hardDrive of 500GB, on my server and tried to upgrade it to a 2T HardDrive,

after the upgrade result of lsblk has changed while df still returns same results.

df -h:

/dev/xvdf6      493G  472G     0 100% /root/external


lsblk:

xvdf6 202:86   0     2T  0 disk /root/external

so why the size of the drive is different if I use lsblk vs df commands?

I'm doing some heavy processing, and data in harddrive will go over 500GB, so what happens then?

2 Answers 2

8

The block device is now 2TB, but the filesystem still has its old size. You need to resize it, e.g. using resize2fs - increasing size can be done online.

The steps are these (assuming this is the last partition on the block device):

  • First use fdisk or friends to extend the partition,
  • then use the resize tool for your file system (resize2fs for ext{2,3,4}) to resize the file system.

You don't need to stop your processes, if you use a file system, that can grow online (such as ext{2,3,4} or ocfs2)

4
  • 1
    mate could you please demonstrate with an example? also do I have to stop all my processes ?
    – nafas
    Sep 10, 2015 at 10:58
  • 1
    @nafas - it's actually quite easy (assuming this is the last partition on the block device): First use fdisk or friends to extend the partition, then use the resize tool for your file system (resize2fs for ext{2,3,4}) to resize the file system. You don't need to stop your processes. Sep 10, 2015 at 17:38
  • 1
    thx mate, very helpful, btw it would be nice if you edit your answer and add the last comment into it ( for other people to use), :)
    – nafas
    Sep 11, 2015 at 10:27
  • @nafas: Done so. Sep 11, 2015 at 11:17
2

Additional info, when you resizing using resize2fs you face this kind of error

$ resize2fs /dev/yourpartition
...
resize2fs: Read-only file system While checking for on-line resizing support

You need to remount it and do it again

$ mount -o remount /dev/yourpartition
$ resize2fs /dev/yourpartition
...
The filesystem on /dev/yourpartition is now 976562 (4k) blocks long.

reference here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .