Professional Documents
Culture Documents
1. Plan the new filesystem. Where would you like to use the new space? Do
df
du
For example, I would consider using new hard drive space in one of the following mount
points:
/usr/local
/home
/home/share/downloads
/usr/local/mp3s
/usr/local/dos_data
Here is Details.
/home contains user data. Surely, it is the data that deserves the most care. It is
obviously supposed to survive any upgrade of Linux. Wow, obviously I want it on a
separate partition. The type is normally "ext2" or "raiserfs".
2. Partition the new hard drive. For example, if my new harddrive is the slave on the
second IDE interface (perhaps the "fourth" IDE drive), I could use:
cfdisk /dev/hdd
or the more old-fashioned (and standard) tool:
fdisk /dev/hdd
Partitioning can be tricky--if you never have done it, read man fdisk and man cfdisk. It is
very easy to delete a partition with all your data. Make sure you know which disk you are
working with!
fdisk or cfdisk does not make any changes to the hard drive until I write the new
partition layout. So if I make a bad mistake, I can always quit without writing. I write the
layout to the drive only when I am completely done.
3. Format each partition. For example, to format the first partition, while checking for
bad blocks (-c), I would do:
4. Test the new partitions around. Mount the new partitions manually (the mount
directory must exist and be empty). Copy a bunch of files to each partition. View/edit a
couple of random files. Delete them all.
5. Copy data. Optional--only if you would like to move data from an old partition to a
new partition. Go to the single-user mode (init 1). Mount the new partition manually.
Copy the data from the old partition to the new partition. Careful with the old data, you
probably don't want to lose it if you made a mistake, so I wouldn't delete it yet--I
rename the top level directory appropriately. E.g.,
cp -R /usr/local/ /mnt/hdd1/
mv /usr/local/ /usr/local.old.backup_of_2005-04-21
6. Edit the file /etc/fstab. Modify it to reflect your new filesystem layout. Perhaps,
insert the mountpoint for the new partition(s) or modify any old mountpoints as needed.
For example, if moving /usr/local to its own partition, I would need to add to add a line
like this:
7. Reboot and test. The alternative to reboot is to unmount old and mount new mount
points. For example:
umount /usr/local
mount -a
but hard reboot may be a more rigorous test of the new layout.
8. Remove old data. After a few days, when I have the confidence everything is really
working fine