How to mount a partition on Linux and make your old home directory accessible to your user
To add a directory in a mounted drive as a folder accessible by a normal user, use this command to change the ownership of all files and directories to that of your current user.
[root@darkstar Videos]# chown -R jason jason/ |
Then I created a symlink from the old partition to my new home directory and I can now read and write to it just fine. The partition is mounted read-write in etc/fstab, so it is easy to get this working.
It took 300 years to build and by the time it was 10% built, everyone knew it would be a total disaster. But by then the investment was so big they felt compelled to go on. Since its completion, it has cost a fortune to maintain and is still in danger of collapsing. There are at present no plans to replace it, since it was never really needed in the first place. I expect every installation has its own pet software which is analogous to the above. -- K. E. Iverson, on the Leaning Tower of Pisa ┌──[jason@11000000.10101000.00000001.00000011]─[~] └──╼ ╼ $ ln -s /mnt/ubuntu/home/jason/ jasonOld |
This is the entry I am using in /etc/fstab.
/dev/sdb1 /mnt/ubuntu ext4 rw,relatime 0 1 |
I should be using the UUID, but this will work just fine for the moment.
This is how you get the UUID of a partition though.
[root@darkstar jason]# blkid /dev/sdb1 /dev/sdb1: UUID="874c36d5-aae7-41f4-af84-d7cad4c692b9" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3ccc25b1-01" |
I can use this in the /etc/fstab file to mount a drive and this will work much better than using the device ID.
This is much better now.
1 2 3 4 5 6 7 8 9 10 11 12 | [root@darkstar jason]# cat /etc/fstab # Static information about the filesystems. # See fstab(5) for details. # <file system> <dir> <type> <options> <dump> <pass> # /dev/sda3 UUID=29871bb9-b365-442b-9dc0-357d597de93f / ext4 rw,relatime 0 1 # /dev/sda6 UUID=0CC9-6DA5 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 UUID=874c36d5-aae7-41f4-af84-d7cad4c692b9 /mnt/ubuntu ext4 rw,relatime 0 1 |