¿Cómo apagar el disco duro en Ubuntu?


20

Estoy ejecutando Kubuntu desde el disco duro externo. Mi disco duro interno tiene Windows en él. No quiero usarlo mientras estoy en Ubuntu y quiero apagarlo para producir menos calor y consumir menos batería. Creo que girar el disco duro no es una opción para mí. Porque, desgasta el disco duro y no planeo gastar en discos duros :)


Ya hay preguntas similares (y respondidas): askubuntu.com/questions/39760/…
Guilhem Soulas

1
man hdparm sudo hdparm -Y /dev/sdX
earthmeLon

@GuilhemSoulas Mi pregunta no se trata de girar el disco duro. El mío es cómo apagar el disco duro.
AhmedBilal

Respuestas:


21
sudo hdparm -Y /dev/sdX

donde / dev / sdX es el dispositivo que desea apagar. También puede ejecutar sudo blkidpara determinar la 'huella digital' del dispositivo (UUID), lo que le permitiría controlar de manera más confiable qué dispositivo se está apagando.

En este caso, ejecutarías:

sudo hdparm -Y /dev/disk/by-uuid/DEVICE-IDENT-HERE

hombre hdparm

   -Y     Force  an  IDE  drive  to  immediately  enter  the  lowest power
          consumption sleep mode, causing it to shut down  completely.   A
          hard  or soft reset is required before the drive can be accessed
          again (the Linux IDE driver will automatically handle issuing  a
          reset  if/when  needed).   The  current power mode status can be
          checked using the -C option.

¿Qué es exactamente hard or soft reset, es decir, cómo recuperar el disco?
Asalle

Este comando apagó la unidad de disco duro, pero la ejecución sudo hdparm -C /dev/sdXpara consultar el estado volverá a encender la unidad y luego se pondrá en espera (un restablecimiento parcial, supongo). Hace el trabajo para ahorrar energía, pero no para simular la instalación sin la unidad de disco duro.
clearkimura

5

Puede usar lo siguiente (aquí sdcestá el nombre del dispositivo de bloque correspondiente de interés):

sync
echo 1 > /sys/block/sdc/device/delete

+1 Esto funciona como se espera para evitar que el instalador detecte la unidad de disco duro. Debe ejecutar los comandos como root (no sudo).
clearkimura

1
Creo que lo mismo es factible el uso de sudo: sudo bash -c 'echo 1 > /sys/block/sdc/device/delete'.
Oriente el

3

Es probable que tenga el udisks2paquete instalado; puedes usar

udisksctl power-off -b /dev/sdX

¿Dónde /dev/sdXestá el dispositivo que desea apagar?

Desde la udisksctlpágina del manual (versión 2.7.6):

power-off
    Arranges for the drive to be safely removed and powered off. On the OS
    side this includes ensuring that no process is using the drive, then
    requesting that in-flight buffers and caches are committed to stable
    storage. The exact steps for powering off the drive depends on the
    drive itself and the interconnect used. For drives connected through
    USB, the effect is that the USB device will be deconfigured followed
    by disabling the upstream hub port it is connected to.

    Note that as some physical devices contain multiple drives (for
    example 4-in-1 flash card reader USB devices) powering off one drive
    may affect other drives. As such there are not a lot of guarantees
    associated with performing this action. Usually the effect is that the
    drive disappears as if it was unplugged.
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.