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

Re: Post install partitioning



On Thu, 2002-07-18 at 23:52, alex wrote:
> ----- Original Message -----
> From: "Oliver Elphick" <olly@lfix.co.uk>
...
> > Suppose you want to create a new partition for /var:
> >
> >     Boot into single-user mode - this is because with /var you will be
> >     deleting stuff that is currently in use in a multi-user
> >     environment.  It isn't necessary if you're moving /home or the
> like.
> >
> >     # cfdisk /dev/hdc      # partition new hard disk
> 
> hdc???   I think my hdc is for CDROM but I do have / installed on hdb.
> Can't I just make additional partitions for /var and the others on hdb
> or hda
> with appropriate partition numbers?

Of course; /dev/hdc was chosen by way of example only.

/dev/hdc is the master disk on the second IDE channel; /dev/hdb is the
slave on the first channel.  I believe that, if you are adding a second
disk, it is more efficient to have the cdrom be a slave and the new hard
disk be the master on the second channel.  If you do it that way, your
cdrom will no longer be hdc but hdb or hdd.

> >     # mke2fs /dev/hdc1     # Make a file system on new partition
> >     # mount /dev/hdc1 /mnt # mount it on /mnt
> >     # cd /var              # don't forget this or the next commands
> >                            # will destroy everything
> >     # cp -a . /mnt         # copy the filetree to the new filesystem
> 
> Is the period a typo or does it belong here and in the next command?

It belongs.  It means the current directory (and .. means the parent
directory).

Since that question shows that you are not at all experienced with
Linux, let me stress that you should check the man pages for all
commands and be sure that you understand what you are doing,
particularly if you are doing it as superuser.

I remember a dreadful example from a client many years back: he wanted
to delete some files in the root directory (/) whose names began with &,
so, as superuser, he entered "rm -rf /&*".  He had forgotten, or never
learnt, that '&' means run the preceding command in the background.  He
didn't realise what he had done until his command deleted some files
that the O/S needed to keep running.  When we tried to put his system
back together, we found that he had never checked that his backups were
restorable - they failed at the tape boundaries.
 
> >     # rm -rf .             # delete it from the old filesystem
> >     # umount /mnt          # remove the new partition from /mnt
> >     # mount /dev/hdc1 /var # and put it in its new position
> >
> >     Edit /etc/fstab to insert the line for mounting /var
> automatically.
> 
> I can edit but this one stops me....It's probably simple but I
> have no idea of what to type in /etc/fstab.

Read up on it:
 $ man 5 fstab

Mine says:
/dev/sda1	/var	ext2	defaults			0	2


> >     Go to multi-user mode again.
> >
> > All paths in /var will be unchanged and no action is required.  The
> > entry in /etc/fstab will ensure that /var is mounted when the system
> > comes up and everything will be as it was before, but with more space.
> 
> Does making the new partititions and trasferring data to them from /
> result in
> unusable large vacancies in /?   What can be done about this?

Not the way I have described.  The command "rm -rf ." deletes everything
in the current directory, which, if you have followed the example, is
the one from which you are moving data.  That space immediately becomes
available in the root filesystem.

When you mount another partition on a directory, you hide all the
existing contents of that directory, so you would lose the space if you
did the mount of the new partition without deleting the contents of the
mountpoint directory first.  In fact, that means that you can check that
your new partition is working correctly without destroying the old
data.  When you are happy that you have got it right, unmount the
partition, delete the contents of the mountpoint (which you have copied
to the new partition) and then remount the partition.

If any process has a file open in the old partition, that file's space
will not be released until that process exits.  (That's why, in the case
of /var, I suggest doing this in single-user mode -- files in /var/log
are held open by some processes and other processes, such as exim, may
add to or create files in /var while you are copying it.)

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                            
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Blessed is the man that trusteth in the LORD, and
      whose hope the LORD is."            Jeremiah 17:7


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: