[comp.sys.sgi] mklv

kevin@hiatus.zko.dec.com (Kevin D. Baranski-Walker) (05/13/91)

--
I'm desparately attempting to extend my /usr partition:

	1) mkfs new disk /dev/dsk/dks0d4s7 (the whole efs disk)
	2) create /etc/lvtab;
	
	 	lv1:extended-usr-partition:stripes=2:devs= \
			/dev/dsk/dks0d1s6, /dev/dsk/dks0d4s7
	
	3) take the system down to single user
	4) mklv lv1;
		and I get <INCORRECT PARTITION SIZE> for /dev/dsk/dks0d4s7
	

What am I missing?  Can is it legal to make a lv from a 'live' partition (i.e.,
/usr)?

Thanks in advance,

- kevin

tohanson@gonzo.lerc.nasa.gov (Jeff Hanson) (05/13/91)

Since my mail to Kevin bounces and since this may be of interest to others,
here is how I extended by system disk's /usr partition onto a second disk.


Installation of logical volume with 2 SCSI disks to expand /usr partition on
root disk onto the second.

1.  Make sure the two disks are NOT on the same SCSI address.

2.  Read Sys. Admin. Guide, Chapter 7, Section 4 on Logical Volumes

3.  Backup /usr partition

4.  Insert the following line in /etc/lvtab
	lv0:extension of /usr:devs=/dev/dsk/dks0d1s6,/dev/dsk/dksc0d2s7
Name of logical volume:description:disk partitions (6 on disk1 and all of disk2)

5.  Create fstab.lvol			(Check exports list)
	cp fstab fstab.lvol
	ed fstab.lvol
	s[usr[dsk/lv0[
	s[rusr[rdsk/lv0[
	w
	q
Line is changed from 
	/dev/usr /usr efs rw,raw=/dev/rusr 0 0
to
/dev/dsk/lv0 /usr efs rw,raw=/dev/rdsk/lv0 0 0

6.  Go to single user mode
	init s

7.  Run the following to make the logical volume
	/etc/mklv lv0

8.  Check the file system on the first disk
	fsck /dev/dsk/dks0d1s6

9.  Expand usr partition unto the second disk.
	/etc/growfs /dev/rdsk/lv0

10. Check the logical file system
	fsck /dev/rdsk/lv0

11. Move the modified version of fstab into place
	mv fstab fstab.nolvol
	mv fstab.lvol fstab

12. Go back to multiuser mode
	init 2
-- 
---------------------------------------------------------------------------
 Jeff Hanson - Scientific Graphics Programmer and Workstation Administrator
 NASA Lewis Research Center, MS 86-4, Cleveland, Ohio 44135
 Telephone - (216) 433-2284  Fax - (216) 433-2182
 tohanson@gonzo.lerc.nasa.gov	-   ViSC: Better Science Through Pictures

daveh@xtenk.asd.sgi.com (David Higgen) (05/14/91)

In article <1991May13.084225@hiatus.zko.dec.com>, kevin@hiatus.zko.dec.com (Kevin D. Baranski-Walker) writes:
> --
> I'm desparately attempting to extend my /usr partition:
> 
> 	1) mkfs new disk /dev/dsk/dks0d4s7 (the whole efs disk)
> 	2) create /etc/lvtab;
> 	
> 	 	lv1:extended-usr-partition:stripes=2:devs= \
> 			/dev/dsk/dks0d1s6, /dev/dsk/dks0d4s7
> 	
> 	3) take the system down to single user
> 	4) mklv lv1;
> 		and I get <INCORRECT PARTITION SIZE> for /dev/dsk/dks0d4s7
> 	
> 
> What am I missing?  

Rather a lot, actually. Where on earth did you come up with the sequence of
operations you list?

There IS a section on using logical volumes to extend filesystems in the
System Administrator's guide, but I'll go over it again here.

First, please clearly understand the distinction between a logical volume
and a filesystem. A logical volume is a DEVICE, not a filesystem. It allows you
to "glue" together two or more disk partitions into a "pseudo partition"
that looks like a single disk partition. 

So to extend a filesystem, there are TWO steps. First, you have to create
a logical volume for it to reside on. Then you have to grow the filesystem
to take advantage of the extra space.

Also, note that when you are using logical volumes to grow a filesystem
which originally resided on a single partition, the logical volume must
NOT be striped. (That would involve "decomposing" all the original 
filesystem data and shuffling it between the two partitions: for safety
& reliability we don't allow that).

Here are the steps you need to take. 

1) Create an lvtab entry:

 	 	lv1:extended-usr-partition:devs= \
 			/dev/dsk/dks0d1s6, /dev/dsk/dks0d4s7

	UNstriped, notice.

2) Since you are changing your /usr, you will need to change your /usr
   entry in /etc/fstab. You'll be going down to singleuser to do the
   lv creation & growth of the fs, so you won't have full-screen
   editing available at that time. So unless you're an ed whiz, I suggest you 
   make the new fstab first (make it as a copy of the existing one, then
   you can just copy it to /etc/fstab when you've made the other changes).

   Your /usr entry in fstab will currently look something like:

   /dev/usr /usr efs rw,raw=/dev/rusr 0 0

   This has to change, because /dev/usr is a link to the partition the /usr
   filesystem is on: /dev/dsk/dks0d1s6 in your case. Once you've grown it,
   however, the filesystem will no longer be accessed via that device, 
   instead, it will be accessed via the new logical volume device /dev/dsk/lv1.
   So the new fstab entry should be:

   /dev/dsk/lv1 /usr efs rw,raw=/dev/rdsk/lv1 0 0

   Note that you should change to use the full /dev/dsk and /dev/rdsk
   names. You might think it would be a smart idea to instead just change the
   /dev/usr and /dev/rusr links to point to the new device: but that'll
   run you into trouble the next time you install software. The installation
   tool remakes the /dev/usr and /dev/rusr links to the defaults!

3) Take the system down to single user.

4) /etc/mklv lv1

   (Note: if a previous mklv has been run, you might need to use the -f
   option to mklv. This tells it to ignore any previous assignments).

   At this point we have created the logical volume where the enlarged
   filesystem will reside. Next we have to grow the filesystem to actually use
   this added space:

5) /etc/growfs /dev/rdsk/lv1

   Now, your old usr filesystem is enlarged, with all its previous files
   & directories retained. You might like to do an fsck on /dev/rdsk/lv1
   just as a sanity check.

6) Replace /etc/fstab with the new one containing the updated /usr entry
   you created earlier.

7) Go back to multiuser and proceed with your business!

Hope this helps. I will try to answer any queries by email.


		Dave Higgen (daveh@xtenk.asd.sgi.com)

jeremy@perf2.asd.sgi.com (Jeremy Higdon) (05/14/91)

In article <1991May13.084225@hiatus.zko.dec.com>, kevin@hiatus.zko.dec.com (Kevin D. Baranski-Walker) writes:
> --
> I'm desparately attempting to extend my /usr partition:
> 
> 	1) mkfs new disk /dev/dsk/dks0d4s7 (the whole efs disk)
> 	2) create /etc/lvtab;
> 	
> 	 	lv1:extended-usr-partition:stripes=2:devs= \
> 			/dev/dsk/dks0d1s6, /dev/dsk/dks0d4s7
> 	
> 	3) take the system down to single user
> 	4) mklv lv1;
> 		and I get <INCORRECT PARTITION SIZE> for /dev/dsk/dks0d4s7
> 	
> 
> What am I missing?  Can is it legal to make a lv from a 'live' partition (i.e.,
> /usr)?

You can not extend an older filesystem with striping.  Also, striped
partitions must be the same size.  In the above example, you would have
to make sure that dks0d1s6 and dks0d4s7 were the same size.  But since
it appears you want to extend an already existing filesystem, you should
remove the ":stripes=2" field, and then everything should work.
Remember, after the
	mklv lv1
execute
	growfs /dev/dsk/lv1
to extend your older filesystem onto the new disk.