2

I have a VM server with an extra disk mounted on it. I have increased size on it from VMWare.

The disk uses reiserfs file system.

 /dev/sdb1 /data/mysql_data reiserfs rw,relatime 0 0 

After expanding disk size, I run this

# fdisk -l
Disk /dev/sdb: 39.3 GB, 39322648576 bytes
255 heads, 63 sectors/track, 4780 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2611    20971488+  83  Linux

After this, I run

# resize_reiserfs -f /dev/sdb1
resize_reiserfs 3.6.21 (2009 www.namesys.com)

/dev/sdb1 already is of the needed size. Nothing to be done

and then df -h but still file system size hasn't increased.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_0-lv_root
                       21G   12G  7.9G  60% /
tmpfs                1004M     0 1004M   0% /dev/shm
/dev/sda1             485M  156M  305M  34% /boot
/dev/sdb1              20G   15G  5.6G  73% /data/mysql_data

At the moment, my partition table says this

# cat ~/sfdisk_sdb.txt 
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=       63, size= 41942977, Id=83
/dev/sdb2 : start=        0, size=        0, Id= 0
/dev/sdb3 : start=        0, size=        0, Id= 0
/dev/sdb4 : start=        0, size=        0, Id= 0

So, what am I doing wrong?

2

It looks like the reiserfs filesystem already is the entire size of the partition, your partition appears to be using 2611 of the 4780 cylinders which would put it at a bit over half the size of the drive (39.3 GB drive, your partition ends up 20GB, sounds about right).

REMEMBER TO DO ALL OF THIS WITH THE FILESYSTEM UNMOUNTED

You need to extend the partition size so it fills the disk (if that is your intent), I dont know of any "nice" tool for changing existing partition tables, but the basic principle is that if you delete that partition, and make a "disk size" partition WITH THE SAME START CYLINDER, then the data will be preserved (dont use a tool that does formatting the standard fdisk commands should get you through).

Once the partition is resized, with it still unmounted you can have the reiser fs tools extend the filesystem (which is your problem, it doesn't do the partition) to fill the parition.

Remember sector size is 512 bytes, so while that 41942977 looks good in the last partition table dump, the number of KB is half of that.

  • Would cfdisk (en.wikipedia.org/wiki/Cfdisk) do the trick? – mezi Sep 27 '13 at 16:49
  • 1
    Probably what i'd use, save the partition table somewhere then just delete the partition and make a new one, since they both start at the 'start of the disk' that should work just fine, make sure you can still read the reiserfs properly after doing so (fsck it in read only mode?), worst case as long as you haven't changed the data its self (by read/write fsck or resizing) you can just put the original partition table back. Needless to say, backup before you blah blah. Or dont ;) – iain Sep 27 '13 at 18:04
  • Thanks @iain, it worked. It used fdisk to delete the partition and created it again using the full space. Then used resize_reiserfs to extend the file system – mezi Sep 29 '13 at 22:10
2

The disk image is partitioned. There is a single partition spanning the whole (original) disk except for the partition table at the beginning; that partition contains a reiserfs filesystem. Enlarging the disk doesn't affect the size of the partition, so you won't have more room for the filesystem until you also enlarge the partition.

Run parted on the disk image and use the resize command to extend the partition to span the whole disk. Depending on the disk image format, you may be able to use parted on the host (if the image is a raw image, even if it's sparse) or you may have to run parted inside the VM.

  • Thanks @Gilles for the explanation. I used parted and then resize command as a trial. But the reiserfs file system support is not available for the parted tool. – mezi Sep 29 '13 at 22:12
  • 1
    @mrahman After you resize the partition with parted, resize the filesystem with resize_reiserfs. – Gilles 'SO- stop being evil' Sep 29 '13 at 22:24

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.