Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to switch Linux to single user mode while logged in via networking?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to switch Linux to single user mode while logged in via networking?

Is there a way to switch to single user mode when logged into Linux via the network, rather than directly through the console?

I want to be able to mount the file system in read-only mode and do stuff like fsck and zerofree while logged via SSH. Is that possible?

Comments

  • telinit 1
    But it will disconnect your ssh and you won't be able to login.

  • @rchurch no console? if not, then try remounting the filesystem readonly (will need to stop/kill processes writing to the filesystem) to run the fsck: http://wiki.gandi.net/en/iaas/references/server/fsck

  • @rds100 said:
    telinit 1
    But it will disconnect your ssh and you won't be able to login.

    Is it possible to set the file system to be read-only whilst logged in over the network, or switch to a file system on another device like a RAM based file system in order to fix the main disk?

  • It is possible to kill all processes, except init, sshd and your shell, then remount the file system read only, then perform fsck. However why do you want this? If it's a VPS you probably have some sort of console access? If it's a dedicated server with no IPMI, there is probably some rescue system you can boot to?

    Thanked by 1rchurch
  • @rds100 said:
    It is possible to kill all processes, except init, sshd and your shell, then remount the file system read only, then perform fsck. However why do you want this? If it's a VPS you probably have some sort of console access? If it's a dedicated server with no IPMI, there is probably some rescue system you can boot to?

    The problem is console access can be very slow, especially the browser based Html5 types. Not all providers have a reasonably speed console. Digital Ocean's version is very slow.

    So back to your response. How is it possible to kill all processes except sshd and the shell and mount the file system readonly? I have been reading about pivot_root which is supposed to do something along those lines, but don't understand the details well enough.

Sign In or Register to comment.