You are not logged in.

#1 2010-06-24 10:52:44

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Mounting a folder in a filesystem as the root?

I have a project I'm working on where I have to upgrade some servers that I have no physical access to.  One thing I thought would make my life way easier is if I could be able to mount /newroot on a filesystem as / to the system somehow.  Is there a way to do this?

Offline

#2 2010-06-24 11:03:52

Caveman85de
Member
Registered: 2010-05-25
Posts: 26

Re: Mounting a folder in a filesystem as the root?

sure, try sshfs or even ftps

Offline

#3 2010-06-24 12:11:24

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Mounting a folder in a filesystem as the root?

@Caveman85de: I don't think that's what synthead meant

I don't know of a way, but will faking that with chroot help you? (I use "fake" here because I don't actually know enough about chroot to tell you something more specific...)

Last edited by jac (2010-06-24 12:12:20)

Offline

#4 2010-06-24 12:12:41

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Mounting a folder in a filesystem as the root?

I'm not trying to mount a remote filesystem on a local server ... I know this sounds tricky, but this is kinda what I'm trying to do.  Of course, this is not how you would do this (why I'm posting here), but this is more like what I'm trying to do:

UUID=0ba11cd0-a42d-4a25-bbe7-746841e09985/newroot / ext3 defaults,noatime 0

Or perhaps ...

/dev/sda1/newroot / ext3 defaults,noatime 0

Imagine that in your fstab.  I'm using the /newroot folder in the root of that filesystem as the root to the mounted filesystem.  Again, this is wrong, but is there a way to make this work?

Offline

#5 2010-06-24 12:23:35

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Mounting a folder in a filesystem as the root?

jac wrote:

@Caveman85de: I don't think that's what synthead meant

I don't know of a way, but will faking that with chroot help you? (I use "fake" here because I don't actually know enough about chroot to tell you something more specific...)

Interesting ... yeah.  This would be on a production environment, so I don't think a chroot would suffice, but that's definitely something to consider.

I'm thinking I could so something like this.  I would create a very small partition somehow, perhaps loopbacked to a file.  This would have all the directory structures needed in the new filesystem as well as other directories to mount the old filesystem partitions.  I could call this .oldroot.  I would create .newroot in every partition too, then use binds to "mount" the new folders in the partitions where the old ones used to be.

newroot.img             /               udf     defaults,loop   0 0
/dev/sda1               /.oldroot       ext3    defaults        0 1
/.oldroot/.newroot      /               none    bind            0 0

Again, proof of concept ...

Offline

#6 2010-06-24 21:37:29

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Mounting a folder in a filesystem as the root?

Can I mount drives as /x/y/z without mounting a / partition first?

Offline

#7 2010-06-25 14:57:28

Caveman85de
Member
Registered: 2010-05-25
Posts: 26

Re: Mounting a folder in a filesystem as the root?

Not really, as the mount-point has to exist prior to mounting.

I still don't get what you are up to...

Are you trying to (re)mount the already mounted FS of another system that is still running?

Offline

#8 2010-06-25 15:31:30

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Mounting a folder in a filesystem as the root?

synthead wrote:
UUID=0ba11cd0-a42d-4a25-bbe7-746841e09985/newroot / ext3 defaults,noatime 0

Or perhaps ...

/dev/sda1/newroot / ext3 defaults,noatime 0

Both of these are impossible - you are trying to specify a subdirectory of a block device.

Offline

#9 2010-06-26 20:00:52

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Mounting a folder in a filesystem as the root?

tomk wrote:

Both of these are impossible - you are trying to specify a subdirectory of a block device.

So this isn't possible at all by any means?

Offline

Board footer

Powered by FluxBB