1

We have a Debian server (vm's) here at work and the server crashed after a power failure. I can only boot the system in maintenance mode, and the whole file system is set to read only. I can run fsck though maintenance mode, however I would like to get a backup of some files before I do. Problem: I cannot access the net since there is no network connectivity in maintenance mode, and for some reason I try to add a USB flash drive to the computer but I can't find it through the console.

Question: how to you find/mount a usb drive on Debian? I have tried several resources from the internet but nothing worked. Is there any other way I could get a backup of my files? I cannot start networking since the filesystem is set to read only.

Any help would be appreciated.

unhappyCrackers1
  • 977
  • 1
  • 6
  • 18
Spiros
  • 251
  • 2
  • 7
  • When you plug the usb drive it will be detected automatically and you could then find its "device name" in the outuput of `dmesg` (look for /dev/sdX). – Shadok Jul 02 '12 at 14:12

2 Answers2

2

You can start networking without a writable filesystem -- you just probably can't use the init scripts to do it (newer versions of Debian use a tmpfs for this, but I'm going to assume you're not using one of those). Just use ip (or ifconfig if that's your bag) to give the interface an IP and bring it up:

ip addr add 192.0.2.69/24 dev eth0
ip link set eth0 up

If you need to talk to a machine off your local subnet, you can add a default route, too:

ip route add default via 192.0.2.254 dev eth0

Mounting a USB drive on Debian is exactly the same as it is on every other Linux distribution:

mount /dev/sdXN /mnt

You might be hitting limitations due to /etc/mtab not being writable, which is cool, just give mount the -n option.

womble
  • 96,255
  • 29
  • 175
  • 230
  • Thanks. Unfortunately, after giving the commands you just mentioned, the network is still not working. Am I missing something? – Spiros Jul 02 '12 at 14:31
  • 1
    Diagnostic information, for starters. – womble Jul 02 '12 at 14:32
  • It looks like I am half way through. I have used instructions from this website http://www.comptechdoc.org/os/linux/usersguide/linux_ugbasicnet.html (thanks to your hint for manual configuration) but still there is something missing as there is networking but no connection to the outside world. I am probably missing this line as I am receiving an error * Tell your machine that a hub is ready for information with the command "route add -net 192.168.0.0 netmask 255.255.255.0 eth0. * What exactly does it do? – Spiros Jul 03 '12 at 09:01
  • And what was the solution? The key here isn't just *asking* questions, it's *sharing the knowledge*. From the look of things, you'd configured your network interface, but failed to set up routing by defining a default gateway. – Dr. Edward Morbius Jul 11 '12 at 00:04
0

You can make the vm start from an image of any live distro. I dont know if you have kvm, xen or virtualbox /vmwarem, etc. But most would let you start from a cd. With that you can recover most your files, I would recommend rescuecd.
To your other question

how to you find/mount a usb drive on Debian?

With the commands

lsusb, dmesg and with the command mount mount -t vfat /dev/sdXY /mount/point/you/choose

You can even drop the -t vfat, most of the time linux will recognize what type of partition you are using.

Juan Diego
  • 179
  • 1
  • 1
  • 11