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

Reply via email to