Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-04-2005, 08:12 AM
|
#1
|
Member
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116
Rep:
|
adding a partition - is it possible/safe ?
Hello all,
My / partition is now full, because some programs like "Duden" are installed in the /opt folder :
Code:
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 250M 237M 1.0K 100% /
/dev/hda9 18G 173M 17G 2% /home
/dev/hda8 361M 8.1M 334M 3% /tmp
/dev/hda5 4.6G 586M 3.8G 14% /usr
/dev/hda6 2.8G 308M 2.4G 12% /var
/dev/hda1 12G 9.0G 2.9G 77% /mnt/win
/dev/hda2 17G 11G 5.2G 68% /mnt/ubuntu
tmpfs 252M 0 252M 0% /dev/shm
/dev/hdc 190M 190M 0 100% /media/cdrom0
I would like ot create a partition for /opt. Is it possible to do that? Is there any risk that I lose data?
++
Kloss
|
|
|
12-04-2005, 08:21 AM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
Assuming you have free disk space yes its possible. Use fdisk or one of the other partitioning utilties to create a partition for it on your free disk space. You then use mkfs to layout a filesystem on the partition then you mount the partition.
Prior to mounting the new partition as /opt you'd want to move the existing the directory:
mv /opt /opt.orig # Saves original /opt directory
mkdir /opt # Makes empty /opt directory (mount point)
mount <device> /opt # Mounts your partition (<device>) on the
new mount point.
cp -pR /opt.orig/* /opt # Recursively copies all the files and
directories from /opt.orig to the new
mounted partition.
Prior to doing above you want to stop all applications and verify no process is actively using /opt (lsof /opt will show you any that are).
|
|
|
12-04-2005, 08:43 AM
|
#3
|
Member
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116
Original Poster
Rep:
|
Quote:
Originally Posted by jlightner
Assuming you have free disk space yes its possible.
|
Thanks for your help.
I have no free space on my hdd, is it possible to resize an existing partition (for instance the ubuntu one) to free some space ?
(If so, I assume that the hdX will be different - hda3 becomes hda4 and so on -, but editing the fstab should solve this problem).
++
|
|
|
12-04-2005, 09:03 AM
|
#4
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
In mounts the important thing is the device - you can mount it anywhere - the files within it become relative to the mount point.
For example if you had a file named /mnt/ubuntu/testfile in the mounted directory /mnt/ubuntu you could:
umount /mnt/ubuntu
mkdir /mountest
mount /dev/hda2 /mountest
The file would now be /mountest/testfile.
I'm not familiar with ubuntu so I'm not sure what /mnt/ubuntu is or if it is required. If its not then all you need to do is:
rm -rf /mnt/ubuntu/* # WARNING: Erases /mnt/ubuntu!!!
umount /mnt/ubuntu
mv /opt/orig.old /opt
mkdir /opt
mount /dev/hda2 /opt
cp -pR /opt/orig.old/* /opt
You'd then just edit the line in /etc/fstab that has hda2 going to /mnt/ubuntu to go to /opt instead. You wouldn't even need to mkfs on it unless you wanted to change the filesystem type. (Some people would do the mkfs after the rm -rf and umount just to make it more pristine but its not absolutely necessary.)
|
|
|
12-04-2005, 09:16 AM
|
#5
|
Member
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116
Original Poster
Rep:
|
Quote:
Originally Posted by jlightner
I'm not familiar with ubuntu so I'm not sure what /mnt/ubuntu is or if it is required. If its not then all you need to do is:
rm -rf /mnt/ubuntu/* # WARNING: Erases /mnt/ubuntu!!!
|
Actually I used ubuntu and was unhappy with it, so I installed Debian and now I have two Linux OS on my box. I don't use ubuntu anymore but I have some files on this partition and so far I have no reason to remove ubuntu. I don't know if I'm gonna use what you suggest (mounting /opt somewhere on the ubuntu partition) or resize this partition to free some space and do what you indicate in your first post. Maybe qtparted or Parition Magic can do that.
Thanks for your detailed explanations.
|
|
|
12-04-2005, 11:33 AM
|
#6
|
Member
Registered: Nov 2004
Location: France & Germany
Distribution: (Pure) Debian Etch & Sid
Posts: 116
Original Poster
Rep:
|
whouah... Here come the crash.
I was too lazy to install qparted and since I had partition magic on my win partition, I used it to create a new partition at the end of the hard drive and resizing/moving the others. Well, here ist the result. 
When I rebooted, I got:
Code:
Grub loading stage 1.5
Grub loading, please Wait
error 17
I booted with a Debian netinst CD and saw that Partition Magic has freed 2GB of space on my HDD (before crashing). I installed Debian on this partition ; this reinstalled Grub on the MBR and I was able to boot my Ubuntu partition. But the (old) Debian install is not recognized. I think my "/" is fucked up :
Code:
root@ubuntu:/mnt # mount -t ext3 /dev/hda3 hda3/
mount: wrong fs type, bad option, bad superblock on /dev/hda3,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
The other partitions, /usr, /var, /tmp, /home, are ok (I can mount them). Here you can find a screenshot which shows the actual state of my hdd.
So... What should I do now?
Thanks for your help
Kloss
|
|
|
All times are GMT -5. The time now is 12:16 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|