Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a server where the space distribution among partitions is as follows:

GSSJMB02:~ # df -kh
Filesystem            Size  Used Avail Use% Mounted on
/dev/cciss/c0d0p5      25G  5.9G   18G  25% /
udev                  3.9G  144K  3.9G   1% /dev
/dev/cciss/c0d0p9      64G  129M   61G   1% /apps
/dev/cciss/c0d0p1     244M   12M  219M   6% /boot
/dev/cciss/c0d0p10     16G  129M   15G   1% /home
/dev/cciss/c0d0p7     5.0G  618M  4.1G  13% /opt
/dev/cciss/c0d0p8     9.9G  228M  9.2G   3% /var
GSSJMB02:/gsn/sw       25G  5.9G   18G  25% /mnt/nfs/gsn/sw
GSSJMB02:/gsn/nodes    25G  5.9G   18G  25% /mnt/nfs/gsn/nodes

Here the filesystem /dev/cciss/c0d0p5 has less space than I require. And filesystem /dev/cciss/c0d0p9 has a lot of unusable space. Can I increase the space of /dev/cciss/c0d0p5 by taking out some from /dev/cciss/c0d0p9?

share|improve this question
    
why do you have the rootfs NFS-mounted twice at /mnt/nfs/gsn/{sw,nodes} ? if they're where you need the extra space, why not just create /apps/gsn, and change your NFS exports to match. or just use a symlink - NFS-mounting a local disk doesn't make much sense unless you're doing NFS testing. –  cas Sep 26 '12 at 11:13
add comment

1 Answer

Not without backup, repartition, mkfs and restore of at least c0d0p[56789] (assuming the partitions are numbered sequentially according to on-disk layout).

If you were to go to all the effort of doing that, expend a little more effort to install and configure lvm and use logical volumes rather than partitions - that'll give you a lot more flexibility the next time you need to grow or shrink a filesystem (or if you add a second disk).

(also, it's hard to see why anyone would even bother making lots of little partitions on a small disk these days. It used to be common practice, but disks used to be tiny too. these days, the hassle and inconvenience it causes more than outweigh the minor benefits)

So, the short answer is no.

However, you can make a directory on /apps (e.g. /apps/stuff) and move+symlink files from / to /apps/stuff. For example:

 mkdir /apps/stuff
 mv /usr/share/doc /apps/stuff
 ln -s /apps/stuff/doc/ /usr/share/

as long as you don't move any files or directories that are required at boot time (including all of /etc, /bin, /sbin), everything will keep working (although you may have to reboot or at least kill and restart some processes if any of the files you moved are held open by some process)

BTW instead of mv, it's generally a better idea to copy the files, as long as you preserve owner, group, and permissions. e.g. use cp -a or rsync or even the old workhorse of cd /path/to/src ; tar cf - . | (cd /path/to/dest ; tar xf -) Then when the files have copied, either delete them (or move them out of the way temporarily) and create the symlink. when that's done, test that everything is working correctly - if it is, then delete the original from the root fs. e.g.

mkdir /apps/stuff
rsync -ax /usr/share/doc /apps/stuff
mv /usr/share/doc /usr/share/doc.bak
ln -s /apps/stuff/doc/ /usr/share
# do your testing now
rm -rf /usr/share/doc.bak

Note that it is important to leave the trailing / off the source argument in rsync here (i.e. use /usr/share/doc rather than /usr/share/doc/) otherwise rsync will think you want to copy everything in /usr/share/doc/ to /apps/stuff rather than to /apps/stuff/doc

share|improve this answer
    
also, if you don't need to move anything from the rootfs, just create a new dir on /apps and (optionally) symlink to it from wherever you need it on the rootfs. just because the mount-point is called "apps" that doesn't mean it's the only thing you can use it for....and you don't seem to be using it for much at all. –  cas Sep 26 '12 at 11:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.