Re: Adding a Disk and Changing Mountpoints

2010-04-09 Thread Programmer In Training
On 04/09/10 00:48, Polytropon wrote:
 On Thu, 08 Apr 2010 17:38:03 -0500, Programmer In Training 
 p...@joseph-a-nagy-jr.us wrote:
 Saturday I'll be adding a second 40GB and a tertiary 6GB disk to the
 system (in favor of adding a CD-RW to a system that already has a DVD
 super multi-format drive). I'd like to rearrange my mount points a bit.

 Here we go. :-)
snip

Thank you for the detailed response. Without knowing any of that, I
would have totally messed up. I'll be printing out the email so I have
it handy on Saturday.

Again, thank you!
-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.
Original content copyright under the OWL http://owl.apotheon.org
Please do not CC me. If I'm posting to a list it is because I am subscribed.



signature.asc
Description: OpenPGP digital signature


Re: Adding a Disk and Changing Mountpoints

2010-04-09 Thread Polytropon
On Fri, 09 Apr 2010 07:44:34 -0500, Programmer In Training 
p...@joseph-a-nagy-jr.us wrote:
 Thank you for the detailed response. Without knowing any of that, I
 would have totally messed up. I'll be printing out the email so I have
 it handy on Saturday.

I made a mistake. Please check and correct this in your
hardcopy. In the example for copying the home directories,
I wrote:

# mount -o ro /dev/ad0s1f /usr
# mount -o ro /dev/ad2s1e /home

The second -o ro is wrong, has to be -o rw, because
you're writing to this partition in the next step:

# mount -o ro /dev/ad0s1f /usr
# mount -o rw /dev/ad2s1e /home

The basic idea is to work with least dangerous
permissions, so if you're going to read files from
a partition, -o ro is sufficient. But of course it's
not sufficient for writing. :-)

And for the final /etc/fstab, this is wrong:

/dev/ad0s1d  /tmpufs rw   2  2
/dev/ad0s1e  /scratchufs rw   2  2

It would have to be:

/dev/ad0s1d  /scratchufs rw   2  2
/dev/ad0s1e  /tmpufs rw   2  2

becausse /dev/ad0s1d previously was /var.

In any case, as you're working with maximum privileges
on file systems, pay attention to device names and
directories. Triple-check them. Always.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Adding a Disk and Changing Mountpoints

2010-04-08 Thread Programmer In Training
Saturday I'll be adding a second 40GB and a tertiary 6GB disk to the
system (in favor of adding a CD-RW to a system that already has a DVD
super multi-format drive). I'd like to rearrange my mount points a bit.

Here is my current fstab.

# DeviceMountpoint  FStype  Options
DumpPass#
/dev/ad0s1b noneswapsw
0   0
/dev/ad0s1a /   ufs rw
1   1
/dev/ad0s1e /tmpufs rw
2   2
/dev/ad0s1f /usrufs rw
2   2
/dev/ad0s1d /varufs rw
2   2
/dev/acd0   /mnt/cdrom  cd9660
ro,noauto   0   0
linproc /usr/compat/linux/proc  linprocfs   rw
0   0

Specifically I would like to move /usr/home to the 40GB drive and
possibly move /var to the 6GB drive (depending on how the drive
behaves). I know it should be as easy as moving the relevant directories
to the new drives once the file systems have been finalized. I'm just
curious as to any issues I might need to be on the watch for (obviously
I'll be editing fstab before moving the directories, then issuing the
mount command as appropriate).

I'm doing this move specifically for space issues. My current drive
(40GB) is nearly full (I only have 2.5GB left on /usr). I wish I
wouldn't have deleted this mornings reports so I can give a run down on
specifically how much is left everywhere, but it's getting pretty full.
Once I've moved /var and /usr/home to their own disks, how can I reclaim
what has already been allocated for them? Or will that happen
automatically? Any specific concerns about that? Or would gparted and
not fdisk be my friend here?

By the way, the above is the default configuration for my system. I did
nothing to modify the default values calculated when I did the install
(I also plan on attacking my problem with jpeg that day too, running ldd
left me with a 40+KB file to sort through).
-- 
Yours In Christ,

PIT
Emails are not formal business letters, whatever businesses may want.
Original content copyright under the OWL http://owl.apotheon.org
Please do not CC me. If I'm posting to a list it is because I am subscribed.



signature.asc
Description: OpenPGP digital signature


Re: Adding a Disk and Changing Mountpoints

2010-04-08 Thread Polytropon
On Thu, 08 Apr 2010 17:38:03 -0500, Programmer In Training 
p...@joseph-a-nagy-jr.us wrote:
 Saturday I'll be adding a second 40GB and a tertiary 6GB disk to the
 system (in favor of adding a CD-RW to a system that already has a DVD
 super multi-format drive). I'd like to rearrange my mount points a bit.

Here we go. :-)



 Specifically I would like to move /usr/home to the 40GB drive and
 possibly move /var to the 6GB drive (depending on how the drive
 behaves). I know it should be as easy as moving the relevant directories
 to the new drives once the file systems have been finalized. I'm just
 curious as to any issues I might need to be on the watch for (obviously
 I'll be editing fstab before moving the directories, then issuing the
 mount command as appropriate).

I'd suggest to use dump + restore to move the partitions' contents
partition-wise; this makes sure that file permissions and all
other stuff that may be important is copied 1:1.

Let's assume this is the point you're starting from:

/dev/ad0s1a /
/dev/ad0s1b swap
/dev/ad0s1d /var
/dev/ad0s1e /tmp
/dev/ad0s1f /usr --- includes /usr/home

You'll add other disks, let them be

/dev/ad1
/dev/ad2

And create one slice and one partitions on each of them. (It's
possible to omit creating the slice, and just creating a
partition on the pure disk covering the whole disk, this
is called a dedicated partition, and that's why other systems
may be unable to access it.)

But let's just say you're selecting the maximum compatibility
mode and create

slice /dev/ad1s1, and one partition /dev/ad1s1e
slice /dev/ad2s1, and one partition /dev/ad2s1e

You then want to make /dev/ad1s1e the new /var, and /dev/ad2s1e
the new /home.

Important: To make sure that noting unwanted may happen, do
everything in single user mode: Boot the system into SUM (boot -s),
then do:

# fsck /var /usr

# mount /dev/ad1s1e /var
# cd /var
# dump -0 -f - /dev/ad0s1d | restore -r -f -
# cd /
# umount /var

Now you have transfered the content of old /var on /dev/ad0s1e
to new /var on /dev/ad1s1e. The idea of using dump + restore
implies that you want an exact 1:1 copy partition-wise.

You can't do the same with /usr/home, because it's not on
its own partition, but it's a subtree. For copying it,
you can use cp -R or tar.

Because you won't need the symlink /home@ - usr/home in
the future, delete it now, and create a real mountpoint
for the new /home partition (on its own disk).

# cd /
# rm home   - deletes the symlink
# mkdir home- creates a real directory
# mount -o ro /dev/ad0s1f /usr
# mount -o ro /dev/ad2s1e /home
# cd /usr/home
# cp -R * /home
# umount /home

Now as you have transfered everything to the new locations,
adjust /etc/fstab accordingly. Make sure that / is rw.

# mount -o rw /

Then edit /etc/fstab using your preferred editor, e. g.

# ee /etc/fstab

# Device Mountpoint  FStype  Options  Dump   Pass#
# -  --  --  ---  -  -
/dev/ad0s1b  noneswapsw   0  0
/dev/ad0s1a  /   ufs rw   1  1
/dev/ad0s1d  /tmpufs rw   2  2
/dev/ad0s1e  /scratchufs rw   2  2
/dev/ad0s1f  /usrufs rw   2  2
/dev/ad1s1e  /varufs rw   2  2
/dev/ad2s1e  /home   ufs rw   2  2

... your other entries here...

[Esc][Enter][Enter]

Now reboot the system. If - really AFTER if you have stated
that everything is in place as inteded, delete the /usr/home
subtree and the content of /scratch (which was /var).



 I'm doing this move specifically for space issues. My current drive
 (40GB) is nearly full (I only have 2.5GB left on /usr). I wish I
 wouldn't have deleted this mornings reports so I can give a run down on
 specifically how much is left everywhere, but it's getting pretty full.

You can use df -h as well as the du -h dir utility to
find out more about the current occupation of disks or
directory subtrees.



 Once I've moved /var and /usr/home to their own disks, how can I reclaim
 what has already been allocated for them?

If you delete the content from a partition, you'll end up with
an empty partition. You can give it another mount point and use
it, for example, as /scratch partition.



 Or will that happen
 automatically?

No. Nothing of such a big impact will happen automatically.



 Any specific concerns about that? Or would gparted and
 not fdisk be my friend here?

I'd suggest using the sade program. In order to re-arrange
partitions, it's the common method to delete existing
partitions and creating new ones. This assumes that you
make backups first, then resize the partitions, and
finally load your backup.


Allow me