How to safely move a directory to a different partition?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition.



How do I do this safely? If I simply move /opt to /usr/local/foo/opt then create a link of some sort from /opt --> /usr/local/foo/opt, will all the permissions, bits, etc. be correctly set up?



I'm using Ubuntu.










share|improve this question























  • Related: renaming a huge folder: is it risky?
    – Kusalananda
    Sep 6 at 19:05














up vote
1
down vote

favorite












My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition.



How do I do this safely? If I simply move /opt to /usr/local/foo/opt then create a link of some sort from /opt --> /usr/local/foo/opt, will all the permissions, bits, etc. be correctly set up?



I'm using Ubuntu.










share|improve this question























  • Related: renaming a huge folder: is it risky?
    – Kusalananda
    Sep 6 at 19:05












up vote
1
down vote

favorite









up vote
1
down vote

favorite











My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition.



How do I do this safely? If I simply move /opt to /usr/local/foo/opt then create a link of some sort from /opt --> /usr/local/foo/opt, will all the permissions, bits, etc. be correctly set up?



I'm using Ubuntu.










share|improve this question















My / partition keeps filling up. To mitigate this, I'd like to move /opt to a different directory, /usr/local/foo, which is mounted to a different partition.



How do I do this safely? If I simply move /opt to /usr/local/foo/opt then create a link of some sort from /opt --> /usr/local/foo/opt, will all the permissions, bits, etc. be correctly set up?



I'm using Ubuntu.







files filesystems






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 6 at 17:31

























asked Sep 5 at 21:58









Trent Bing

175111




175111











  • Related: renaming a huge folder: is it risky?
    – Kusalananda
    Sep 6 at 19:05
















  • Related: renaming a huge folder: is it risky?
    – Kusalananda
    Sep 6 at 19:05















Related: renaming a huge folder: is it risky?
– Kusalananda
Sep 6 at 19:05




Related: renaming a huge folder: is it risky?
– Kusalananda
Sep 6 at 19:05










1 Answer
1






active

oldest

votes

















up vote
0
down vote













rsync -a


followed by



mount --bind --make-slave





share|improve this answer




















  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
    – Filipe Brandenburger
    Sep 6 at 2:00










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467151%2fhow-to-safely-move-a-directory-to-a-different-partition%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













rsync -a


followed by



mount --bind --make-slave





share|improve this answer




















  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
    – Filipe Brandenburger
    Sep 6 at 2:00














up vote
0
down vote













rsync -a


followed by



mount --bind --make-slave





share|improve this answer




















  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
    – Filipe Brandenburger
    Sep 6 at 2:00












up vote
0
down vote










up vote
0
down vote









rsync -a


followed by



mount --bind --make-slave





share|improve this answer












rsync -a


followed by



mount --bind --make-slave






share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 6 at 1:16









user1133275

2,297412




2,297412











  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
    – Filipe Brandenburger
    Sep 6 at 2:00
















  • Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
    – Filipe Brandenburger
    Sep 6 at 2:00















Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
– Filipe Brandenburger
Sep 6 at 2:00




Your answer is good for the most part, rsync and mount --bind are great here, but can you complement it to cover the OP's use case? What rsync command would be appropriate? How to empty /opt before mounting on top of it? How to get the bind mount to get mounted automatically on boot? (What syntax should be used in /etc/fstab for that?)
– Filipe Brandenburger
Sep 6 at 2:00

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467151%2fhow-to-safely-move-a-directory-to-a-different-partition%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?