LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-13-2006, 10:32 PM   #1
slack&lovinit
LQ Newbie
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Sol11 > Slack12 >> XP
Posts: 29

Rep: Reputation: 15
Moving /opt etc to another partition...


Hello,

I'm trying to work out what is the best way to rejig the way my 10.0 partitions are being used.

Initially I installed as follows:

/hdb2 - / This is a tiny physical partition that I intended to just use to boot the system - I was at the time confused about the 1024th cylinder limit and/or whether I could boot Linux from a logical / partition.

/hdb5 = /user This is a more substantial logical partition which is essentially empty since everything I install seems to go into /var or /opt under /

So my question: Can I move /var and /opt from under / to the partition holding /user?

Reading around here I get the impression that moving say /home to a NEW partition is easy enough but moving /home to a pre-existing partition already holding another directory isn't easy or maybe even possible...

Your advice would be greatly appreciated!
 
Old 08-14-2006, 01:07 AM   #2
slack&lovinit
LQ Newbie
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Sol11 > Slack12 >> XP
Posts: 29

Original Poster
Rep: Reputation: 15
OK, so this is what I'm thinking of doing - any feedback would be great esp if I'm about to wreck my setup!

Using /opt as a example

Make a new mount point for the new /opt:

mkdir /mnt/newopt

Mount it to the required partition (to be shared with /usr)

mount /dev/hdb5 /mnt/newopt

Move the old /opt files to /newopt

cd /opt
cp -ax * /mnt/newopt

Backup the old /opt just in case - once everything is ok can delete

cd /
cp opt opt.old

Create the symlinks so that Linux and software can find the /opt files

cd /
ln -s /mnt/newopt /opt

Edit /etc/fstab to reflect changes

/dev/hdb5 /opt ext2 defaults 1 2

Reboot.
 
Old 08-14-2006, 01:13 AM   #3
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
I would suggest using the Linux Logical Volume Manager (LVM). It allows you to assign a disk or one or more partitions to a volume group. Within this volume group you can create logical partitions for each file system. The best part about it is you can add and remove space from these paritions on the fly.

In your case I'd move /usr back to the root partition by doing something like cp -a /usr /usr2 and then boot off of the CD and move /usr2 to /usr and remove the mount of /usr in the fstab. Once that is done use cfdisk to mark the old /usr partition for use with the LVM and boot and setup the LVM on that parition. You can then move any parition you wish off of root onto the LVM in its own logical partition.

http://www.tldp.org/HOWTO/LVM-HOWTO/

I've been using the LVM for years and years and never setup a machine w/o it.

There are procedures for moving a / (root) partition to the LVM, in my experience it's not worth the effort. I always keep a small root for the the basics, and move most of the biggies off to their own partition. (/usr, /opt, /home, /var, others...)
 
Old 08-14-2006, 01:16 AM   #4
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
What is on hdb5 now? Is it mounted?

Post your df -h.
 
Old 08-14-2006, 01:31 AM   #5
slack&lovinit
LQ Newbie
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Sol11 > Slack12 >> XP
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by crabboy
What is on hdb5 now? Is it mounted?

Post your df -h.
Hi there, thanks for your reply - I'll look into LVM since I know zero about it at the moment!
Here is the above requested:

Filesystem Size Used Avail Use% Mounted on
/dev/hdb1 1.2G 657M 426M 61% /
/dev/hdb5 12G 2.5G 8.1G 24% /usr
/dev/hda5 8.9G 8.1G 774M 92% /winpad

the last entry is a FAT32 data swap partition on another drive (for WinXP<->Linux)
 
Old 08-14-2006, 02:14 AM   #6
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
The procedures that you stated in your second post will not work. They will copy the contents of /opt into your /usr partition, and once mounted as /opt your /usr will go away. Did you have plans to copy off /usr onto / first?
 
Old 08-14-2006, 05:23 AM   #7
ppoisson
LQ Newbie
 
Registered: Mar 2006
Location: Lille, France
Distribution: slackware 10.2
Posts: 3

Rep: Reputation: 0
I have never tried with Slackware, but I tell you what I know about Unix in general.

Moving /var : take care.
When the system boots, it needs some of that /var tree.
Before mounting any other partition, Unix mount first /, and in single user mode you only have this / partition.

So I recommand to move only some non essential directories for unix but big, like /var/.../database for instance.

Moving /opt : no problem.

Instead of using links, you can do loopback mounting.
e.g. : you moved /opt tree in /usr/opt.
so you mount (lo option?), after /usr is mounted, /usr/opt under /opt, and you see an /opt filesystem.

I do not suggest to try this with the top of /var, but you can do it with /var/.../database.

Hope that helps.
 
Old 08-14-2006, 06:34 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
Here is the basic approach I have used in the past:

1. If lacking sufficient drive space for the new partition, then make new space with a partitioning tool.
2. Create the new partition.
3. Mount the new partition to a temporary mount point (e.g., /mnt/opt).
4. Format and install the file system on the new partition (e.g., e2fsck).
5. Copy the contents of /opt to /mnt/opt.
6. Do not delete the /opt directory point in the root file system, but delete the contents.
7. Edit fstab to mount the new partition as /opt.
8. Reboot to test fstab.
9. Delete temporary mount point /mnt/opt.

Revise as necessary if you are using separate mount points for subdirectories in /opt.
 
Old 08-14-2006, 11:33 PM   #9
slack&lovinit
LQ Newbie
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Sol11 > Slack12 >> XP
Posts: 29

Original Poster
Rep: Reputation: 15
Crabboy: No I hadn't thought of moving the contents of /usr - I was kind of working on the assumption that if you can share a partition amongst several trees when you're installing linux, that you could then manually do the same at a later time. I'm supposing that this isn't the case! I'm going to implement LVM when I have some time - looks interesting

ppoisson: I like the look of what you're suggesting here- it's simple enough for me to do and makes some sense for the time being - merci!


Woodsman - I had thought of going this way, so thanks for putting the details in - if the other ways fail I guess I'll come back and do it like this.


Besides, right now I need to figure out what the heck's happened to lilo.conf - its empty and KDE reports that its a PCX file?!?!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/usr and /opt in 1 partition hottdogg Linux - General 6 08-16-2005 10:51 AM
how to mount linux partition as /opt shams Linux - Hardware 2 04-02-2005 10:33 PM
Moving VAR TMP HOME OPT to new partitions JWatson Linux - Newbie 2 01-03-2005 05:54 AM
new /opt partition from / without resizing with parted everal Linux - Hardware 1 12-16-2004 02:50 AM
Make an /opt partition? proton666 Linux - General 4 01-11-2003 01:54 PM


All times are GMT -5. The time now is 05:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration