On Fri, Oct 24, 2003 at 10:47:45PM +1300, Richard Shea wrote:
Hi - I have a system with two IDE drives on it and I need more disk space
than I have . The current situation is :
Filesystem 1K-blocksUsed Avail Capacity Mounted on
/dev/ad0s1a257998 36308 20105215%/
/dev/ad0s1f498398 424568 3396093%/usr
/dev/ad3s1e 7939980 6610848 69393491%/usr/home
/dev/ad0s1e2267342542 206054 1%/var
procfs 4 4 0 100%/proc
I would like to swop the 1Gb ad0 drive for a larger drive. As you can see
the other IDE drive is almost full. Can anyone suggest how to move what's
on ad0 to a larger disk ? I wondered about
1. disconnecting the ad3 and putting a new drive in its place
2. then (in some way) backuping up the entirety of ad0, restoring it to
the 'fake' ad3 3. then taking out the original ad0 and replacing with ad3
4. then (in some way) persuading machine to boot off new, larget drive,
with root on it
... would that work ? Can anyone fill in the details ? It it wouldn't
work can anyone suggset an alternative bearing in in mind I can only have
two drives and the largest each can be is 8Gb (old BIOS).
You have pretty much the right idea. I'd do the job something like
this:
i) Edit your /etc/fstab and comment out the line that mounts
/usr/home.
ii) Shutdown and remove the current ad3 drive. Add your new 8Gb
disk in it's place.
iii) Reboot to single user mode, mounting all of the partition from
ad0, much as you would for doing a {build,install}world cycle:
# fsck -p
# swapon -a
# mount -a
iv) Set up the fdisk(8) slice table on your new drive: presumably
you want the whole disk to be devoted to FreeBSD. This also
sets up the boot sector so that you can eventually boot from
the disk.
# fdisk -B -b /boot/mbr -I ad3
Once you're done, modulo the exact size/cylinders/heads/sectors
of the disk you should see output something like this:
# fdisk ad3
Password:
*** Working on device /dev/ad3 ***
parameters extracted from in-core disklabel are:
cylinders=4462 heads=255 sectors/track=63 (16065 blks/cyl)
Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=4462 heads=255 sectors/track=63 (16065 blks/cyl)
Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 63, size 71681967 (35000 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
UNUSED
The data for partition 3 is:
UNUSED
The data for partition 4 is:
UNUSED
v) Set up FreeBSD partitions on your new drive using disklabel(8)
-- decide before hand what partitions and what sizes you want:
# disklabel -e ad3s1
This will pop you into an editor -- you need to add lines at
the end after where it says '8 partitions:' -- don't touch the
line for c:, but add lines for a: (/), b: (swap), e: (/usr), f:
(/var) etc. Set fstype to 4.2BSD (or swap for the swap
partition). Some calculation will be necessary here. Sizes are
given in numbers of sectors, which are usually 512bytes apiece.
Eventually you should end up with something that looks rather
like this:
#size offsetfstype [fsize bsize bps/cpg]
a: 26214404.2BSD 1024 819216 # (Cyl.0 - 16*)
b: 2097152 262144 swap# (Cyl. 16*- 146*)
c: 716819670unused0 0 # (Cyl.0 - 4461*)
e: 262144 23592964.2BSD 1024 819216 # (Cyl. 146*- 163*)
f: 12582912 26214404.2BSD 1024 819216 # (Cyl. 163*- 946*)
g: 56477615 152043524.2BSD 1024 819216 # (Cyl. 946*- 4461*)
You need to fill in the first three columns -- you can fill in
the fsize, bsize and bps/cpg fields if you want, but the
newfs(8) command used in the next step will fill in the blanks
for you. The stuff after the '#' on each line is automatically
generated.
vi) Create filesystems on the new partitions using newfs(8). There
are any number of parameters to play with when creating
filesystems which is all very confusing. If you don't have a
specific need for a specially laid out FS, then just take the
defaults. These will be fine for general purpose filesystems
of the sort of size you'll be needing:
# newfs -v /dev/ad3s1a