cancel
Showing results for 
Search instead for 
Did you mean: 

Extending file system

SOLVED
Go to solution
Sachin Patel
Honored Contributor

Extending file system

Hi
I have Linux 6.2 on 10gb IDE drive. I have add new 20GB on it. I used fdisk and remove old partition and create new partition. How do I add this new space in my current partation /usr?
I have not run any fs command on it yet.

Sachin
Is photography a hobby or another way to spend $
5 REPLIES
Bernd Reize
Trusted Contributor
Solution

Re: Extending file system

Hi Sachin,
if i understood you, you have currently mounted your /usr on an 10G partition, and want to move it to another partition with 20G.

first you have to create a filesyste on the new partition with one of the following commands:
"mkreiserfs /dev/hdXX" or "mke2fs /dev/hdXX".
i recommend reiserfs, cause it journals.
in the next step you have to move your data from the old /usr to the new one. for this mount the new partition on /mnt.
for copying the data your should NOT use cp!
cp would replace all file ownerships with the current user (in this case, normally root).
instead, copy the data with tar:

cd /usr
tar -cSpf - * | (cd /mnt; tar -xSpvf - *)

next verify if everything was copied correctly.
if so, you could umount your old /usr and mount the new one.
Vincenzo Restuccia
Honored Contributor

Re: Extending file system

If you have lvm:
#lvextend -L xxx /dev/vgxx/lvolx
#extendfs /dev/vgxx/rlvolx
Laurent Paumier
Trusted Contributor

Re: Extending file system

Why would you need 20G for /usr ?
Maybe instead of moving your old /usr to this new disk you should consider moving your data out of /usr or creating a new mount point /usr/my_big_appl.
Just my opinion...
Sachin Patel
Honored Contributor

Re: Extending file system

Hi Bernd,
Everythig works fine except I used
tar -cSpf - * |(cd /mnt;tar -xSpvf *) (- didn't work for me)

Thanks
Sachin
Is photography a hobby or another way to spend $
Ted M Johnson
Occasional Visitor

Re: Extending file system

I was wondering if you had tried resize2fs on this, and if so did it fail? If you have the new partition already created, then resize2fs should work. I've had good results with it, and it seems to be the simplest method to do what you explain.