echo <your_values> | dc -f- -e '[z 1!=b]sa [+ lax]sb 1z >a p'
dcscript is probably useful: The script consists of 2 macros ("a" and "b"), a command to call macro "a", and a command to print the end-result. Macro "a" implements a "while" statement for handling all values on the list; macro "b" is an addition operation and a jump back to the "while" statement. Using these two macros we create a loop to add all values. Two values are added each iteration until all is done and the result can be output by the "p" command.
|[z 1!=b]sa||Store macro "a" in register "a". When called, the macro places 2 values on the stack: the "z" command puts the current stack depth on the stack, "1" is put literaly on the stack. "!=" compares these two values for unequality and calls macro "b" if this is the case. For the comparison the values are popped from the stack.|
|[+ lax]sb||Store macro "b" in register "b". Pop 2 top-of-stack values, add, and push the result back on the stack. Next call macro "a" (unconditionally). As long as there are two or more values on the stack the comparison performed by macro "a" yields true and another addition will take place.|
|1z||Initialization for the command in the row below:|
|>a||If stack depth greater than 1, start summation by calling macro "a". This check is to prevent looping if the list of values is empty. In this case, the "z" command executed as part of the above initialization will yield the value 1 and we know there was nothing else on the stack so macro "a" should not be called.|
|p||Output result (sits at top of stack).|
First, backup the data on the filesystem you're about to resize and write
down the current layout of the partition table. Just in case something goes
wrong. Second, be careful.
Determine block size of filesystem (
# dumpe2fs -h <dev> | grep '^Block size:'
Determine the minimum filesystem size (
min_sz); the returned value
is the size expressed in filesystem blocks:
# resize2fs -P <dev>
Multiply filesystem block size by the minimum filesystem size to get the minimum size of the filesystem in bytes:
echo min_bytes=$((<fs_blk_sz> * <min_sz>))
Unmount the filesystem and force an
# umount <dev>
# e2fsck -f <dev>
Resize filesystem and ensure its new size (
new_sz) is not lower
than the minimum filesystem size. By default, the
is in filesystem blocks, but may be followed by a letter to change the unit:
s), kilobytes (
M), or gigabytes (
the new size of the filesystem in filesystem blocks. Call this
# resize2fs -p <dev> <new_sz>
Determine filesystem size in 512-byte sectors (
# echo fs_sz_512=$((<fs_sz> * <fs_blk_sz> / 512))
Write down start sector of partition you're resizing, call it
# fdisk -l <disk>
Determine end sector of resized partition, call it
The -1 term is used because the end sector is inclusive.
# echo end_sector=$((start_sector + fs_sz_512 - 1))
Run partitioning program (e.g.,
fdisk) and edit partition table:
# fdisk <disk>
# e2fsck -f <dev>
# mount <dev>
disklabel command on Tru64 cannot zero disk label if a
foreign disk label is present. Fixed by low-level formatting the disk then
zeroing the disk label, and finally restart the installation.
# scu -f /dev/rdisk/dsk1c scu> format scu> exit # disklabel -z dsk1
Copy your installation config to floppy:
# fddisk -fmt /dev/rdisk/floppy0c # disklabel -wr floppy0 rx23 # newfs /dev/rdisk/floppy0c # mount /dev/disk/floppy0c /mnt # cp /var/tmp/install_log_1 /mnt/install.cdf # chmod 755 /mnt/*
# cd / # restart nogui
... Found file install.cdf on Floppy Diskette ... Would you like to use the Configuration Description File? (y/n) [y]: y Continuing installation... Validating the installation CDF ...