Re: Shrink a Slice? FreeBSD 7.1
Thanks for your great info, the only problem is that I don't want to cause any trouble to my current system and I needed to fix this quickly. I already install the system and everything is working, I have to built a system and test your procedure step by step. This info u give to us is very important, I had done this with Linux before, and is easy, but with FreeBSD is the first time I need to do this. I will let u know my results ASAP. Thanks again for your help Jerry. On Thu, Feb 5, 2009 at 2:23 PM, Jerry McAllister jerr...@msu.edu wrote: On Thu, Feb 05, 2009 at 12:19:13PM -0800, perikillo wrote: Hi people. I have been googling without any good info about: How to shrink a slice? Case: I installed a new server for mysql, is working, I already install all the ports I need, them I spend a lot of hours yesterday with this baby, now this is my current disk layout: /dev/ad0s1a on / (ufs, local, noatime, soft-updates) devfs on /dev (devfs, local) /dev/ad0s1f on /tmp (ufs, local, noatime, soft-updates) /dev/ad0s1d on /usr (ufs, local, noatime, soft-updates) /dev/ad0s1e on /var (ufs, local, noatime, soft-updates) /dev/ad0s1g on /backups (ufs, local, soft-updates) What I want to do is to shrink the slice /dev/ad0s1g /dev/ad0s1g is a partition, not a slice. /dev/ad0s1 is the slice. MicroSloth usage of the terms is different and confuses people sometimes. As far as I know neither growfs(8) nor tunefs(8) can shrink the disk allocated to a partition. The only way is to dump each of the filesystems to some other reliable media (maybe tape or a large USB disk) and then repartition that slice to be the sizes you want.Use dump(8) to make the dumps and then check the dump files out before starting the repartitioning. First you have to build a filesystem on the USB drive. You should be able to use bsdlabel to create a single partition that covers the whole drive. But, if your FreeBSD or BIOS is old enough it might not go that big, so you will need to break it down in to smaller slices and make a partition in each. (I have had to do that. But if it is 7.xx it should not be necessary) To break it up, get the gparted utility. Download its boot image and use it to break up the USB disk in to slices that your FreeBSD will handle. You need to have it make all what it calls (in the MS way) Primary Partitions, but those are what are called slices in FreeBSD land. Don't get tempted to use gparted to shrink your ad0s1 slice because it will not work right. That will just trash the current partitions. It is not what you are looking for. Either if your FreeBSD will handle the whole USB or after you have it broken up, then build a partition on each slice of the USB using bsdlabel. Don't make it bootable or write a boot sector on it. Then run newfs(8) on it to make a filesystem. This bsdlabel and newfs can be done while the system is running. Then, take the system down and run the dumps.You can do the dumps from single user mode or boot a fixit image from the install CD. You will need to do the repartitioning and restore the dumps from the fixit anyway so you could just start there. Boot the machine from the fixit disk - create a 'holographic' image as they call it. Fixit is usually on disc1. Run the dumps. Lets say you are doing the dumps to a USB drive that comes up as /dev/da0 in the fixit boot and your current disk still is comes up with the name /dev/ad0 . First, make up mount points for all your filesystems that you want to dump plus for the filesystem[s] on the USB drive. NOTE: That the fixit runs from a memory resident filesystem so whatever you create there will disappear on boot. Anyway, skip dumping /tmp and /dev is a pretend filesystem. mkdir /oldroot mkdir /oldusr mkdir /oldvar mkdir /oldbkup mkdir /usbdrive (You can actually make the dumps from the devices rather than mounting them, but I have never gotten in to that habit) Mount those partitions mount /dev/ad0s1a /oldroot mount /dev/ad0s1d /oldusr mount /dev/ad0s1e /oldvar mount /dev/ad0s1g /oldbkup mount /dev/da0s1 /usbdrive(This device name might be different depending on how you make it. Some possibilities are: /dev/da0s1If you just newfs the slice without making a partition in it /dev/da0s1a If you make a slice with fdisk and a partition with bsdlabel /dev/da0aIf you make a partition with bsdlabel without making a slice Now do the dumps dump 0af /usbdrive/rootdump /oldroot dump 0af /usbdrive/usrdump /oldusr dump 0af /usbdrive/vardump /oldvar dump 0af /usbdrive/bkupdump /oldbkup This will take a while depending on media you use. By the way, to tape it would go to /dev/nsa0 rather than /usbdrive/oldroot, etc Once the dumps are done, you may want to reboot and mount that USB drive or read the tape and look at the dumps to make sure they can be read.
Shrink a Slice? FreeBSD 7.1
Hi people. I have been googling without any good info about: How to shrink a slice? Case: I installed a new server for mysql, is working, I already install all the ports I need, them I spend a lot of hours yesterday with this baby, now this is my current disk layout: /dev/ad0s1a on / (ufs, local, noatime, soft-updates) devfs on /dev (devfs, local) /dev/ad0s1f on /tmp (ufs, local, noatime, soft-updates) /dev/ad0s1d on /usr (ufs, local, noatime, soft-updates) /dev/ad0s1e on /var (ufs, local, noatime, soft-updates) /dev/ad0s1g on /backups (ufs, local, soft-updates) What I want to do is to shrink the slice /dev/ad0s1g Filesystem 1M-blocks Used Avail Capacity Mounted on /dev/ad0s1a 49523222351%/ devfs 0 0 0 100%/dev /dev/ad0s1f 495 0456 0%/tmp /dev/ad0s1d 5967 4225 126477%/usr /dev/ad0s1e 15863 1343 13251 9%/var /dev/ad0s1g272313 48823 20170419%/backups Like u can see, is the last slice I have, is posible to remove that slice and create a new one? I don't have info there yet and is not a freebsd default slice, I know that I need to umount first. I have been reading some post but all I have seen is that ins not possible or I'm wrong? I try to with sysinstall looks like don't let me do this. Running FreeBSD 7.1-p2. Thanks all for your time!!! ___ 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
Re: Shrink a Slice? FreeBSD 7.1
On Thu, Feb 05, 2009 at 12:19:13PM -0800, perikillo wrote: Hi people. I have been googling without any good info about: How to shrink a slice? Case: I installed a new server for mysql, is working, I already install all the ports I need, them I spend a lot of hours yesterday with this baby, now this is my current disk layout: /dev/ad0s1a on / (ufs, local, noatime, soft-updates) devfs on /dev (devfs, local) /dev/ad0s1f on /tmp (ufs, local, noatime, soft-updates) /dev/ad0s1d on /usr (ufs, local, noatime, soft-updates) /dev/ad0s1e on /var (ufs, local, noatime, soft-updates) /dev/ad0s1g on /backups (ufs, local, soft-updates) What I want to do is to shrink the slice /dev/ad0s1g /dev/ad0s1g is a partition, not a slice. /dev/ad0s1 is the slice. MicroSloth usage of the terms is different and confuses people sometimes. As far as I know neither growfs(8) nor tunefs(8) can shrink the disk allocated to a partition. The only way is to dump each of the filesystems to some other reliable media (maybe tape or a large USB disk) and then repartition that slice to be the sizes you want.Use dump(8) to make the dumps and then check the dump files out before starting the repartitioning. First you have to build a filesystem on the USB drive. You should be able to use bsdlabel to create a single partition that covers the whole drive. But, if your FreeBSD or BIOS is old enough it might not go that big, so you will need to break it down in to smaller slices and make a partition in each. (I have had to do that. But if it is 7.xx it should not be necessary) To break it up, get the gparted utility. Download its boot image and use it to break up the USB disk in to slices that your FreeBSD will handle. You need to have it make all what it calls (in the MS way) Primary Partitions, but those are what are called slices in FreeBSD land. Don't get tempted to use gparted to shrink your ad0s1 slice because it will not work right. That will just trash the current partitions. It is not what you are looking for. Either if your FreeBSD will handle the whole USB or after you have it broken up, then build a partition on each slice of the USB using bsdlabel. Don't make it bootable or write a boot sector on it. Then run newfs(8) on it to make a filesystem. This bsdlabel and newfs can be done while the system is running. Then, take the system down and run the dumps.You can do the dumps from single user mode or boot a fixit image from the install CD. You will need to do the repartitioning and restore the dumps from the fixit anyway so you could just start there. Boot the machine from the fixit disk - create a 'holographic' image as they call it. Fixit is usually on disc1. Run the dumps. Lets say you are doing the dumps to a USB drive that comes up as /dev/da0 in the fixit boot and your current disk still is comes up with the name /dev/ad0 . First, make up mount points for all your filesystems that you want to dump plus for the filesystem[s] on the USB drive. NOTE: That the fixit runs from a memory resident filesystem so whatever you create there will disappear on boot. Anyway, skip dumping /tmp and /dev is a pretend filesystem. mkdir /oldroot mkdir /oldusr mkdir /oldvar mkdir /oldbkup mkdir /usbdrive (You can actually make the dumps from the devices rather than mounting them, but I have never gotten in to that habit) Mount those partitions mount /dev/ad0s1a /oldroot mount /dev/ad0s1d /oldusr mount /dev/ad0s1e /oldvar mount /dev/ad0s1g /oldbkup mount /dev/da0s1 /usbdrive(This device name might be different depending on how you make it. Some possibilities are: /dev/da0s1If you just newfs the slice without making a partition in it /dev/da0s1a If you make a slice with fdisk and a partition with bsdlabel /dev/da0aIf you make a partition with bsdlabel without making a slice Now do the dumps dump 0af /usbdrive/rootdump /oldroot dump 0af /usbdrive/usrdump /oldusr dump 0af /usbdrive/vardump /oldvar dump 0af /usbdrive/bkupdump /oldbkup This will take a while depending on media you use. By the way, to tape it would go to /dev/nsa0 rather than /usbdrive/oldroot, etc Once the dumps are done, you may want to reboot and mount that USB drive or read the tape and look at the dumps to make sure they can be read. Just a precaution. At least you will need to unmount all the partitions so bsdlabel can work on them Anyway, once you are happy with your dumps, then get back in to the fixit and use bsdlabel to rewrite the partitions. Just bsdlabel -e ad0s1 (You should not need to write a new boot block as this process should not touch that sector) Adjust the partitions as you see fit. Make partition 'a' start at offset of 0 and use a '*' for the rest of the offsets. bsdlabel will calculate them correctly. You can also make the size of the last partition be '*' and bsdlabel will put the remainder of the usable space in it.