Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [disk]

Questions about disk drives under the UNIX and Linux systems. See also the "filesystems" tag.

513
votes
37answers
535k views

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time ...
259
votes
9answers
623k views

How can I monitor disk io?

I'd like to do some general disk io monitoring on a debian linux server. What are the tools I should know about that monitor disk io so I can see if a disk's performance is maxed out or spikes at ...
89
votes
12answers
165k views

List partition labels from the command line

Is there a command that will list all partitions along with their labels? sudo fdisk -l and sudo parted -l don't show labels by default. EDIT: (as per comment below) I'm talking about ext2 labels - ...
63
votes
5answers
73k views

How can I safely remove a SATA disk from a running system?

I sometimes need to plug a disk into a disk bay. At other times, I have the very weird setup of connecting a SSD using a SATA-eSATA cable on my laptop while pulling power from a desktop. How can I ...
55
votes
5answers
6k views

Are file edits in Linux directly saved into disk?

I used to think that file changes are saved directly into the disk, that is, as soon as I close the file and decide to click/select save. However, in a recent conversation, a friend of mine told me ...
40
votes
2answers
59k views

Eject / safely remove vs umount

I'm using Ubuntu 12.04, and when I rigth click on a my flash drive icon (in the Unity left bar) I get two options that have me confused: eject and safely remove. The closer I came to an answer was ...
31
votes
1answer
100k views

How to get total read and total write IOPS in Linux?

How do I get read and write IOPS separately in Linux, using command line or in a programmatic way? I have installed sysstat package. Please tell me how do I calculate these separately using sysstat ...
26
votes
8answers
64k views

How to determine which sd* is usb? [duplicate]

Possible Duplicate: How to know if /dev/sdX is a connected USB or HDD? The output of ls /dev/sd* on my system is - sda sda1 sda2 sda3 sda4 sda5 sda6 sda7 sdb sdc sdc1 sdc2 How ...
24
votes
4answers
143k views

How to get hard disk information on linux terminal? [duplicate]

We can get CPU information using lscpu command, is there any command to get hard disk information on Linux terminal, in a similar way?
19
votes
3answers
31k views

Can I create a software RAID 1 with one device

I have a single disk that I want to create a mirror of; let's call this disk sda. I have just bought another identically-sized disk, which we can call sdb. sda and sdb have one partition called sda1 ...
18
votes
6answers
74k views

What does `dd if=/dev/zero of=/dev/sda` do

Edited: do not run this to test it unless you want to destroy data. Could someone help me understand what I got? dd if=/dev/zero of=/dev/sda bs=4096 count=4096 Q: Why specifically 4096 for count? ...
18
votes
4answers
22k views

Given a kernel ATA exception, how to determine which physical disk is affected? [duplicate]

I woke up this morning to a notification email with some rather disturbing system log entries. Dec 2 04:27:01 yeono kernel: [459438.816058] ata2.00: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x6 ...
16
votes
4answers
35k views

Is there a good drive torture test tool?

I have been having odd and rare filesystem corruption lately that I suspect is the fault of my SSD. I am looking for a good drive torture test tool. Something that can write to the whole disk, then ...
16
votes
2answers
4k views

How to detect if a disk is seeking?

I can use a variety of tools to measure the volume of disk I/O currently flowing through the system (such as iotop and iostat) but I'm curious if it's possible to easily detect if a disk is seeking a ...
14
votes
3answers
8k views

How to get total number of bytes/sectors/blocks written to disk since booting?

I'm considering and update from HDD to SSD. But since Flash cells can only sustain limited writes. I want to know how much data my computer write during normal operation. So I can determine how long ...
14
votes
3answers
1k views

Horrible situation - file systems mounted simultaneously by multiple independent OS instances

How do I get out of this situation safely? Details are as follow: A xen server has got block devices allocated to VMs. But these devices have also been mounted inside Xen. In fact 44 of these ...
13
votes
1answer
11k views

Why is most the of disk IO attributed to jbd2 and not to the process that is actually using the IO?

When monitoring disk IO, most of the IO is attributed to jbd2, while the original process that caused the high IO is attributed a much lower IO percentage. Why? Here's iotop's example output (other ...
13
votes
1answer
3k views

Unable to close a Luks partition

For backup purposes, I have "snapshotted" a LVM partition. This partition was crypted so I have opened this Luks partition (snapshot) in order to do my backup. The problem is that I have forgotten to ...
12
votes
1answer
7k views

reference whole disk (/dev/sda) using UUID

On my system (Debian), I can see the UUID identifier for all of my disks partitions (i.e. /dev/sda1, dev/sda2, ..) ls /dev/disk/by-uuid/ However, I don't see the UUID identifier for /dev/sda itself. ...
10
votes
2answers
23k views

Get simple list of all disks [duplicate]

How to get a list of all disks, like this? /dev/sda /dev/sdb
10
votes
2answers
1k views

Unable to copy large file onto ext2 usb stick [closed]

I have an 8G usb stick (I'm on linux Mint), and I'm trying to copy a 5.4G file into it, but getting No space left on device The filesize of the copied file before failing is always 3.6G An output ...
9
votes
3answers
505 views

Physically break into box? (Memory & disk)

I have a VPS. I might be able to encrypt my partition but I havent tried. My VPS company I believe can reset my root password although the only SSH key I see is my own. With all my data I have it ...
9
votes
2answers
4k views

FreeBSD 10 trace disk activity

Is there any way to find some process which is periodically writing to disk (according to hdd led) on FreeBSD 10 with ZFS (maybe turn ZFS into verbose logging mode)? lsof and other instantly ...
9
votes
4answers
1k views

Are short-lived files flushed to disk?

My program creates many small short-lived files. They are typically deleted within a second after creation. The files are in an ext4 file system backed by a real hard disk. I know that Linux ...
9
votes
1answer
7k views

How does iotop calculate the relative I/O activity?

I am running some heavy I/O processes on my workstation and recently installed iotop to monitor them. Here's a recent screenshot: I'm a bit confused about the readings in the IO> column. It ...
8
votes
1answer
27k views

How to increase /tmp folder size manually

I have no free space left on /tmp folder in Fedora 26. That cause several problems. Folder /tmp takes up all the free RAM: $ df -h /tmp Filesystem Size Used Avail Use% Mounted on tmpfs ...
8
votes
4answers
41k views

UUID Of A drive that won't show up in /dev/disk/by-uuid or blkid

I have a USB drive that is not receiving a UUID. When I look at the contents of the /dev/disk/by-uuid it doesn't exist there. The dev point that the partition lives in is on /dev/sdb. I am able to ...
8
votes
2answers
7k views

Fixing bad blocks

After getting WARNING: Your hard drive is failing Device: /dev/sdb [SAT], 1 Offline uncorrectable sectors I run $ sudo smartctl -a /dev/sdb smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514....
8
votes
2answers
3k views

How do I refresh the magnetic state on a disks with backups?

I have a couple of large disks with backup/archive material on them. They're ext4. Regarding the ones of those that will be stored for a couple of years without reading the whole disc again I've been ...
8
votes
2answers
9k views

recovering ext4 partition after dd'ing over start of HD

I accidentally used dd and wrote over the first 208MB of my external disk. What I wrote over is a partition on its own (Debian nestinstaller) so what I see now is not my old (now damaged) ext4 ...
8
votes
2answers
605 views

Recognizing GPT partition table created with different logical sector size

I have a 3TB drive which I have partitioned using GPT: $ sudo sgdisk -p /dev/sdg Disk /dev/sdg: 5860533168 sectors, 2.7 TiB Logical sector size: 512 bytes Disk identifier (GUID): 2BC92531-AFE3-407F-...
8
votes
3answers
3k views

How to create a fixed size Linux ramdisk which does never swap to disk?

I want to create a fixed size Linux ramdisk which never swaps to disk. Note that my question is not "why" I want to do this (let say, for example, that it's for an educative purpose or for research): ...
8
votes
1answer
3k views

Command to generate /dev/disk/-by-path/ name on a system without udev daemon

On most Linux systems udev usually creates symlinks in /dev/disk/by-uuid/ /dev/disk/by-path/ which point to actual device nodes (/dev/sda, /dev/sdb, etc). I don't have udev on my system, and I ...
7
votes
3answers
28k views

Mounting another VM's .vdi in VirtualBox

I have two VMs in VirtualBox. For exmaple, VM 1 runs Red Hat, and VM 2 runs Ubuntu. For the Red Hat VM I have redhat.vdi and redhat2.vdi, and for the Ubuntu VM I have ubuntu.vdi and unbuntu2.vdi. ...
7
votes
1answer
20k views

“fdisk -l” output: what are Disk label type“ and ”Disk identifier"

fdisk -l output: . . Disk label type: dos Disk identifier: 0x0006a8bd . . What are Disk label type and Disk identifier? Also, apart from the manuals, where else can I find more information about ...
6
votes
3answers
1k views

Why is dd not protected against writing on the active disk ?

I use dd a lot. I live in a contant fear of making a mistake one day, for example writing on sda (computer disk) instead of sdb (USB disk) and then erasing everything I have on my computer. I know dd ...
6
votes
2answers
3k views

How to construct a GPT-only partition table on Linux?

All of the tools I've tried until now were only capable to create a dual (GPT & MBR) partition table, where the first 4 of the GPT partitions were mirrored to a compatible MBR partition. This is ...
6
votes
3answers
12k views

Using SAR to monitor free disk space data

Is there a way to make sar (from sysstat) collect free disk space data?
6
votes
2answers
1k views

Does the position of partition on disk affect speed?

If I put /var as first partition, then /home and /, will the partition for /var have better performance than if I put other partitions close to head of the disk? Will the disk sector position matter? ...
6
votes
3answers
31k views

Stat disk drives wihout lsblk?

I have a minimalist busybox system that I was recently trying to use, and I found a small problem: it has no lsblk command. Is there another command to list disks, partitions, and sizes like lsblk? ...
6
votes
1answer
423 views

why linux cp command don't consume disk IO?

os: centos7 test file: a.txt 1.2G monitor command: iostat -xdm 1 The first scene: cp a.txt b.txt #b.txt is not exist The second scene: cp a.txt b.txt #b.txt is exist Why the first ...
6
votes
4answers
8k views

How to use DD to clone a partition off a disk image?

I have a disk image, it's a "whole" disk image, e.g., contains multiple partitions, and I want to clone just one of them (not the first one..) onto a partition on an external drive with multiple ...
6
votes
1answer
714 views

???? files in ls -l output

I see ghost files in red colour inside some of my directories: [drey@cyan|23:54|~/downloads]ls -la ls: cannot access teamviewer9_linux.deb: No such file or directory total 1318096 drwxrwx--- 1 root ...
6
votes
3answers
334 views

How can a disk without a partition be “partitioned” without losing data?

I have a 1TB portable hard drive that I use for backups. The entire drive (/dev/sdb) has been formatted as an ext4 filesystem. I have been reading about the benefits of btrfs for backups (checksums, ...
6
votes
2answers
3k views

how can I sync a specific device? [duplicate]

Is there a way to sync a specific device in Linux? This would be used to ensure that, e.g., writes to a USB thumb drive have taken place without waiting for queued writes from a video processing job ...
6
votes
1answer
2k views

How to find out which file is affected by a bad sector?

Consider you've been informed about a bad sector like this: [48792.329933] Add. Sense: Unrecovered read error - auto reallocate failed [48792.329936] sd 0:0:0:0: [sda] CDB: [48792.329938] Read(10): .....
6
votes
1answer
995 views

dd, seek with one block size, write with another block size

Background Info: Copying some .bin files to an SD card (to be read by an embedded device, no filesystem) Commissioning the card requires some segments to be wiped (i.e. zero'd), and others to have ...
6
votes
2answers
3k views

How does Linux md-RAID handle disk read errors?

There are 2 cases: the read command times out at kernel level (30 seconds by default), the drive reports its unability to read a given sector before the kernel lose patience (the case I'm ...
5
votes
2answers
588 views

Errors on cloning disk with cat

I wish to clone a large disk (a 500GB SSD, for what it's worth), and I am leaning toward using cat, as suggested by Gilles here. But what gave me pause is that I do not really know what cat does upon ...
5
votes
2answers
473 views

How do commands like fdisk -l find the sector size?

Does the MBR of the disk contain this information and therefore when i call a command like fdisk, a kernel level code eventually runs and reads it from a specific part in MBR? If so, which part of it? ...