View Single Post
Old 4th May 2012
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default An imaginary converstaion between daemonfowl and jggimi

Friend daemonfowl, you often ask wonderful, insightful questions, but then you drop the discussion and do not seem interested in pursuing the details.

Since you haven't asked, I don't expect you to. So, rather than going through the cycle again on yet another general question, I imagined what it might be like if you had actually asked, this time.

.................................................

Quote:
Originally Posted by Rod Serling
There is a fifth dimension beyond that which is known to man. It is a dimension as vast as space and as timeless as infinity. It is the middle ground between light and shadow, between science and superstition, and it lies between the pit of man's fears and the summit of his knowledge. This is the dimension of imagination. It is an area which we call "The Twilight Zone".
Q: Is it possible to reconfigure partitions without re-installing?

A
: Of course. There are special considerations for the root partition, "/", and the /usr partition. For other partitions, it's easy enough to back up, reconfigure, and restore.

Q: What procedure do you recommend for backup/restore and reconfiguration?

A: I prefer dump(8) and restore(8) to other backup/restore tools with FFS partitions, because there are no restrictions on file types or file name lengths as can happen with tar(1), cpio(1), and tools like pax(1) which use them. There are backup and restore tools in the ports tree, but they require a re-installed, fully functional system to restore to, and I prefer the simplicity of being able to use a tool in the RAMDISK kernel for bare-metal restores. The restore(8) program is included in the RAMDISK kernel though I do need to mount a small /tmp in order to use it. As for reconfiguration, I just use disklabel(8). On a few rare occasions I've been able to take advantage of growfs(8) to increase the size of an FFS partition.

Q: I've never used dump, it looks pretty complicated from the man page.

A: It can be a little complex, because it is so versatile. There are examples of the dump and restore commands when used with tape in FAQ 14.10. I've only used these tools when dumping directly to disk or being piped to other tools -- gzip(1) for compression, ssh(1) or nc(1) for network dumps, or some combination. I often use dump/restore piped together when replicating directories or filesystems. For example, "cd /new/location; dump -0af - /old/location | restore -rf -" will replicate the files hierarchy /old/location to /new/location. The "-" file is standard output for dump, and standard input for restore.

Q: Tell me about the partitions with special considerations?

A: The /usr partition contains applications and libraries -- /usr/bin and /usr/lib. Your /usr/local hierarchy might be in its own filesystem, but it too has the same considerations. You don't want to be dependent on anything in those directories while you are moving them, which might include times when they are not available. You are limited, therefore, to using tools within the root filesystem: /bin, /sbin. You need to boot into single user mode, so that no applications dependent on /usr (or /usr/local) are running. How you get there varies by architecture (e.g.: "-s" at the boot> prompt for i386 and amd64). You can also signal init(8) to enter single user mode. Manipulating the root filesystem is more complicated still.

Q: What would I need to do for the root filesystem?

A: You would need to use the shell from the RAMDISK kernel, as the root directory must be unmounted to be manipulated. The tools there are fewer -- growfs isn't included in the RAMDISK image. But newfs(8) and restore(8) are, though as I mentioned above, you'll need to mount a partition to be used as /tmp to use restore(8). In addition, you will need to reinstall boot blocks, and that too will vary depending upon the architecture. The i386, amd64, and sparc architectures (at least) have an installboot(8) program.

Q: Any recommendations before I begin?

A: Yes. Back up your system before beginning. Really. Even if you have sufficient disk space on your currently attached drive(s) to move things around, it's easy to make a mistake. If you don't have a backup, you won't have anything to restore.

.................................................

Thank you for tuning in for this week's episode of ... The Twilight Zone.

Last edited by jggimi; 4th May 2012 at 05:46 PM. Reason: 1 typo, some clarity
Reply With Quote