[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: initializing linux partitions after installation

Nori Heikkinen <nori@sccs.swarthmore.edu> writes:

> now my question is: during setup and installation, i partitioned off
> my hard drive into a swap partition /, /usr, /var, /tmp, and /home.  i
> initialized the swap and the first three of the others, but then i
> stopped, and moved on to the rest of the installation.  now i don't
> have /tmp or /home initialized or mounted.  how do i go back and do
> this?

For the remaining partitions, which you would like to mount as /tmp
and /home, you must first create a file system on each and then mount
them where you like, taking care to move over any files already
created in the directories you will be using as a mount points so they
are not left inaccessible.

A word of caution, this all needs to be done as root and a few wrong
key presses and you will be back at square one :( Please, please be
very careful.  I don't give allot of details and I glaze over some
points as I have been following the saga of the frozen, then replaced
machine on the list for a few days :)

I'll explain how to get /home setup, /tmp will be pretty much the
same without the need for moving over old files.

Log your user out everywhere, X, VT's and then log in as root, don't
su -.

First you need to know what partition you want to use for /home.  It
is one of your unused ones so you can find it by first looking at all
the partitions you have created on the disk:

(Your setup will look slightly different of course.)

# fdisk -l /dev/hda

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1         1      8001   83  Linux
/dev/hda2             2        17    128520   82  Linux swap
/dev/hda3            18       266   2000092+  83  Linux
/dev/hda4           267      1222   7679070   83  Linux

...then check what's mounted

# mount
/dev/hda3 on / type ext2 (rw,errors=remount-ro)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hda1 on /boot type ext2 (rw,errors=remount-ro)

By looking at what partitions are defined on the disk and what's
mounted, you will be able to find the unused partitions.  Based on this
output, hda4 is defined but not currently mounted so we are going to
ASSUME it is one of the partitions you didn't finish setting up during
installation.  You want to create a filesystem on that partition.  Use
whatever filesystem type you want, I am using ext2 in this example.

# mke2fs /dev/hda4

Now you want to mount hda4 on some temporary mount point.  If /mnt
isn't in use it is a good candidate.

# mount -t ext2 /dev/hda4 /mnt

Make sure your user is logged out everywhere, we don't want to start
moving stuff while some process is using it.

Move your home dir to the temporary mount point.

# mv /home/nori /mnt

Then unmount hda4 from the temporary spot you stuck it.

# umount /mnt

...and remount it on /home like so

# mount -t ext2 /dev/hda4 /home

You should then be all set, you will want to update /etc/fstab so hda4
always comes up mounted on /home, follow the format of the other
entry's or post for more help.

good luck,

Jereme Corrado <jereme@restorative-management.com>
System Administrator
Restorative Management Corp.

"Let's call it an accidental feature."
	--Larry Wall

Reply to: