> > I have an existing FreeBSD v4.7 installation and want to delete a small > filesystem that I had designated for email (/var/mail), and want to freeup > that unused space to the '/usr/home' filesystem. If I use DISKLABEL to > delete '/var/mail', and then re-write '/usr/home' to reflect the added > space (writing the changes to the SAME '/usr/home' partition), will that > erase the '/usr/home' filesystem and all of its user-data contents > from the disk itself???
If I understand what you are saying, you have two (ingoring others that are not involved such as root) file systems /var/mail and /usr/home and you want to combine the space from /var/mail in to /usr/home. By filesystems I do not mean just directories within other filesystems. They are separately mountable entities. If they are just directories within their respective filesystems eg you have /var and /usr filesystems and mail is just a directory within /var and home is just a directory within /usr, then it is a completely different story. To combine those two filesystems (/var/mail and /usr/home) you need to repartition the disk using disklabel and then run newfs again. Running newfs on the newly combined larger partition will wipe out everything previously (sort of - it doesn't actually overwrite the data, just the superblocks which makes it unreachable by normal means). There is something called 'growfs' that can allow a filesystem to grow to take in some additional free space without wiping out what was already in the filesystem. I have not yet used growfs, but it might work for you. I would guess that at the least you would have to use disklabel to remove the partition that is used for /var/mail. Someone else might better comment on growfs. The disk space to be added must be addressibly contiguous to the base filesystem that you are trying to increase. I believe that is true for growfs as well as for recreating the filesystem with disklabel and newfs. If the two spaces are not contiguous, then you will have to redo your who slice partitioning schema and remake all of the partitions and re-newfs them. Since I can't say much about growfs, I will comment only on merging the full re-creation way. So, presuming the two spaces are contiguous, NOTE: this is best done in single user mode, but can be done in multi. make a good backup of the /usr/home filesystem. Use dump(8) dump -0af /dev/nrsa0 /usr/home (presumes a tape drive. Change the device to whereever you dump to) Check it out with restore. mt rewind restore -ivf /dev/nrsa0 look around a little, maybe restore a file. Then unmount the filesystems umount /usr/home umount /var/mail Then bring up disklabel disklabel -r -e /da0s1 (or whatever the disk slice device is) edit the partition table to combine the two in to one. Example, say disklabel shows something like the following: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 2514944 0 4.2BSD 2048 16384 89 # (Cyl. 0 - 156*) b: 4618240 2514944 swap # (Cyl. 156*- 444*) c: 35551782 0 unused 0 0 # (Cyl. 0 - 2212*) e: 2514944 7133184 4.2BSD 2048 16384 89 # (Cyl. 444*- 600*) f: 25903654 9648128 4.2BSD 2048 16384 89 # (Cyl. 600*- 2212*) and you want to combine partitions e and f Edit it to look like the following (all the stuff after the # is ignored so nuke it) 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 2514944 0 4.2BSD 2048 16384 89 # (Cyl. 0 - 156*) b: 4618240 2514944 swap # (Cyl. 156*- 444*) c: 35551782 0 unused 0 0 # (Cyl. 0 - 2212*) e: 28418598 7133184 4.2BSD 2048 16384 # Or better yet, if you are using a recent FreeBSD version 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 2514944 0 4.2BSD 2048 16384 89 # (Cyl. 0 - 156*) b: 4618240 * swap # (Cyl. 156*- 444*) c: * 0 unused 0 0 # (Cyl. 0 - 2212*) e: * * 4.2BSD 2048 16384 # The newer disklabel will calculate for you all of the offsets and the size of the 'c' partition and the last partition if that is to be all of the remaining disk. Note in either case you are leaving the other partitons as is (whatever that may be in your case). Get out of the editor with a write back (save). You might want to check it to make sure it is happy by doing: disklabel -r da0s1 which forces it to read the actual label Then do the newfs newfs /dev/rda0s1e Get the device right or you have big trouble mount the newly remade filesystem mount /usr/home (presuming it is already in /etc/fstab from before) Restore the backup cd /usr/home mt rewind restore -xf /dev/nrsa0 When it finishes, all should be well. If the spaces are not contiguous on the disk (as shown by disklabel) then you will have to back up each partition, adjust the partitioning for all of the partitions with disklabel. Newfs each of the newly moved partitions and then restore the backups. If it seems complicated, it helps to write down all the commands in advance. It is easy to forget a step in the heat of the moment if you are not used to doing this stuff (even if you are used to it). If the spaces are contiguous, check out growfs to see if it will work well. If /var/mail and/or /usr/home are not separate filesystems, but just directories within filesystems, you will have to do a variation on the whole reshuffle - at least for the filesystems involved. Good luck, ////jerry > > _______________________________________________ > [EMAIL PROTECTED] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" > _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"