Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
F: +44 (0)8456 446 899 / +44 (0)1223 359459
E: enquiries@precedence.co.uk
FS-Resize

Jump To: Support > KB > NetManager > FS? > Resize

Resizing filesystems (e.g. after altering disc size in XenServer)

Instructions assume NetManager is virtualised using XenServer and that / and /usr are on different partitions (more specifically, with /usr being at the end of the virtual disc).

  1. Login into VM as root
  2. Use df to check partition of /usr:
    netmanager 1# df /usr
    Filesystem   1K-blocks       Used      Avail %Cap Mounted on
    /dev/xbd0e     13418366    6162538    6584910  48% /usr
    
  3. If Filesystem is NOT /dev/xbd0e (look carefully, it could be /dev/xbd0a), then /usr is not on its own partition and the disc will need to be re-partitioned or such like (beyond the scope of this document).
  4. Check that version of NetBSD is up-to-date enough to have /sbin/resize_ffs:
    netmanager 1# which resize_ffs
    /sbin/resize_ffs
    
  5. If you get the error resize_ffs: Command not found., then you need to update the NetManager to a version newer than 010612 or update NetBSD to latest 5.1_STABLE before continuing.
  6. Shutdown the VM
  7. Take a copy of the VM, just in case
  8. Resize the virtual hard drive
  9. Boot the VM
  10. Login as root
  11. Use dmesg and grep to determine the new number of sectors on the resized disc (in this case 41943040):
    netmanager 1# dmesg | grep xbd0:
    xbd0: using event channel 5
    xbd0: 20480 MB, 512 bytes/sect x 41943040 sectors
    
  12. Run disklabel -e xbd0d and scroll to bottom. Note original sizes:
    total sectors: 31457280
    [other lines here]
    
    16 partitions:
    #        size    offset     fstype [fsize bsize cpg/sgs]
     a:   2097648        63     4.2BSD   2048 16384     0  # (Cyl.      0*-   2081*
     b:   2097648   2097711       swap                     # (Cyl.   2081*-   4162*
     c:  31457217        63     unused      0     0        # (Cyl.      0*-  31207*
     d:  31457280         0     unused      0     0        # (Cyl.      0 -  31207*
     e:  27261921   4195359     4.2BSD   2048 16384     0  # (Cyl.   4162*-  31207*
    
  13. Double-check you have an e: partition and that its offset is the highest value (should be sum of offset and size of b: partition).
  14. Edit total sectors: line so that it is the new number of sectors. In this case, this is 41943040.
  15. Edit c: partition so that size is new number of sectors minus offset of c:. In this case, this is 41943040-63=41942977
  16. Edit d: partition so that size is new number of sectors. In this case, this is 41943040
  17. Edit e: partition so that size is new number of sectors minus offset of e:. In this case, this is 41943040-4195359=37747681
  18. Do NOT touch the a: and b: values, nor the offset of the e: partition
  19. Double check final values:
    total sectors: 41943040
    [other lines here]
    
    16 partitions:
    #        size    offset     fstype [fsize bsize cpg/sgs]
     a:   2097648        63     4.2BSD   2048 16384     0  # (Cyl.      0*-   2081*
     b:   2097648   2097711       swap                     # (Cyl.   2081*-   4162*
     c:  41942977        63     unused      0     0        # (Cyl.      0*-  31207*
     d:  41943040         0     unused      0     0        # (Cyl.      0 -  31207*
     e:  37747681   4195359     4.2BSD   2048 16384     0  # (Cyl.   4162*-  31207*
    
  20. Save with Ctrl-K, X
  21. Take a backup copy of /etc/rc.conf:
    netmanager 2# cp /etc/rc.conf /etc/rc.conf.bak
    
  22. Edit /etc/rc.conf and change rc_configured to NO:
    
    # If this is not set to YES, the system will drop into single-user mode.
    #
    rc_configured=NO 
    
  23. Reboot VM (will come up in single-user)
  24. At Enter pathname of shell or RETURN for /bin/sh: prompt, hit return.
  25. If prompted for terminal type, enter vt100 and hit return.
  26. Force fsck to run on the partition:
    # fsck -fy /dev/xbd0e
    ** /dev/rxbd0e
    ** File system is already clean
    ** Last Mounted on /usr
    ** Phase 1 - Check Blocks and Sizes
    ** Phase 2 - Check Pathnames
    ** Phase 3 - Check Connectivity
    ** Phase 4 - Check Reference Counts
    ** Phase 5 - Check Cyl groups
    85281 files, 3081268 used, 3627915 free (9459 frags, 452307 blocks, 0.1% fragmentation)
    
  27. Run resize_ffs against the partition:
    # resize_ffs /dev/rxbd0e
    It's required to manually run fsck on file system before you can resize it
    
     Did you run fsck on your disk (Yes/No) ? yes
    
  28. Mount root filesystem:
    # mount /
    
  29. Rename backup of /etc/rc.conf:
    # mv /etc/rc.conf.bak /etc/rc.conf
    
  30. Run reboot to reboot
  31. Login as root and run df again to check size has been increased:
    
    netmanager 1# df /usr
    Filesystem   1K-blocks       Used      Avail %Cap Mounted on
    /dev/xbd0e     18576798    6162538   11485422  34% /usr
    
© Copyright Precedence Technologies 1999-2017
Page last modified on June 11, 2012, at 04:44 PM by sborrill