LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sda1 disk clean up (https://www.linuxquestions.org/questions/linux-newbie-8/sda1-disk-clean-up-674273/)

EpicOfChaos 10-04-2008 06:58 PM

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

bigrigdriver 10-04-2008 07:38 PM

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.

pinniped 10-04-2008 07:45 PM

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

EpicOfChaos 10-04-2008 08:16 PM

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!

EpicOfChaos 10-04-2008 08:19 PM

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?

pinniped 10-04-2008 11:32 PM

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).

EpicOfChaos 10-06-2008 11:09 AM

Thanks that worked :D


All times are GMT -5. The time now is 10:49 PM.