From owner-freebsd-questions@freebsd.org Wed Aug 19 12:29:58 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F163BD696 for ; Wed, 19 Aug 2020 12:29:58 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWnD262ntz3TQ9 for ; Wed, 19 Aug 2020 12:29:54 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([178.12.45.27]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPA (Nemesis) id 1N7Qp3-1kicBR2znx-017mtO; Wed, 19 Aug 2020 14:29:52 +0200 Date: Wed, 19 Aug 2020 14:29:52 +0200 From: Polytropon To: Christoph Kukulies Cc: Ruben via freebsd-questions Subject: Re: Correct way to disconnect/eject an USB hard disk ? Message-Id: <20200819142952.3686baa8.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:oEiwnNbXEfz0IYa4q1uqKCSqZdjjiwLdA31aGjquRdq6ASVa0gr c42tp3kB3jfwOxh4C6K2T9dA2SW3457IhCICJA17/O+UMkHB/UYtVlhNNGAVj1vuXeUMwuB F84v3WQ9rNhggYt/UTWHwvtKH3Zd21jYbWox8s5bvLknVbBHyFAcAWS8Aur0lNSaWXy2XtC indi7MC5a0GtEkwNFspzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9WcE40A68M8=:11szOYLjY34RjUs93EP3bu krDho0dPSM+mlcGuBFPJtz+BseC+76JexKWkqfcS3V5Iv6aQIXLOdissPHKL/MM2P4NNtzRIh WK2N2InoIlmy0eTmfiK0YcomH3vKAZU9QFUjNFHwncFsyhXnSxx6F9Izsbh1UGhw1uhtlSbCr 7xEZWnyov/rZtEue0K3ThEKba3YKl8t3gfAyDSqz4B+7qdPstyYExqs5UJyRo59Ho5rIlFjy4 jcAzXNcqVPRnlOnDvAq8xMOb/rFKiWR3iRHFtVM9j28TNwqzuq8qCkNEj0u3JrI5giokvUQ2u BOlNBGA9dFZBmZ0KiVYKHrWom+3sJlamlVIyo6gEmGDeCmz/Q3l8hmR0NseQ5Tm8KUXso6RDB Vnu2bRyCj7pnQYPCIsZywjbi3C3mS8Yj6taSWgKcjdOnoUQdKbYVp6+iK2usKVw5r3c27cFY/ AJg2H9IVGmTc8moitDHv/GAtj+Ug/53kpipy+6tj4HlpWpGpqcOwu5v1/8jkPXtCovS/VGyfd mLQVcirdL+XZ96Nz4gno5lwoM5q43ema+zzwAFTUiQEFVpyTOXH+G7YneMNoJRRL2TN9KUzef EP3Pj3VpwHZxheKmocbCE53aDQTwdZZTOHNl09KxoeCgsSNVaakJNJM1MouSgHbvaYZJ30a1n nR3SiAxqy42EE69CApQUGiMy544Bvcp1V1QHYx1YErUxYiUv0KCPasoSHZu9bvKxgiZ8YHhtc 3IvORD+RzCwSj0NbKh0B2ZogHwOtoGlYKiTB8+x2OUxhgyjnVQontxbkekNCZuJBnccxrpR2S LGtMzsq9yicR3naq82smneBPgOtlEVIhtptNTvUIajoVd+c6N3327AGJwmirzQ8WyVr1V+x X-Rspamd-Queue-Id: 4BWnD262ntz3TQ9 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 212.227.126.134) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [3.74 / 15.00]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RECEIVED_SPAMHAUS_PBL(0.00)[178.12.45.27:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.34)[0.341]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[212.227.126.134:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.126.134:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 12:29:58 -0000 On Wed, 19 Aug 2020 13:31:07 +0200, Christoph Kukulies wrote: > I had this /dev/da4 external USB drive connected to the system and had mounted > /dev/da4s3 to /mnt. > > After unmounting, are there any other measures to cleanly disconnect > the device? Usually not. If umount has been executed, and you wait a few seconds in order to let the command be finished successfully by the USB drive's firmware (last things to be written are _actually_ written), disconnect is possible at any time. The important thing to consider is that the filesystem should always be in a consistent state - that's what umount will accomplish. Due to the fact that "things need some time", waiting a few seconds is never wrong. After that, disconnecting power is no problem. > I found that someone wrote to use > > camcontrol eject This is not needed - except the device in question is an optical unit, in that case it's optional, but convenient, in most cases. :-) > This is my picture: > > dev/da0 /dev/da3 /dev/da4s2 /dev/da5 > /dev/da1 /dev/da4 /dev/da4s3 /dev/da5p1 > /dev/da2 /dev/da4s1 /dev/da4s4 /dev/da5p2 > # camcontrol devlist > at scbus0 target 0 lun 0 (ada0,pass0) > at scbus1 target 0 lun 0 (ada1,pass1) > at scbus2 target 0 lun 0 (ada2,pass2) > at scbus3 target 0 lun 0 (ada3,pass3) > at scbus4 target 0 lun 0 (cd0,pass4) > at scbus6 target 1 lun 0 (cd1,pass5) > at scbus7 target 0 lun 0 (da0,pass6) > at scbus7 target 1 lun 0 (da1,pass7) > at scbus7 target 2 lun 0 (da2,pass8) > at scbus7 target 3 lun 0 (da3,pass9) > at scbus8 target 0 lun 0 (da4,pass10) > at scbus8 target 0 lun 1 (da5,pass11) > # camcontrol eject da4 > Error received from stop unit command Not all USB devices implement the "eject" command _and_ reply that they have successfully executed it. That command is typically used for optical units, tape drives, and other kinds of drives where you eject a medium (!) from the drive. For USB-connected direct access media such as USB sticks, USB hard disks, USB-to-(P/S)ATA adapters or USB SSDs, this is not needed. Power off is enough. The "eject" command is often seen as a counterpart of the "load" command for those kinds of drives that support it. >From "man camcontrol": load Send the SCSI Start/Stop Unit (0x1B) command to the given device with the start bit set and the load/eject bit set. eject Send the SCSI Start/Stop Unit (0x1B) command to the given device with the start bit cleared and the load/eject bit set. Clearly, none of this applies to USB sticks. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...