5

My office system's HDD capacity was 500 GB, but the usable space was only around 100 GB. When I analysed disk I found that some of the space was used by boot and swap and the rest was used by an empty folder named NewFolder under the root directory. This folder was found to contain around 350 GB and was unusable(no read/write permission) for the user.

When I investigated more, It was found that the ownership of that folder was neither root nor user (May be system admins did it by mistake during installation). So I changed the ownership to my user. And now I am able to access the entire space.

My question is, is it possible for me to mount this partition to my home directory? If possible how? If not possible, why?

Edit

Output of df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        92G   84G  3.8G  96% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            3.9G   12K  3.9G   1% /dev
tmpfs           786M  1.4M  785M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            3.9G   17M  3.9G   1% /run/shm
none            100M   76K  100M   1% /run/user
/dev/sda6       922M  292M  567M  35% /boot
/dev/sda7       359G   67M  341G   1% /NewFolder

output of cat /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=aede36a3-fb06-4fe0-969d-011f063ba568 /               ext4    errors=remount-ro 0       1
# /NewFolder was on /dev/sda7 during installation
UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /NewFolder         ext4    defaults        0       2
# /boot was on /dev/sda6 during installation
UUID=d93f32a4-f5a2-4f3c-a243-6d20bad200ce /boot           ext4    defaults        0       2
# swap was on /dev/sda1 during installation
UUID=4ee0e7f2-03fa-489a-93bc-4152c69a1c26 none            swap    sw              0       0
9
  • What contents have that folder?
    – 0x2b3bfa0
    May 19, 2015 at 10:36
  • Please post the outpt of df -h
    – Stunts
    May 19, 2015 at 11:19
  • @Helio The folder is empty. May 19, 2015 at 11:22
  • Can you post the output of cat /etc/fstab?
    – 0x2b3bfa0
    May 19, 2015 at 11:24
  • Now I see df -h. NewFolder is a mount of /dev/sda7 (a partition of 359GB)
    – 0x2b3bfa0
    May 19, 2015 at 11:26

4 Answers 4

4

Sure, it's possible

Replace <your_user_name> with your user name and NewFolder with a name of your choice.


Create a new mount point, eg:

mkdir ~/NewFolder

and mount

sudo mount /dev/sda7 $HOME/NewFolder

If it works then change the entry in your fstab:

sudo nano /etc/fstab

from this

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /NewFolder         ext4    defaults        0       2

to this

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /home/<your_user_name>/NewFolder            ext4    defaults        0       2

You can check the UUID with this command

sudo blkid /dev/sda7

Sample output:

/dev/sda7: UUID="d94f4097-91aa-4e96-89b2-7877065d0650" TYPE="ext4" PARTUUID="00096da5-01"
6
  • Do I need to use a live CD to do this? May 19, 2015 at 11:35
  • Definitely not.
    – A.B.
    May 19, 2015 at 11:36
  • I see a slight difference in UUIDs when u edit the fstab entry. Could you please explain a bit on that? May 19, 2015 at 11:50
  • Sorry, my mistake. Good that you have checked it.
    – A.B.
    May 19, 2015 at 11:52
  • The output of this command is always the right choice: sudo blkid /dev/sda7
    – A.B.
    May 19, 2015 at 11:52
2

The home folder is supposed to hold your user folder. When you mount a partition to /Home the first thing that is created on that partition is the user's directory. You can mount any partition to /home and use.

If you value the data in that folder You could create a soft Link to that folder to any new folder under your /home and call it whatever you like.

So if you did this:

sudo ln -s /NewFolder /home/NewFolder

This will create a symbolic Link to /NewFolder under /home and if you click on /home/NewFolder it will open the /NewFolder for you.

0
2

Here's how I'd do it:

First - I'd create a new filesystem on your partition:

Start by unmountig your partiton:

sudo umount /dev/sda7

Then, create the new filesystem:

sudo mkfs.ext4 /dev/sda7 WARNING: this will erase all contents of /dev/sda7 partition.

Then, I'd temporarily mount it somewhere;

sudo mount /dev/sda7 /mnt

Then, I'd copy the contents of my home dir into the new partition:

sudo rsync -avP /home/ /mnt/ (using rsync will maintain permissions)

Unmount the partition:

sudo umount /dev/sda7

edit /etc/fstab to mount your new partition on /home by changing the line:

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /NewFolder ext4 defaults 0 2

to:

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /home ext4 defaults 0 2

If you wish, you may now erase the contents of your old 'home'

sudo rm -rf /home/* WARNING: This is a destructive command, make sure your data is safe in the new partiton before you issue it!

Reboot and you are done.

1

You can mount the 359GB partition in /home instead of /NewFolder

  1. Boot from a live CD/USB
  2. Mount /dev/sda5 and /dev/sda7
  3. Run sudo mv /mountpoint/to/dev/sda5/home/* /mountpoint/to/dev/sda7
  4. Edit /etc/fstab
  5. On the line that mounts /NewFolder, replace /NewFolder by /home

Original line:

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /NewFolder         ext4    defaults        0       2

Edited line:

UUID=efd23971-f61a-41f3-bd28-bbdf76c74673 /home         ext4    defaults        0       2

Note: This will store the home folder of all the users (except root) on the 359GB volume.

1
  • 1
    I hope this will also work. But I accept @A.B 's answer because it doesn't require the use of a live Cd. Thanks anyway :) May 19, 2015 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .