Operating System - Linux
1748201 Members
3073 Online
108759 Solutions
New Discussion юеВ

Re: extend ext3 partition used as NFS share

 
SOLVED
Go to solution
Doug Davenport
Occasional Advisor

extend ext3 partition used as NFS share

Greetings gurus,

I have the following disk used as an NFS share on an RHEL 4U4 system:

df -T /dev/sdg1
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sdg1 ext3 141106132 123913684 10024652 93% /share

fdisk -l /dev/sdg

Disk /dev/sdg: 299.9 GB, 299999442944 bytes
255 heads, 63 sectors/track, 36472 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdg1 * 1 17847 143355996 83 Linux
/dev/sdg2 17848 36472 149605312+ 83 Linux


/dev/sdg1 is the NFS share and is nearly full

/dev/sdg2 is not used

I'd like to extend /dev/sdg1 to use all of /dev/sdg

This is not a system or boot disk, it can be unmounted.

How do I accomplish this?


Thank you,

Doug
8 REPLIES 8
Ivan Ferreira
Honored Contributor

Re: extend ext3 partition used as NFS share

As you don't use LVM, you have two options.

Backup, destroy, repartition and recreate your file system. Restore your data. Use LVM this time if you can.

Create a file system in sdg2 and mount it in a directory /share.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor
Solution

Re: extend ext3 partition used as NFS share

Shalom Doug,

You are not using lvm

You can not easily accomplish this.

fdisk /dev/sdg

Use the menus to set the partition type of partition 2 to 8E lvm

pvcreate -f /dev/sdg2
vgcreate vgnfs /dev/sdg2
vgdisplay vgnfs
# to get the number of PE's available for the next command.
lvcreate -l ####### vgnfs

This will allow to copy all the data from the /dev/sdg1 partition to the sdg2 parition.

Do that.

umount the file system make sure NFS is shut down first.

change the mount instructions in /etc/fstab to mount the new logical volume
mount /

fdisk /dev/sdg
mark partition 1 to 8e LVM

pvcreate -f /dev/sdg1
vgextend vgnfs /dev/sdg1
pvdisplay /dev/sdg1 # to get number ##### for the next command double it.
lvextend -L ###### /dev/vgnfs/lvol0
resize2fs /dev/vgnfs/lvol0

If this is Red hat 4, use ext2online instead of rsize2fs to extend the file system.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Doug Davenport
Occasional Advisor

Re: extend ext3 partition used as NFS share

Thank you Ivan and Steven,

I had been considering converting this to LVM but was finding conflicting info as to whether or not LVM and NFS are compatible.

Based on your feedback this seems possible.

Just to be clear, am I able to share an LV via NFS?
emha_1
Valued Contributor

Re: extend ext3 partition used as NFS share

hi,


you share file system (or better - a directory on a FS), not a LV, so it doesn't matter what is FS created on.

emha.
Doug Davenport
Occasional Advisor

Re: extend ext3 partition used as NFS share

Yes, thank you emha
Viktor Balogh
Honored Contributor

Re: extend ext3 partition used as NFS share

Doug,

>Create a file system in sdg2 and mount it in a directory /share.

If you would go this way and create a sub-mount then do not forget about the 'crossmnt' option in /etc/exports. Otherwise the sub-mount /share/sdg2 won't be visible on the NFS clients.

man 5 exports:

"crossmnt

This option is similar to nohide but it makes it possible for clients to move from the filesystem marked with crossmnt to exported filesystems mounted on it. Thus when a child filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has the same effect as setting "nohide" on B.
"
****
Unix operates with beer.
Doug Davenport
Occasional Advisor

Re: extend ext3 partition used as NFS share

Thank you Viktor, good point.
Doug Davenport
Occasional Advisor

Re: extend ext3 partition used as NFS share

I will convert to LVM much as SEP described.