Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #270287

Re: mounting external hard drive from rescue mode shell?

From David Christensen <dpchrist@holgerdanske.com>
Newsgroups linux.debian.user
Subject Re: mounting external hard drive from rescue mode shell?
Date 2024-06-20 07:10 +0200
Message-ID <IRidz-4dak-17@gated-at.bofh.it> (permalink)
References <IR5q1-44Nw-7@gated-at.bofh.it> <IR9jY-47eg-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 6/19/24 12:23, Heriberto Avelino wrote:
> On Wed, Jun 19, 2024 at 9:04 AM Heriberto Avelino wrote:
>> Is it possible to mount an external hard drive while running Debian in
>> rescue mode?
>> Furthermore, the ultimate question is how could I copy folders from the
>> computer's hard drive to the external one while in rescue mode?


 > Thanks Eben and David!
 > I am now on a shell (BusyBox v.35.0 Debian 1:1.35.0-4+b3)
 > I don't see the mounting points to execute cp.
 > There is nothing under media nor root; under usr I can see only: bin
 > lib local sbin share.
 > Where are the internal h-drive and the external?
 > I would very much appreciate your further help.
 > Who could have envisioned a community like this back in the 80's? This
 > is great!
 > Heriberto


We are glad to help.  :-)


On Debian GNU/Linux, SATA drives (internal and external) should have 
special files (device nodes) under /dev.  You can use the ls(1) command 
and a glob pattern to find them:

~ # ls /dev/sd?

/dev/sda


You can use the fdisk(8) command to list the partitions on a drive.  For 
example, here is the drive containing Debian in the computer I am using now:

~ # fdisk -l /dev/sda
Disk /dev/sda: 55.9 GiB, 60022480896 bytes, 117231408 sectors
Disk model: INTEL SSDSC2CW06
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x544032f5

Device     Boot    Start       End  Sectors  Size Id Type
/dev/sda1  *        2048   1953791  1951744  953M 83 Linux
/dev/sda2        1953792   3907583  1953792  954M 83 Linux
/dev/sda3        3907584  29298687 25391104 12.1G 83 Linux
/dev/sda4       29298688 117229567 87930880 41.9G 83 Linux


Partitions can contain one of several things.  One possibility is a file 
system.  I keep detailed records on all of my OS's and drives, so I know 
what is what.  Figuring out the contents of an unknown drive using the 
Debian rescue shell is possible, but requires more knowledge and effort. 
  Using a live Linux distribution instead of the Debian rescue shell can 
make such tasks easier.  I install Debian onto a SATA SSD via a USB-SATA 
adapter cable for this purpose.


Once you have identified the device node of a partition that contains 
the file system that you want to read and/or write, you must mount the 
file system.  The first step is to create a mount point with mkdir(1):

~ # mkdir /scratch


The second step is to mount the file system with mount(8):

~ # mount /dev/sda4 /scratch


Repeat the above process to mount any additional file systems that you 
want to read and/or write.


One the file system(s) are mounted, you can read and/or write files 
and/or directories.  For example, you can use cp(1) to copy files from 
an internal drive to an external drive.


"Learning the Unix Operating System" is a good book for learning how to 
use Unix/ Linux from the command line:

https://www.oreilly.com/library/view/learning-the-unix/0596002610/


"UNIX and Linux System Administration Handbook" is a good book for 
learning how to administer Unix/ Linux from the command line:

https://www.oreilly.com/library/view/unix-and-linux/9780134278308/


"Design of the UNIX Operating System" is a good book for understanding 
how Unix worked around the time Linux Torvalds wrote Linux:

https://www.pearson.com/en-us/subject-catalog/p/design-of-the-unix-operating-system/P200000009243/9780132017992

https://en.wikipedia.org/wiki/Linus_Torvalds


David

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

mounting external hard drive from rescue mode shell? Heriberto Avelino <heriberto.avelino@gmail.com> - 2024-06-19 17:30 +0200
  Re: mounting external hard drive from rescue mode shell? eben@gmx.us - 2024-06-19 18:00 +0200
  Re: mounting external hard drive from rescue mode shell? David Christensen <dpchrist@holgerdanske.com> - 2024-06-19 19:10 +0200
  Re: mounting external hard drive from rescue mode shell? Heriberto Avelino <heriberto.avelino@gmail.com> - 2024-06-19 21:40 +0200
    Re: mounting external hard drive from rescue mode shell? eben@gmx.us - 2024-06-19 23:10 +0200
    Re: mounting external hard drive from rescue mode shell? <tomas@tuxteam.de> - 2024-06-20 06:40 +0200
    Re: mounting external hard drive from rescue mode shell? David Christensen <dpchrist@holgerdanske.com> - 2024-06-20 07:10 +0200
      Re: mounting external hard drive from rescue mode shell? Max Nikulin <manikulin@gmail.com> - 2024-06-21 04:20 +0200
        Re: mounting external hard drive from rescue mode shell? David Christensen <dpchrist@holgerdanske.com> - 2024-06-21 06:50 +0200
          Re: mounting external hard drive from rescue mode shell? Max Nikulin <manikulin@gmail.com> - 2024-06-22 05:00 +0200
            Re: mounting external hard drive from rescue mode shell? Richard Owlett <rowlett@access.net> - 2024-06-22 13:50 +0200
              Re: mounting external hard drive from rescue mode shell? "Thomas Schmitt" <scdbackup@gmx.net> - 2024-06-22 14:40 +0200
                Re: mounting external hard drive from rescue mode shell? Richard Owlett <rowlett@access.net> - 2024-06-22 15:40 +0200
              Re: mounting external hard drive from rescue mode shell? Andy Smith <andy@strugglers.net> - 2024-06-22 16:00 +0200
                Re: mounting external hard drive from rescue mode shell? Richard Owlett <rowlett@access.net> - 2024-06-22 19:40 +0200
                Re: mounting external hard drive from rescue mode shell? David Christensen <dpchrist@holgerdanske.com> - 2024-06-22 22:20 +0200
                Re: mounting external hard drive from rescue mode shell? Andy Smith <andy@strugglers.net> - 2024-06-23 00:40 +0200
                Re: mounting external hard drive from rescue mode shell? "Andrew M.A. Cater" <amacater@einval.com> - 2024-06-23 11:50 +0200
              Re: mounting external hard drive from rescue mode shell? David Christensen <dpchrist@holgerdanske.com> - 2024-06-22 19:00 +0200
                Re: mounting external hard drive from rescue mode shell? Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-22 19:20 +0200
                Re: mounting external hard drive from rescue mode shell? Richard Owlett <rowlett@access.net> - 2024-06-22 19:50 +0200
                Re: mounting external hard drive from rescue mode shell? Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-23 18:40 +0200
                Re: mounting external hard drive from rescue mode shell? <tomas@tuxteam.de> - 2024-06-23 19:20 +0200
                Re: OT - list mail claimed to be "known" spam! (was: mounting  external hard drive...) Felix Miata <mrmazda@earthlink.net> - 2024-06-23 23:00 +0200
                Re: OT - list mail claimed to be "known" spam! Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-24 01:10 +0200
                Re: OT - list mail claimed to be "known" spam! (was: mounting external hard drive...) CHRIS M <CHRIS@cwm030.com> - 2024-06-24 04:40 +0200
                Re: OT - list mail claimed to be "known" spam! John Hasler <john@sugarbit.com> - 2024-06-24 04:50 +0200
                Re: OT - list mail claimed to be "known" spam! Felix Miata <mrmazda@earthlink.net> - 2024-06-24 05:00 +0200
                Re: mounting external hard drive from rescue mode shell? Richard Owlett <rowlett@access.net> - 2024-06-24 17:40 +0200
                Re: mounting external hard drive from rescue mode shell? Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-25 00:00 +0200
              Re: mounting external hard drive from rescue mode shell? Jeffrey Walton <noloader@gmail.com> - 2024-06-22 23:20 +0200
                Re: mounting external hard drive from rescue mode shell? "Andrew M.A. Cater" <amacater@einval.com> - 2024-06-22 23:50 +0200

csiph-web