LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2008, 06:58 PM   #1
EpicOfChaos
LQ Newbie
 
Registered: Oct 2008
Location: Ogden, Utah
Distribution: Ubuntu Server 8.10
Posts: 18

Rep: Reputation: 0
sda1 disk clean up


Hey guys,
This is the situation at hand. I got a new harddrive and put it in my linux box. I went ahead and formatted it and everything to sdb1.
I have it mounted to /home directory, and changed the fstab file so that it knows. if I do a "df" command it show everything properly except that sda1 still has 13gig spaced used by the previous "/home" so my question is as follows. Is there a way to get rid of the /home directory on the sda1 drive so that I can have that space back? This is what the df shows.

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 37662088 13624628 22139384 39% /
varrun 192724 56 192668 1% /var/run
varlock 192724 0 192724 0% /var/lock
udev 192724 48 192676 1% /dev
devshm 192724 0 192724 0% /dev/shm
/dev/sdb1 197572288 12989312 174625892 7% /home
 
Old 10-04-2008, 07:38 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,889

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
According to this, sda1 is the root of the filesystem, not just a old /home directory.
Quote:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 37662088 13624628 22139384 39% /
varrun 192724 56 192668 1% /var/run
varlock 192724 0 192724 0% /var/lock
udev 192724 48 192676 1% /dev
devshm 192724 0 192724 0% /dev/shm
/dev/sdb1 197572288 12989312 174625892 7% /home
If I understand this correctly, you still have 13 gig of files in the old /home folder on sda1, but when you boot up and mound sdb1, the new /home partition's files are displayed in /home. So, how to move/remove the files from /home on sda1?
Quote:
I have it mounted to /home directory, and changed the fstab file so that it knows. if I do a "df" command it show everything properly except that sda1 still has 13gig spaced used by the previous "/home" so my question is as follows. Is there a way to get rid of the /home directory on the sda1 drive so that I can have that space back? This is what the df shows.
1. boot a livecd so that you aren't trying this with a mounted, running filesystem. The livecd will probably show a mount point for sda1 as /mnt/sda1, and a mount point for sdb1 as /mnt/sdb1.
Open a terminal window, and mount sda1 and sdb1.
mount /dev/sda1 /mnt/sda1
mount/dev/sdb1 /mnt/sdb1
2. move the files from /mnt/sda1/home to /mnt/sdb1/home.
mv /mnt/sda1/home/* /mnt/sdb1/home
Leave the /home folder on sda1; just move the files to sdb1. The empty /home folder on sda1 is the mount point for sdb1.
3. now the files are on sdb1, and 13 gig of space are freed up in your root partition.
4. umount sda1 and sdb1, shutdown the livecd, and reboot.
 
Old 10-04-2008, 07:45 PM   #3
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
The usual way:

1. log in as root on a text console
2. unmount /home
3. mount your new 'home' somewhere else - say /mnt/newhome
4. if the old /home was a different partition, mount that on /mnt/oldhome
5. Copy the old home to the new home
6. remove the stuff from the old home
7. unmount the /mnt/*home partitions
8. mount /home again
 
Old 10-04-2008, 08:16 PM   #4
EpicOfChaos
LQ Newbie
 
Registered: Oct 2008
Location: Ogden, Utah
Distribution: Ubuntu Server 8.10
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks!

Alright thanks guys, I got looking at what you were saying and it makes sense. So what I did was umount sdb1 and than go into the sda1 home and rm -f -r all the directories, than I mount -a and bingo! everything is good now.

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 37662088 827284 34936728 3% /
varrun 192724 56 192668 1% /var/run
varlock 192724 0 192724 0% /var/lock
udev 192724 48 192676 1% /dev
devshm 192724 0 192724 0% /dev/shm
/dev/sdb1 197572288 12989312 174625892 7% /home

Thanks for you guys help! Linux rocks!
 
Old 10-04-2008, 08:19 PM   #5
EpicOfChaos
LQ Newbie
 
Registered: Oct 2008
Location: Ogden, Utah
Distribution: Ubuntu Server 8.10
Posts: 18

Original Poster
Rep: Reputation: 0
Slight Problem

Well I found a slight problem It isn't a huge problem but it is kind of annoying. Now it is /home/home any ideas?
 
Old 10-04-2008, 11:32 PM   #6
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Hehe - you must have created a 'home' directory on your home partition.
So - unmount it again, move all directories to the root directory of the partition (rather than in a 'home' directory), check '/home' to make sure it has the correct permissions, then mount the partition over /home.

Just make sure you know what you're doing - you don't want to mistype something and pollute the / filesystem (or lose files).

Last edited by pinniped; 10-04-2008 at 11:33 PM.
 
Old 10-06-2008, 11:09 AM   #7
EpicOfChaos
LQ Newbie
 
Registered: Oct 2008
Location: Ogden, Utah
Distribution: Ubuntu Server 8.10
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks that worked
 
  


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
disk clean up adamruss Linux - Software 3 12-10-2007 07:33 AM
Grub boot Hard disk- make 'root=' option a variable (/dev/sda1 keeps changing), carl0ski Linux - General 4 02-03-2007 08:55 PM
disk utielieties / clean ups t.j.sorrow SUSE / openSUSE 3 05-06-2006 05:14 PM
How to clean the hard disk? aladin Linux - Software 2 08-30-2005 07:41 AM
Running out of disk space... clean up possible? donv2 Linux - Newbie 3 04-19-2005 02:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:30 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration