umountDetach a mounted filesystem safely
umount detaches a filesystem from the directory tree, after flushing its pending writes to disk. You need it before detaching a volume, running fsck, or resizing, and the most common thing you'll see is 'target is busy'.
umount [OPTIONS] DIR|DEVICEYou're about to detach the archive volume in the AWS console and must unmount it cleanly first.
sudoUnmounting needs root, like mounting (unless fstab marks the entry 'user').
umount calls the umount2() system call on the mount point. The kernel first checks whether the mount is still in use: any open file on it, a process whose current directory or root is inside it, a memory-mapped file, a swap file, or another filesystem mounted below it. If so it returns EBUSY and nothing changes. Otherwise it writes back all dirty pages and metadata for that filesystem, marks the superblock clean (so the next mount or boot won't force a check), and removes the mount from the tree; the directory's original contents become visible again. umount -l (lazy) detaches the mount from the tree right away and lets the kernel finish the cleanup when the last user goes away. umount -f is meant for unreachable NFS servers and does little for local disks. Detaching an EBS volume without unmounting is like pulling a USB stick: unflushed writes are lost.
-vVerbose-lLazy: detach now, clean up when no longer busy-fForce; mainly for unreachable NFS servers-RRecursively unmount everything below the mount point too-aUnmount everything in /proc/self/mounts (used at shutdown)-t TYPEWith -a: only filesystems of this type (e.g. -a -t nfs4)-rIf unmounting fails, try to remount read-onlyfuser -vm DIRCompanion: list processes using the mountlsof +f -- DIRCompanion: list open files on that filesystemDetaching an EBS volume in the console while it's mountedUnflushed writes are lost and the filesystem is left dirty; the instance may log I/O errors and hang processes.
sudo umount /data, remove or nofail the fstab line, then detachReaching for umount -l every time umount says busyLazy unmount hides the problem: processes keep writing to a filesystem you think is gone, and the device stays in use.
sudo fuser -vm /data (or lsof +f -- /data), stop those processes, then umountRunning umount /data from a shell whose current directory is /dataYour own shell keeps it busy.
cd ~ && sudo umount /dataTry these on a Linux machine of your own. Each task has a hint and a solution.
Check whether /mnt is a mount point, the way a script would.
Write the commands to find which processes keep /data busy and then unmount it.
Write the command that unmounts /mnt/rescue together with everything mounted below it.
umountDetach a mounted filesystem safely
umount detaches a filesystem from the directory tree, after flushing its pending writes to disk. You need it before detaching a volume, running fsck, or resizing, and the most common thing you'll see is 'target is busy'.
umount [OPTIONS] DIR|DEVICEYou're about to detach the archive volume in the AWS console and must unmount it cleanly first.
sudoUnmounting needs root, like mounting (unless fstab marks the entry 'user').
umount calls the umount2() system call on the mount point. The kernel first checks whether the mount is still in use: any open file on it, a process whose current directory or root is inside it, a memory-mapped file, a swap file, or another filesystem mounted below it. If so it returns EBUSY and nothing changes. Otherwise it writes back all dirty pages and metadata for that filesystem, marks the superblock clean (so the next mount or boot won't force a check), and removes the mount from the tree; the directory's original contents become visible again. umount -l (lazy) detaches the mount from the tree right away and lets the kernel finish the cleanup when the last user goes away. umount -f is meant for unreachable NFS servers and does little for local disks. Detaching an EBS volume without unmounting is like pulling a USB stick: unflushed writes are lost.
-vVerbose-lLazy: detach now, clean up when no longer busy-fForce; mainly for unreachable NFS servers-RRecursively unmount everything below the mount point too-aUnmount everything in /proc/self/mounts (used at shutdown)-t TYPEWith -a: only filesystems of this type (e.g. -a -t nfs4)-rIf unmounting fails, try to remount read-onlyfuser -vm DIRCompanion: list processes using the mountlsof +f -- DIRCompanion: list open files on that filesystemDetaching an EBS volume in the console while it's mountedUnflushed writes are lost and the filesystem is left dirty; the instance may log I/O errors and hang processes.
sudo umount /data, remove or nofail the fstab line, then detachReaching for umount -l every time umount says busyLazy unmount hides the problem: processes keep writing to a filesystem you think is gone, and the device stays in use.
sudo fuser -vm /data (or lsof +f -- /data), stop those processes, then umountRunning umount /data from a shell whose current directory is /dataYour own shell keeps it busy.
cd ~ && sudo umount /dataTry these on a Linux machine of your own. Each task has a hint and a solution.
Check whether /mnt is a mount point, the way a script would.
Write the commands to find which processes keep /data busy and then unmount it.
Write the command that unmounts /mnt/rescue together with everything mounted below it.