Hello all, I have a machine that just had a new HD added to it as ad1 and I want to ADD this new disk onto the already existing /usr partition. What's the best and safest way to do it? Matt
Your only option here as far as I know is to partition the drive to be the new /usr partition. To acheive this you would preferrably put the system into single user mode, create a partition on the new drive and mount it under /mnt for example. Then copy all the data between. I prefer to use dump and pipe it into restore myself as this preserves all the filesystem flags that would get lost if you would just do a cp or tar. Then just update your fstab pointing /usr to the new drive and reboot the machine. Baldur On Fri, Nov 03, 2006 at 05:17:33PM -0500, Matt Smith wrote:> Hello all, > I have a machine that just had a new HD added to it as ad1 and I want to > ADD this new disk onto the already existing /usr partition. What's the best > and safest way to do it? > > Matt > _______________________________________________ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org" >
Torfinn Ingolfsen
2006-Nov-04 17:49 UTC
adding an extra hard disk and adding space to /usr
On Fri, 03 Nov 2006 17:17:33 -0500 Matt Smith <ratman6@charter.net> wrote:> Hello all, > I have a machine that just had a new HD added to it as ad1 and I > want to ADD this new disk onto the already existing /usr partition. > What's the best and safest way to do it?In my experience, there are only a handful of directories in /usr that uses lots of disk space. And they are related to two things: - building the system (/usr/src and /usr/obj) - building ports (/usr/ports, more specifically /usr/ports/distfiles) Of course, YMMV. Anyway, it is quite easy to install the new disk under a new mountpoint, say .. /extra1 Then you can copy the data from the directories in question with your favorite combination of cp, tar or find / cpio. Example: /usr/ports/distfiles --> /etxtra1/distfiles /usr/src --> /extra1/usr/src /usr/obj --> /extra1/usr/obj (it is perhaps easier to just blow away obj and recreate it - your choice) and so on. Finally, you symlink the new directories to their old place using 'ln -s'. Note: I prefer to rename the old directory first instead of removing it, in case something doesn't work. After testing that the new setup works, you can safely remove the old renamed directories. Please also note that this is just one way of doing things - there are others. -- Torfinn
> Hello all,Hello Matt,> I have a machine that just had a new HD added to it as ad1 > and I want to > ADD this new disk onto the already existing /usr partition. > What's the best > and safest way to do it?Well, I know of two options. One which sounds really cool, is kind of broken, and is guarteed to cause your kernel crash. So I will ignore the mount_union option. I am no expert on freebsd, but in my opinion tar is a good choice. Contrary to what others beleive, tar CAN preserve permissions, and file ownership. I know that in FreeBSD 4.x (been there several times) it can preserve filesystem permissions, and ownership of files. In my opinion, the safest way is to copy /usr to /mnt is via the following. 1: Comment out your existing SWAP partition (ad0s1b) in /etc/fstab. 2: reboot 3: remove your existing swap partition. 4: create a new filsystem on each disk that has the same size as your ram (1/2 of swap) on each disk. Both (by tradition) will be /dev/???s?b. Spanning swap to multiple disks can improve swap performance. 5: create a new UFS2 filesystem that contains the rest of the new hard drive. 6: mount the new slice as /mnt 7: use the following tar commands as root: (FreeBSD 4.x) : cd /usr; tar clpf - . | (cd /mnt; tar xvf -) (FreeBSD 5.x+) : cd /usr; gtar clpf - . | (cd /mnt; gtar xvf -) 8: edit /etc/fstab with your favorite text editor (vi) and duplicate the other /usr slice entries. Then comment out the original. And update the entry to refer to the correct slice. Next duplicate the entry for the other swap partition with the data for the other disk label). SWAP partitions are almost always end in 'b' 9: Due to the fact that killing off all of the applications that reside on /usr, its easiest to reboot. But specifically NOT a requirement. -- Aaron
on 10/11/2006 14:32 Oliver Fromme said the following:> Aaron Burke wrote: > > SNIP > > > > (FreeBSD 4.x) : cd /usr; tar clpf - . | (cd /mnt; tar xvf -) > > > > (FreeBSD 5.x+) : cd /usr; gtar clpf - . | (cd /mnt; gtar xvf -) > > > iirc tar(1) has changed in 5.3. why do you use gtar please? is new tar > > > missing something? > > Well, technically no, but it requires more typing. > > That's why I prefer to use cpio: > > cd /usr; find -dx . | cpio -dump /mnt > > which works on _any_ version of FreeBSD out of the box.$ pax rw /usr /mnt is even less typing and works on any system with POSIX-compliant utilities :-) Not to mention all other goodies that pax provides (I especially like -s option). -- Andriy Gapon