Is it feasible to delete documents when an additional filesystem is placed on the course?

Having actually simply created a solution concerning moving /usr to a new partition I was questioning removing documents once a new dividing has actually been placed. To make use of the instance from the inquiry, is it feasible to mount a new dividing on /usr and afterwards delete all the documents under /usr on the origin dividing to liberate room on the origin dividing.

0
2019-05-06 20:59:24
Source Share
Answers: 1

Not straight , yet there is a means around that : mount --bind is your close friend :

# Existing directory with a couple files in it
[email protected]:~/test# ls testdir
bar  foo

# Mount a filesystem over existing directory
[email protected]:~/test# mount -o loop testfs testdir
[email protected]:~/test# ls testdir
lost+found

# Bind mount root filesystem to another directory
[email protected]:~/test# mount --bind / bindmnt

# Can now get to contents of original directory through the bind mount
[email protected]:~/test# ls bindmnt/root/test/testdir/
bar  foo

# Remove a file
[email protected]:~/test# rm bindmnt/root/test/testdir/bar
[email protected]:~/test# ls bindmnt/root/test/testdir/
foo
[email protected]:~/test# ls testdir
lost+found

# Unmount filesystem
[email protected]:~/test# umount testdir

# Observe the change having taken effect
[email protected]:~/test# ls testdir
foo
[email protected]:~/test#

See additionally man mount - - look for "bind places".

0
2019-05-08 18:06:47
Source