IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New IANGNAIY
I Am Not Greg Nor Am I You
Edit /etc/fstab ...
... configure it appropriately ...

1) Edit it how?

2) Define "appropriately".

Remember, IANASysadmin. I don't know this stuff as well as you two. If I knew the "appropriate" way to twiddle things, or even which things to twiddle, I wouldn't have needed to ask the question. Unless there is already a script somewhere that answers all the questions that will come up[1] I'm going to go with the way I am confident will work. And that's the get/set-selections drill, and copying /home.


[1] I'm not asking anyone to do the work for me. Just saying that if there's not already a step-by-step guide that will get me through it, I'm going to go with the method I'm confident I won't screw up.
===

Implicitly condoning stupidity since 2001.
New Partitioning
Drew wrote:

>> Edit /etc/fstab ...
>> ... configure it appropriately ...

> 1) Edit it how?
> 2) Define "appropriately".

That's kind of a Religious Question<tm>. Epic jihads have been lauched over the matter of system partitioning. Here's my wacky, somewhat over-complex entry into the sweepstakes, from my main server:

\nuncle-enzo:~# cat /etc/fstab\n# /etc/fstab: static file system information.\n#\n# filesys    mountpoint   type    options                       dump   pass \n/dev/sda5   /             ext3    defaults,errors=remount-ro     1       1\n/dev/sda7   none          swap    sw                             0       0\n/dev/sdb6   none          swap    sw                             0       0\nproc        /proc         proc    defaults                       0       0\n/dev/fd0    /mnt/floppy   auto    defaults,user,noauto           0       0\n/dev/sda1   /boot         ext2    ro,noauto,noexec,nosuid,nodev  1       2\n/dev/sda6   /mnt/recovery ext2    rw,noauto                      0       2\n/dev/sdb7   /var          ext3    rw,nodev,nosuid,noatime        1       2\n/dev/sda8   /var/log      ext3    rw,nodev,nosuid,noatime        0       2\n/dev/sdb8   /usr          ext2    ro,nodev                       1       2\n/dev/sda9   /usr/local    ext3    rw                             1       2\n/dev/sdb1   /home         ext3    rw,nodev,nosuid                1       2\n/dev/sdb5   /tmp          ext3    rw,nosuid,nodev,noatime        0       2\nuncle-enzo:~# df -H\nFilesystem             Size   Used  Avail Use% Mounted on\n/dev/sda5              985M   166M   769M  18% /\n/dev/sdb7              2.0G   1.2G   745M  61% /var\n/dev/sda8              985M   139M   797M  15% /var/log\n/dev/sdb8              3.0G   848M   2.0G  31% /usr\n/dev/sda9              5.0G   2.2G   2.6G  46% /usr/local\n/dev/sdb1              985M   781M   154M  84% /home\n/dev/sdb5              291M   9.2M   267M   4% /tmp\n/dev/sda1               97M    10M    82M  11% /boot\nuncle-enzo:~# \n


Since the machine has two physical disks (sda and sdb), I've put some swap space on each of them, and split pieces of the system filesystem between them, hoping to split head-seeking activity between them, to maximise mass-storage performance. Parts of the tree at risk for explosive file growth (/home, /var, /tmp) are carefully kept off the root filesystem to protect the latter. The separate /boot partition is a bit of an archaism, and I probably won't do that with future system builds.

The "noatime" flag is a performance aid on parts of the tree where I figure the atime date stamp isn't really needed or useful. The other "no*" flags are perhaps feeble measures at greater system security. (Don't try "noexec" on /tmp; packages often try to run preinst or postinst scripts in there!) Note that /boot and /usr are the only non-journaled filesystems: Being mounted read-only, there's no point in journaling overhead.

The read-only flag ("ro") on the /usr filesystem helps prevent accidental system catastrophe at the sysadmin's hands or equivalent, but you'll want some mechanisms to remount it read/write for package installation/removal, such as the shell scripts I call from /etc/apt/apt.conf:

\nDPkg {\n        // Auto re-mounting of a readonly /usr\n        Pre-Install-Pkgs {"/home/rick/aptdpkgro.sh";};\n        Pre-Invoke {"mount -o remount,rw /usr";};\n        Post-Invoke {"/home/rick/aptdpkgclean.sh; mount -o remount,ro /usr";};\n}\nuncle-enzo:/etc/apt# cd /home/rick \nuncle-enzo:/home/rick# cat aptdpkgro.sh \n#!/bin/sh\n\npathmatch="^/usr"\n\nwhile read debname; do\n        pkg=$(dpkg --info $debname | sed -n 's/^ Package: *//p' | head -1)\n        (dpkg -L "$pkg" 2>/dev/null || true) | grep "$pathmatch" |\n          while read file; do\n                [ -f "$file" -a ! -L "$file" ] || continue\n                dir=`dirname "$file"`;\n                base=`basename "$file"`;\n                inode=`find "$file" -printf "%i\\n"`\n                (cd "$dir" && ln "$base" ".${base}.dpkg-ro-used.$inode")\n                echo "$dir/.${base}.dpkg-ro-used.$inode"\n          done >>/var/lib/my_ro_hack.todel\ndone\n\nuncle-enzo:/home/rick# cat aptdpkgclean.sh \n#!/bin/sh\n\npathmatch="^/usr"\n\ncat /var/lib/my_ro_hack.todel | while read file; do\n        [ -f "$file" ] || continue\n        N1=`find "$file" -printf "%i\\n"`\n\n        b=`basename $file`; d=`dirname $file`\n        XF="${b#.}"; XF="$d/${XF%.dpkg-ro-used.*}"\n        N2=`find "$XF" -printf "%i\\n"`\n\n        if [ "$N1" != "$N2" ] && ! fuser -s "$file"; then\n                rm -f "$file"\n        else\n                echo "$file"\n        fi\ndone >/var/lib/my_ro_hack.todel.new\nmv /var/lib/my_ro_hack.todel.new /var/lib/my_ro_hack.todel\n\nuncle-enzo:/home/rick#\n


Anyhow, the first thing you have to decide is which parts of your system tree will need their own partitions, and how big each will be. Then, decide which will be journaled using your journaling religion of choice (ext3, XFS, ReiserFS, JFS). Boot the Knoppix disk. Open a terminal and do "sudo bash" to get a root shell. Type "mount" to see what Knoppix might have automounted at boot time; umount anything it mounted from the target hard drive. Fire up /sbin/fdisk or /sbin/cfdisk (your choice) to create desired partitions. Keep notes on paper of what you're doing and which partition is which. When you're done, save and exit, then use mkfs.ext3, mkreiserfs, mkfs.xfs, mkfs.ext2, or whatever is approriate to high-level format the various partitions. Don't forget to mkswap for the swap partition(s). When you're done with that, mount the target root filesystem onto /mnt (or wherever you prefer), then mount the various other target filesystems to their respective mountpoints underneath /mnt. Now, you're ready to copy files from some other machine across the network. (Examples of how to do so using various tools such as tar, rsync, etc. are given in [link|http://linuxmafia.com/~rick/linux-info/kb/200|http://linuxmafia.co...linux-info/kb/200] .) Last, don't forget to construct an appropriate /etc/fstab (which at that moment will be /mnt/etc/fstab) using a text editor, to reflect the new filesystems you've created.

The table of filesystems I posted above is probably way, way overcomplex for most people's needs, but I've posted it because it illustrates some partitioning concepts. The one from my laptop is a bit more modest:

\nrick@guido:~$ cat /etc/fstab \n# /etc/fstab: static file system information.\n#\n#  file system   mount point     type    options                         dump   pass \n/dev/hda3       /               ext3    defaults,errors=remount-ro      0      1\n/dev/hda2       none            swap    sw                      0       0\nproc            /proc           proc    defaults                        0      0\n/dev/fd0        /floppy         auto    defaults,user,noauto            0      0\n/dev/cdrom      /cdrom          iso9660 defaults,ro,user,noauto         0      0\nnone            /proc/bus/usb   usbdevfs defaults                       0      0\n/dev/sda        /mnt/fob        vfat    rw,uid=1000,gid=1000,user,noauto,noatime       0       0\n/dev/hda1       /boot           ext2    rw,noauto                       0      2\nrick@guido:~$ \n


When in doubt, go with something simple (maybe something really simple, more than the laptop example above). When you need something more complex, you'll know it, and can reconfigure your system at that time.

Rick Moen
rick@linuxmafia.com


If you lived here, you'd be $HOME already.
New Thanks. Very nice. Someone please twikify this...
New Done. Please send gentle brickbats this way.
I appended Rick's post to Karsten's [link|http://twiki.iwethey.org/twiki/bin/view/Main/NixPartitioning|NixPartitioning] page. Please let me know if I violated protocols or generally made a mess of things by directing your gentle [link|http://dictionary.reference.com/search?q=brickbat|brickbats] to me.

Thanks.

Cheers,
Scott.
New Cool
Looks really nice. If I'd known that my meandering rant was going to keep such good company, I would have done a better job. ;->

I'll probably get around to fixing it up a bit, in fact -- such as supplying the omitted explanation of what the /mnt/recovery partition is all about. It's a 450 MB filesystem, normally unmounted, that I tend to create on all my servers and put there a duplicate of the basic system with all essential pieces required to do the machine's work. If the system's ever trashed -- e.g., the one time that I had a power failure just as all the libraries in /usr/lib were getting relinked -- then I have something already in place to jury-rig the system with until I can rebuild it.

Rick Moen
rick@linuxmafia.com


If you lived here, you'd be $HOME already.
New Re: Cool
Love ya Rick, but you make things too complex.
-drl
New Why to have a maintenance partition
Ross wrote:

Love ya Rick, but you make things too complex.

In this case, it's all about downtime.

When the debacle with /usr/lib happened, I had a big problem: The machine is a 2U rackmount box with no CD-ROM drive, and all I had to recover with was floppy disks. E.g., take your pick: Tom's Root/Boot, Slackware installation floppies, Debian installation floppies. So, I think I booted one of the former, to try to figure out what had happened (which took a while in itself).

When I finally did figure out that /usr/lib's contents had gotten massively mislinked, rebuilding the libs from the floppy-based maintenance system alone proved impossible, because there were just too many incompatibilities between the software packaged by Tom Oehser on the floppy and the HD-based facilities I was trying to repair. I couldn't even get dpkg and apt-get to work.

In the end, I was obliged to do things the hard way: I copied the package database (/var/lib/dpkg/status) over to another machine (along with /etc/* and other essentials) blew away the entire machine contents except for /home, /usr/local, and parts of /var, did a fresh Debian-base install, reset apt selections from the preserved package database, did apt-get fetches to get the installed packages back, copied the system configuration back, and was back in business.

But that took too damned long and too much trouble. Having a maintenance partition, ready to use and configured close enough to the in-service one, would have made the whole affair tremendously easier, so that's when I decided to have one around on critical machines from that point forward.

Rick Moen
rick@linuxmafia.com


If you lived here, you'd be $HOME already.
New What he said

I've similary got a "system2" install, though it's on a 132MB partition, and only uses 108 MB of that (excludes kernel). It consists of a very small subset of Debian, only 109 packages. Typically it's unmounted.

.\r\n\r\n

Thus, my recovery options for a system are typically:

\r\n\r\n
    \r\n
  • Single-user
  • \r\n
  • init=/bin/bash
  • \r\n
  • alternate kernel
  • \r\n
  • /system2
  • \r\n
  • Knoppix
  • \r\n
  • LNX-BBC
  • \r\n
  • Tom's Root Boot
  • \r\n
\r\n\r\n

Lots of fallback options.

\r\n\r\n

Might be interesting to compare what packages folks are including in rescue systems.

.
--\r\n
Karsten M. Self [link|mailto:kmself@ix.netcom.com|kmself@ix.netcom.com]\r\n
[link|http://kmself.home.netcom.com/|http://kmself.home.netcom.com/]\r\n
What part of "gestalt" don't you understand?\r\n
[link|http://twiki.iwethey.org/twiki/bin/view/Main/|TWikIWETHEY] -- an experiment in collective intelligence. Stupidity. Whatever.\r\n
\r\n
   Keep software free.     Oppose the CBDTPA.     Kill S.2048 dead.\r\n[link|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html]\r\n
New Did some edits, see page.
--\r\n
Karsten M. Self [link|mailto:kmself@ix.netcom.com|kmself@ix.netcom.com]\r\n
[link|http://kmself.home.netcom.com/|http://kmself.home.netcom.com/]\r\n
What part of "gestalt" don't you understand?\r\n
[link|http://twiki.iwethey.org/twiki/bin/view/Main/|TWikIWETHEY] -- an experiment in collective intelligence. Stupidity. Whatever.\r\n
\r\n
   Keep software free.     Oppose the CBDTPA.     Kill S.2048 dead.\r\n[link|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html]\r\n
New Re: IANGBAIM
\r\n1) Edit it how?\r\n
\r\n\r\n

With an editor.

\r\n\r\n
\r\n2) Define "appropriately".\r\n
\r\n\r\n

In the case of /etc/fstab: you'll need an entry for each mounted partition. This would include the device file, mountpoint, filesystem type, mount options, and dump/pass values.

\r\n\r\n

As a practical matter, I'll assume you largely keep your partitioning intact (I'd recommend: /, /boot, /tmp, /usr, /var, /home, and possibly /usr/local or others). Just make sure the device files correspond the the partition numbers on the new system.

\r\n\r\n

I'd hope that's relatively clear. Rick dives into the details.

--\r\n
Karsten M. Self [link|mailto:kmself@ix.netcom.com|kmself@ix.netcom.com]\r\n
[link|http://kmself.home.netcom.com/|http://kmself.home.netcom.com/]\r\n
What part of "gestalt" don't you understand?\r\n
[link|http://twiki.iwethey.org/twiki/bin/view/Main/|TWikIWETHEY] -- an experiment in collective intelligence. Stupidity. Whatever.\r\n
\r\n
   Keep software free.     Oppose the CBDTPA.     Kill S.2048 dead.\r\n[link|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html|http://www.eff.org/alerts/20020322_eff_cbdtpa_alert.html]\r\n
     Best way to move to a new Debian box? - (drewk) - (30)
         steal karsten's -NT - (boxley)
         Wonder if you could... - (gdaustin)
         IANK, but I'd do a fresh install. - (Another Scott) - (4)
             That's what I'll be doing - (drewk) - (2)
                 old: dpkg --get-selections ---> new: dpkg --set-selections -NT - (folkert) - (1)
                     Right, typo, thanks -NT - (drewk)
             ICLRPD (new thread) - (kmself)
         Personally... - (folkert) - (17)
             Too much fiddling required - (drewk)
             I*A*K, and IDWGS - (kmself) - (12)
                 NM - (deSitter) - (1)
                     Advantages of Knoppix... - (kmself)
                 IANGNAIY - (drewk) - (9)
                     Partitioning - (rickmoen) - (7)
                         Thanks. Very nice. Someone please twikify this... -NT - (Another Scott) - (6)
                             Done. Please send gentle brickbats this way. - (Another Scott) - (5)
                                 Cool - (rickmoen) - (3)
                                     Re: Cool - (deSitter) - (2)
                                         Why to have a maintenance partition - (rickmoen) - (1)
                                             What he said - (kmself)
                                 Did some edits, see page. -NT - (kmself)
                     Re: IANGBAIM - (kmself)
             I knew this would involve knoppix some how.... - (gdaustin) - (2)
                 Actually... - (folkert) - (1)
                     Snork. You MEANT to write that (no edit)! Doubledamint! -NT - (FuManChu)
         Migration done - (drewk) - (1)
             "Spare Time?" You're a funny man, Mr. Drew. :-) -NT - (Another Scott)
         Re: Best way to move to a new Debian box? - (qstephens) - (2)
             Re: Best way to move to a new Debian box? - (rickmoen) - (1)
                 ICLRPD (new thread) - (Steve Lowe)

I don't usually win conversations this decisively.
183 ms