13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5 ■ WORKING WITH FILESYSTEMSNow mount the new disk:mount -U 79fb806d-4350-4b8c-8bc3-f3bb0c6b56f2 /mnt/clonedisk■ Note See some of the other things you can do to filesystems on the fly with tunefs in recipes 5-1 to 5-3.5-5. Resizing Partitions on the FlyIf you have old machines, you may find that you start running out of space on / after a while. It’s worthchecking that there’s not lots of space being wasted in /tmp and/or /var. Use the du command tosummarize disk usage in various directories. The -s option summarizes the disk space used by all therelevant subdirectories, and -h gives human-friendly output in megabytes/gigabytes rather than inkilobytes.du -sh /tmpdu -sh /var/*However, the bottom line is that software keeps getting bigger, as do distributions. It may be thatyou really do want everything you have installed in / but you’re still running into the size limits imposedby whatever size you set / to originally. One way to avoid this is simply to use a single nonswap partitionper disk, but that has other disadvantages; for example, separating the system/software files in / fromuser data (in /home or elsewhere) means that it’s easy to reinstall a system if you start having problemswith it.Instead, it’s useful to have options for resizing a partition when that becomes necessary. parted is avery useful utility that will resize your partition on the fly. It does have one important restriction: you canresize partitions only at their ends. You can’t move the start point of a partition. This means that youcan’t just take space from the front of the next partition along when you need to resize a partition.However, there is a way to get around this!■ Note It is strongly recommended that you read the parted manual before starting to do this and also that youhave backups of all your data (which you should have anyway, of course).Let’s say your disk setup looks like this (we’ll ignore the swap space for the moment):/dev/hda1 / 5GB 4.5GB used/dev/hda2 /local 105GB 40GB usedYou want to expand / by 5GB, which should give you enough breathing space for the immediatefuture. It requires some juggling around and may take a while (because you will need to copy largequantities of data around more than once), but this is how to do it.123Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!