Date: Sat, 4 Oct 2003 17:58:36 -0400 (EDT) From: Jerry McAllister <jerrymc@clunix.cl.msu.edu> To: jerrymc@clunix.cl.msu.edu (Jerry McAllister) Cc: freebsd-questions@freebsd.org Subject: Re: formatting hardrive Message-ID: <200310042158.h94LwaFh027338@clunix.cl.msu.edu> In-Reply-To: <200310042156.h94Lu8xV027324@clunix.cl.msu.edu> from "Jerry McAllister" at Oct 04, 2003 05:56:07 PM
next in thread | previous in thread | raw e-mail | index | archive | help
> > > > > Hi ! > > > > Ok, I'm at a point where I'm ready to cry :( > > Is there ANY easy way to partition/slice a hardrive for FreeBSD ????? > > I spent all morning playing with bsdlabel, sysinstall... I just want to > > partition a second hardrive so I could dump/restore the content of my first > > drive. > > So, I tried sysinstall post-install tools to create the slices and all, but > > all I get are errors like "can't write to ad2", or "can't mount /dev/ad2s1a > > on /mnt" .... > > Basically what I want is: > > ad2s1a --> /mnt > > ad2s1b --> SWAP > > ad2s1d --> /mnt/tmp > > ad2s1e --> /mnt/var > > ad2s1f --> /mnt/usr > > > > So, all I have to do after is dump / --> /mnt, /tmp --> /mnt/tmp ... and so > > on. > > I sware I tried all morning without any kind of success :( > > > > I would really appreciate some help. > > Well, although /stand/sysinstall would do it OK, it might be just > as easy to use fdisk and disklabel directly. I don't know anything > about 'bsdlabel'. > > So, presuming your extra disk is really /dev/ad2 (are there ad0 and ad1?) > do the following. > > fdisk -BI ad2 (makes one big slice on the disk) > > disklabel -w -r da0s1 auto (writes an initial label for slice 1) > > disklabel -r -e da0s1 (now edit the label to make the partitions) > this will bring up the label for slice1 in an editor - vi unless > you specify another one. Edit the partition table as needed. > Make it something like this only with the sizes you need. > You didn't mention sizes so this example is for a nominal 18GB drive > with 512 MB for a: /mnt, > 1GB for b: swap, > 512 MB for e: /mnt/tmp, > 1 GB for f: /mnt/var > and all the rest for g: /mnt/usr > NOTES: - The size is specified in number of 512 byte blocks > - Recent versions of disklabel (at least since 4.6.2 FreeBSD) > allow you to put a * for offset and it calculates it for you > - and a * for size in the last partition specified tells it to > use all rest of the slice for that partition. > By convention, partition b: is used for swap, c: is a comment used to > specify the whole slice and d: is not used for regular file systems. > > - Don't change the header stuff, just the partition size stuff. > > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > a: 1048576 0 4.2BSD 1024 8192 22 # > b: 2097152 * swap 1024 8192 22 # > c: 35551782 0 unused 0 0 # > e: 1048576 * 4.2BSD 1024 8192 22 # > f: 2097152 * swap 1024 8192 22 # > g: * * 4.2BSD 2048 16384 89 # > > When you :wq out of the edit session, it will write the label. > > Now, you have to newfs each of the partitions except for swap. > Probably just take the defaults for newfs. > > newfs /dev/ad2s1a > newfs /dev/ad2s1e > newfs /dev/ad2s1f > newfs /dev/ad2s1g > > Now mount partition a on /mnt so you can make the mount points for > the rest of the partitions. (By the way, I would suggest making > up a different mount point than /mnt because there are some other > things like to mess with that so you might make up something like /dmp > by doing mkdir /dmp, then replace /mnt with /dmp in all these commands) > > mount /dev/ad2s1a /mnt (or mount /dev/ad2s1a /dmp) > cd /mnt (or cd /dmp) > mkdir tmp > mkdir var > mkdir usr > > Now edit fstab to add the following entries > > # Disk ad2 > /dev/ad2s1a /mnt ufs rw 2 2 > /dev/ad2s1b none swap rw 0 0 > /dev/ad2s1e /mnt/tmp ufs rw 2 2 > /dev/ad2s1f /mnt/var ufs rw 2 2 > /dev/ad2s1g /mnt/usr ufs rw 2 2 > > Alternatatively, if you use /dmp for a mount point it would look like: > > # Disk ad2 > /dev/ad2s1a /dmp ufs rw 2 2 > /dev/ad2s1b none swap rw 0 0 > /dev/ad2s1e /dmp/tmp ufs rw 2 2 > /dev/ad2s1f /dmp/var ufs rw 2 2 > /dev/ad2s1g /dmp/usr ufs rw 2 2 > > Now, just mount everything. > In the future it will all be mounted at boot time. > > mount -a > > And you are done. > > By the way. Don't try to dump to the mounted directory. > eg DO NOT dump -0f /dmp/var /var > Instead, you must name a file in the directory. > dump -0f /dmp/var/var.backup /var > > Given this, I don't see why you really want to make all those > partions in the slice. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > Just make the slice with fdisk as I described and then use disklabel > to create just one large partition to hold the dump files. > So, the disklabel partition table would look something like: > > 8 partitions: > # size offset fstype [fsize bsize bps/cpg] > b: 2097152 0 swap 1024 8192 22 # > c: 35551782 0 unused 0 0 # > e: * * 4.2BSD 2048 16384 89 # > OOPS, I left out the newfs here newfs /dev/ad2s1e > > Then you would only need to create the /dmp mount point: > mkdir /dmp > > Add to /etc/fstab the following: > > # Disk ad2 > /dev/ad2s1b none swap rw 0 0 > /dev/ad2s1e /dmp ufs rw 2 2 > > Mount it with: > > mount -a > > and do dumps to files /dmp/root.backup (eg: dump -0f /dmp/root.backup /) > /dmp/tmp.backup (eg: dump -0f /dmp/tmp.backup /tmp) > /dmp/var.backup (eg: dump -0f /dmp/var.backup /var) > /dmp/usr.backup (eg: dump -0f /usr/var.backup /usr) > That way you don't have to outguess how big each separate partition for > each dump needs to be. > > Also, it is very unusual to back up /tmp since it is supposed to be > only temporary, sort of scratch space. But, that is up to you. > > ////jerry > > > > > Thanks in advance. > > > > -- > > Antoine Jacoutot > > ajacoutot@lphp.org > > http://www.lphp.org > > PGP/GnuPG key: http://www.lphp.org/ressources/ajacoutot.asc > > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310042158.h94LwaFh027338>