Operating System - Linux
1828323 Members
3534 Online
109976 Solutions
New Discussion

Re: Free up some space on filesystem and use space to create another.

 
SOLVED
Go to solution
f. halili
Trusted Contributor

Free up some space on filesystem and use space to create another.

How can I get space from one file system and create another using filesystem using the space that will be freed up?

Here's my df. I would like to take some space from /opt and create /webapp2. Is this possible?

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p3 6047972 224272 5516476 4% /
/dev/cciss/c0d0p1 296307 19093 261915 7% /boot
/dev/cciss/c0d0p8 3525936 98152 3248676 3% /home
/dev/cciss/c0d0p5 5039840 32828 4750996 1% /opt
/dev/cciss/c0d0p9 2923532 32980 2742044 2% /tmp
/dev/cciss/c0d0p7 4031856 1986608 1840436 52% /usr
/dev/cciss/c0d0p6 5039840 161164 4622660 4% /var
/dev/cciss/c0d0p2 6047972 50188 5690560 1% /webapp

THANKS,
F. HALILI
derekh
5 REPLIES 5
Slawomir Gora
Honored Contributor

Re: Free up some space on filesystem and use space to create another.

Hi,

there is no simple because you can't free space alocated by logical partition 5.
I think that you can use /dev/cciss/c0d0p5 in LVM vg and then create logical-volumens:
1. stop all apllications which are using /opt
2. backup /opt
cd /opt
tar cvf /tmp/opt.tar opt
3. umount /opt
4. create LVM vg group
pvcreate -f /dev/cciss/c0d0p5
vgcreate vg00 /dev/cciss/c0d0p5
5. create logical volumens for /opt and /webapp2
lvcreate -L xxxM /dev/vg00
lvcreate -L yyyM /dev/vg00
replace xxx with your /opt size
replace yyy with your /webapp2 size

6. modify /etc/fstab
for /opt
replace /dev/cciss/c0d0p5 with /dev/vg00/lvol1
create line for /webapp2 (/dev/vg00/lvol2)

6. mount volumens
mount -a

7. untar /opt
tar xvf /tmp/opt.tar


It all
f. halili
Trusted Contributor

Re: Free up some space on filesystem and use space to create another.

My linux machine is not using LVM it has a "ext3" filesystem. Here's my /etc/fstab:

[root@ISTORE /]# more /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2
LABEL=/opt /opt ext3 defaults 1 2
none /proc proc defaults 0 0
#none /dev/shm tmpfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=/webapp /webapp ext3 defaults 1 2
/dev/cciss/c0d0p10 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
[root@ISTORE /]#
derekh
Slawomir Gora
Honored Contributor
Solution

Re: Free up some space on filesystem and use space to create another.

Hi,

LVM it not file system type but Logical Volume Manager - when you create logical volumen
you have to create file system on it (sorry I forget it my steps)
ex: for opt:
mkfs.ext3 /dev/vg00/lvol1

Dave Falloon
Trusted Contributor

Re: Free up some space on filesystem and use space to create another.

You can use parted to create destroy and resize partitions.

man parted

--Dave
Clothes make the man, Naked people have little to no effect on society
f. halili
Trusted Contributor

Re: Free up some space on filesystem and use space to create another.

THANKS!
derekh