You can rename a file (directory or whatever) using only knowledge of the inode using find
, but if (a) the filesystem containing it is not mounted, or if (b) there is another filesystem mounted over a non-empty directory that contains the file you are interested in, the file is simply not accessible by your system. In case (a), you need to mount the filesystem before you can do anything to the contents, including renaming, and in case (b), you need to unmount the filesystem which is mounted "over the top of" the directory containing the file you want to rename. It looks like you are asking about case (b).
If I understand you correctly, you are trying to make your old /home
directory (which is located on your root partition) accessible, while still using your new partition mounted at /home
. If that's what you want, do the following:
Close all files and log out. Then log in as root
(use a virtual terminal for this—press Ctrl-Alt-F2) Run the following:
umount /home
mv /home /home-old
mkdir /home
mount -a
ls /home
ls /home-old
If all is well, log out and log back in as yourself and all should be fine.
Incidentally, the command to rename a file using only knowledge of its inode (assuming the file is in the current directory) is:
find . -maxdepth 1 -inum 123456789 -exec mv {} mynewname \;
Where 123456789
is the inode number, of course. (Note that find
determines the filename and its path and passes this info to mv
; there is no way at all to rename a file without involving the existing filename in any way, but if it's just that you don't know the filename, it is quite simple.)
mv
won't accept inodes in any way. – Wildcard Oct 04 '15 at 20:15