Linux Miscellaneous Notes
DHCPD
# cat /etc/dhcpd.conf
subnet 135.207.16.0 netmask 255.255.240.0 {
range 135.207.27.100 135.207.27.128;
}
# > /etc/dhcpd.leases
See also: man dhcpd
Cloning Bootable System Disks
example - clone /dev/hda to /dev/hdb
items in bold case may have to be replaced
with your values
cleanly shutdown and power-off your computer, install the new
drive, e.g., as
hdb, then boot
duplicate disk partitions (or use your favorite fdisk tool to partition
manually, e.g., for a larger disk)
# sfdisk -d /dev/hda > /tmp/hda.sfdisk
# sfdisk /dev/hdb < /tmp/hda.sfdisk
make file systems - choose one of the following:
-
for ext2
# mke2fs /dev/hdb1; mke2fs /dev/hdb5
-
for ext3
# mke2fs -j /dev/hdb1; mke2fs -j /dev/hdb5
-
to change ext2 to ext3
# tune2fs -j /dev/hdb1
# tune2fs -j /dev/hdb5
label file systems
# e2label /dev/hdb1 /boot; e2label /dev/hdb5 /
mount file systems
# mount /dev/hdb5 /mnt/tmp
# mkdir /mnt/tmp/boot
# mount /dev/hdb1 /mnt/tmp/boot
copy data - choose one of the following:
-
find/cpio for each fs mount point
# cd /; find boot -mount -print0 | cpio -padum0 /mnt/tmp
# cd /; find . -mount -print0 | cpio -padum0 /mnt/tmp
# mkdir /mnt/tmp/mnt/tmp/cdrom /mnt/tmp/mnt/tmp/floppy
-
dump/restore
cd /mnt/tmp/boot; dump -0 -f - /boot | restore -r -f -
cd /mnt/tmp; dump -0 -f - / | restore -r -f -
make swap
# mkswap /dev/hdb6
make bootable
edit special lilo configuration file should have the following lines
# cd /mnt/tmp
# cp /etc/lilo.conf etc/lilo.conf.hdb
# ed etc/lilo.conf.hdb # make sure to edit the root= references
to point to where the new disk will be, e.g., hda or sda
boot=/dev/hdb
disk=/dev/hdb
bios=0x80
# ed etc/fstab # maker sure to edit any sda/hda changes that will take
place
# lilo -r . -C /etc/lilo.conf.hdb # use -l if you have geometry
problems "LI" or edit /etc/disktab to match BIOS boot geometry
finish
# sync
# umount /mnt/tmp/boot
# umount /mnt/tmp
# sync
# halt
reconfigure drives, e.g., slave to master, etc
Reiserfs root partition
example - copy master-root to reiserfs /dev/hda5
# mkreiserfs -h r5 /dev/hda5
# mount -t reiserfs /dev/hda5 /mnt/tmp
# cd master-root; find . -print0 | cpio -padum0 /mnt/tmp
# cd /mnt/tmp
# ed etc/fstab # - remove e2label tag and set fstype to reiserfs
/dev/hda5
/
reiserfs defaults 1 1
# ed etc/rc.d/rc.sysinit # - remove fsck's that will fail
# initlog -c
"fsck -T -a $fsckoptions /"
# initlog -c
"fsck -T -R -A -a $fsckoptions"
NoBell Home - gjm
- last update 1/22/2001