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).
- Login into VM as root
- 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
- 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). - Check that version of NetBSD is up-to-date enough to have /sbin/resize_ffs:
netmanager 1# which resize_ffs /sbin/resize_ffs
- 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. - Shutdown the VM
- Take a copy of the VM, just in case
- Resize the virtual hard drive
- Boot the VM
- Login as root
- Use
dmesg
andgrep
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
- 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*
- 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). - Edit
total sectors:
line so that it is the new number of sectors. In this case, this is 41943040. - Edit
c:
partition so that size is new number of sectors minus offset of c:. In this case, this is 41943040-63=41942977 - Edit
d:
partition so that size is new number of sectors. In this case, this is 41943040 - Edit
e:
partition so that size is new number of sectors minus offset of e:. In this case, this is 41943040-4195359=37747681 - Do NOT touch the a: and b: values, nor the offset of the e: partition
- 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*
- Save with Ctrl-K, X
- Take a backup copy of
/etc/rc.conf
:netmanager 2# cp /etc/rc.conf /etc/rc.conf.bak
- Edit
/etc/rc.conf
and changerc_configured
toNO
:# If this is not set to YES, the system will drop into single-user mode. # rc_configured=NO
- Reboot VM (will come up in single-user)
- At
Enter pathname of shell or RETURN for /bin/sh:
prompt, hit return. - If prompted for terminal type, enter vt100 and hit return.
- 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)
- 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
- Mount root filesystem:
# mount /
- Rename backup of
/etc/rc.conf
:# mv /etc/rc.conf.bak /etc/rc.conf
- Run
reboot
to reboot - 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