Please keep your hands and arms inside the vehicle until it has come to a complete stop.
Now I need to do a reboot. At the command prompt:
# shutdown -r +3
shutdown, do I really need to define this.
-r reboot
+3 initiate the command in 3 minutes
I rebooted no problem
Now for the scary math part.
# disklabel -r ad0
disklabel is same thing as the disklabel editor we saw in Fig.8. However we are doing it from the command line so as to make more
options available.
-r read only
ad0 the first hard drive
# disklabel -r ad0
# /dev/ad0c:
type: ESDI
disk: ad0s1
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 128
sectors/cylinder: 8064
cylinders: 784
sectors/unit: 6330177
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 204800 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 25*)
b: 138768 204800 swap # (Cyl. 25*- 42*)
c: 6330177 0 unused 0 0 # (Cyl. 0 - 784*)
e: 40960 343568 4.2BSD 1024 8192 16 # (Cyl. 42*- 47*)
f: 5945649 384528 4.2BSD 1024 8192 16 # (Cyl. 47*- 784*)
Based upon the above information I was able to come up with the following chart.
kilobyte = 1024 bytes (1024 = 2^10), abbreviated KB (Kb is kilobits)
megabyte = 1024 KB = 1,048,576 bytes, abbreviated MB (Mb is megabits)
gigabyte = 1024 MB = 1,073,741,824 bytes, abbreviated GB (Gb is gigabits)
512 byte = 1 sector
1024bytes = 2 sectors
8064 sectors = 1 cylinder
bytes kilo mega giga sectors cylinders
512 1
1024 1 2
1048576 1024 1 2048
4128768 4000 4 8064 1
1073741824 1000000 1024 1 2097152 261
2147483648 2000000 2000 2 4194304 521
3221225472 3000000 3000 3 6291456 781
4294967296 4000000 4000 4 8388608 1041
6442450944 6000000 6000 6 12582912 1561
NOTE: this chart only applies to the hard drive shown . Other hard drives will have different
sector/cylinder ratios.
Okay According to the chart I have a slight larger than 3 gig drive. Actually I have a 3.2gig drive
so that is on the money.
Okay right about now you brain is about to explode and you are looking at that going "say what?".Lets take it a little easy and I will show
you how I did this. Lets look at some of the items that showed up in our result to the disklabel command.
bytes/sector: 512 that is how many bites per sector. So what? This is like an ugly word problem so we need to hang
onto all the information.
sectors/track: 63 You can ignore this
tracks/cylinder: 128 You can ignore this
sectors/cylinder: 8064 You can ignore this since what I am doing won't be to complicated.In other cases this will be very important.
cylinders 784 This is the total of cylinders and is also important.
So how is any of this important. The section under 8 partitions that is labeled a,b,c,d,e,f?
The column marked size shows how many sectors are
being used for directories. Go to here to see how they coordinate if you are still confused.
a, is the / directory
b, is the swap directory
c, shows the whole drive
e, is the /var directory
f, is the /usr directory
We moved the /usr to ad1 earlier and this disklabel was only for ad0. So we no longer need the f section for the /usr on this drive. So we
need it's numbers.
e + f = new directory size for /var
40960 + 5945649 = 5986609
sector + sector = new sector size
That will also combine the cylinders when we increase the size of the partition.
e + f = new cylinder grouping
42/47 + 47/784 = 42/784
Now get rid of the f section of ad0.
# disklabel -e -r /dev/ad0s1
# /dev/ad0s1:
type: ESDI
disk: ad0s1
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 128
sectors/cylinder: 8064
cylinders: 784
sectors/unit: 6330177
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 204800 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 25*)
b: 138768 204800 swap # (Cyl. 25*- 42*)
c: 6330177 0 unused 0 0 # (Cyl. 0 - 784*)
e: 40960 343568 4.2BSD 1024 8192 16 # (Cyl. 42*- 47*)
f: 5945649 384528 4.2BSD 1024 8192 16 # (Cyl. 47*- 784*)
~
~
~
~
~
~
~
~
~
~
~
~
~
~
I am in a vi editor now. The rules are very different here.So if you think you made a mistake. Hit ESC then : then q and then !.
:q! then press enter
That takes you out without making any changes. I go back in by disklabel -e -r /dev/ad0s1. Now lets see what I did. I moved the cursor
down to line f. Then I pressed dd. that is the d key twice. It should erase line f. I did that and now I want to save the changes. Press ESC
then: then w, then q.
:wq then press enter
This will save the changes I made.
Now do it again:
# disklabel -e -r /dev/ad0s1
# /dev/ad0s1:
type: ESDI
disk: ad0s1
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 128
sectors/cylinder: 8064
cylinders: 784
sectors/unit: 6330177
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 204800 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 25*)
b: 138768 204800 swap # (Cyl. 25*- 42*)
c: 6330177 0 unused 0 0 # (Cyl. 0 - 784*)
e: 40960 343568 4.2BSD 1024 8192 16 # (Cyl. 42*- 47*)
~
~
~
~
~
~
~
~
~
~
~
~
~
~
I need to change the size of e. Press ESC , :%s/40960/5986609/, then do the :wq again.
the :%s tells the vi editor to replace the number
sequence 40960 with 5986609. Which is the number we came up with when we added the sectors. You can check to see if it
worked by disklabel -e -r /dev/ad0s1. The section under e should look like this:
e: 5986609 343568 4.2BSD 1024 8192 16 # (Cyl. 42*- 784*)
The size number went from 40960 to 5986609. See how the Cyl. numbers changed. Neat. Don't forget to exit in this case with :q!
Thought this was tough, it gets worse.