Hot answers tagged hard-disk
32
You can send dd a certain signal using the kill command to make it output its current status. The signal is INFO on BSD systems (including OSX) and USR1 on Linux. In your case:
kill -INFO $PID
You can find the process id ($PID above) with the ps command; or see pgrep and pkill alternatives on mac os x for more convenient methods.
As an example on Linux, ...
22
Linux automatically detects SSD, and since kernel version 2.6.29, you may verify sda with:
cat /sys/block/sda/queue/rotational
You should get 1 for hard disks and 0 for a SSD.
See this answer for more information...
20
This is highly platform-dependent. Also different methods may treat edge cases differently (“fake” disks of various kinds, RAID volumes, …).
On modern udev installations, there are symbolic links to storage media in subdirectories of /dev/disk, that let you look up a disk or a partition by serial number (/dev/disk/by-id/), by UUID (/dev/disk/by-uuid), by ...
20
You can add a rate limiting tool to your pipeline.
For example there is pv which has a rate-limiting option:
-L RATE, --rate-limit RATE
Limit the transfer to a maximum of RATE bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote kilobytes (*1024), megabytes, and so on
An alternative is the tool buffer which has:
...
18
Unless your "friend" is the NSA, tools that do lots of random or pattern overwriting (as DBAN which others are recommending does) are overkill - dd if=/dev/zero of=[your disk... make sure you get it right] bs=10M will erase it so that it can't be recovered without taking the disk apart and scanning the platters with special hardware.
If you use /dev/urandom ...
14
Historically, hard drives have only been able to contain at most four partitions because of the originally defined format of the partition table. This is not specific to operating systems. You simply can't create more than four primary partitions.*
In order to circumvent this limit and still remain compatible with older systems, you can create an extended ...
12
Depending on your SATA driver and your distribution's configuration, they might show up as /dev/hda and /dev/hdb, or /dev/hda and /dev/sda, or /dev/sda and /dev/sdb. Distributions and drivers are moving towards having everything hard disk called sd?, but PATA drivers traditionally used hd? and a few SATA drivers also did.
The device names are determined by ...
12
No, it doesn't. The issue isn't with the type of disk (spinning/non-spinning), it's with committing disk buffers from RAM to disk. If the power goes out suddenly, some of these buffers may never get committed to disk, and having barriers enabled improves your chances of recovering the filesystem.
There's also an additional issue with the disk's on-board ...
12
You can look in /sys/block:
-bash-3.2$ ls -ld /sys/block/sd*/device
lrwxrwxrwx 1 root root 0 Jun 8 21:09 /sys/block/sda/device -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0
lrwxrwxrwx 1 root root 0 Jun 8 21:10 /sys/block/sdb/device -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
lrwxrwxrwx 1 root root 0 Jun 8 ...
12
There is a very popular tool called shred. It will overwrite every file 25 times before it will be deleted. That might me what you are looking for.
Usage of shred is quite simple
$ shred secret_archive.tar.gz
Note however that on modern systems shred might be inefficient or useless if:
Your programs create temporary files you are not aware of (Like ...
11
You fail to mention your operating system, but on linux, this works:
$ df /path/to/some/file/or/directory
Filesystem 1k-blks Used Avail Cap Mounted
/dev/harddisk_partition 8388348 5187768 3200580 62% /home/username
^^^^^^^^^^^^^^^^^^
11
Did you tried to examin what programs like iotop is showing? It will tell you exacly what kind of process is currently writing to the disk.
example output:
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 ...
10
A user's home directory is the initial directory when a user logs in. Normally the user may create files and directories only in in home directory (apart from temporary directories). Also various settings (user specific startup files and such) are usually stored in the user's home directory.
Server is just annother name for a host (a computer). Think of a ...
10
When mv is moving to a different filesystem, it firsts copies all data to the new filesystem. Once the new data is copied, it removes the old data. This means that if the move is interrupted of failed, the source location should still contain all of the data.
As far as recovering, only the destination data should be corrupt. Instead of using mv to again, ...
10
You can use hdparm to retrieve information about your hard drives, eg.,
hdparm -I /dev/sda
Where I, according to the man page:
-I Request identification info directly from the
drive, which is displayed in a new expanded format with considerably
more detail than with the older -i option.
For SCSI drives, use sdparm.
9
You're doing small random writes, which is pretty much the slowest thing you can do on a spinning disk, so I would say your throughput meets (my) expectations.
Your avgrq-sz size is 15.35, which means your average request is 15.35 x the sector size of your SATA disk (most commonly 512 bytes, but possibly 4096 bytes on a very new SATA disk), so you're ...
9
Yes. You can create a VMDK (not a VDI — you have to use the VMware disk image format) that accesses a raw disk. You can easily use a logical volume as if it were a whole disk, but just like most virtual disks, you probably won't be able to make the host kernel interpret its partition table and mount it.
Once you create your volume, just run
VBoxManage ...
9
There are plenty of ways for an unprivileged user to slow down a system and running sync is far from being the more efficient. On the other hand, having the file systems data committed to disk is quite a legitimate request so forbidding users (and thus their processes) to do it would be excessive.
In any case, I disagree about your "unnecessary disk writes" ...
8
For dd, you can send a signal. For other commands that are reading or writing to a file, you can watch their position in the file with lsof.
lsof -o -p1234 # where 1234 is the process ID of the command
lsof -o /path/to/file
If you plan in advance, pipe the data through pv.
8
The purpose of multiple options here is a matter of compatibility, not performance. They all do essentially the same thing, so any performance differences are likely to be implementation maturity issues rather than inherent flaws in the format's design.
VDI will have received the most attention in VirtualBox, VMDK in VMware, etc.
My advice, then, is to ...
8
No question, rsync will be faster. dd will have to read and write the whole 1.5TB and it will hit every bad block, triggering multiple read retries which will further slow an already long process. rsync will only have to read blocks that matter, and since it is unlikely that every bad block occurs in existing files or directories, rsync will encounter ...
7
If you really don't care about reliability, you can use LVM and keep adding physical volumes to a single volume group. That is, you would have a single volume group acting as a virtual drive, made up of several physical volumes (the actual drives). Instead of PC-style partitions, you'd create logical volumes for filesystems and swap.
LVM is a good idea ...
7
Unmount the drive and run badblocks -n on it. This will rewrite every sector on the drive — read-then-write, so it's nondestructive — which forces the drive to swap in a fresh sector for every dodgy one found during the pass.
If badblocks can't fix it, you could step up to SpinRite which does that and more.
If either of those "fixes" the drive ...
7
If you can see the LED on the drive, or listen to the disk noise, you can run
sudo cat /dev/sdb >/dev/null
and see which drive suddenly becomes continuously active. Or, if you're going by noise,
sudo find /mount/point >/dev/null
which will make the heads move more (it may be better not to do it on the failing disk, and instead use a process of ...
7
I think the intro to the info page answers all your questions:
It first uses some of the same code that's used by `cp -a' to copy the
requested directories and files, then (assuming the copy succeeded) it
removes the originals. If the copy fails, then the part that was
copied to the destination partition is removed. If you were to copy
three ...
6
I don't think you can, easily, tell it "temporarily stop caching". But what you can do is tell the system to drop the cache before each run:
As root:
sync; echo 3 > /proc/sys/vm/drop_caches
(This is documented in the kernel docs at Documentation/sysctl/vm.txt, which is handy if like some of us you can't always remember offhand what the values 1, 2, or ...
6
The Electronic Frontier Foundation's Surveillance Self-Defense site recommends Darik's Boot and Nuke. It's a self-contained boot CD, so it works with any OS.
Beware that DBAN will erase every hard drive connected to the computer. If you have other hard drives that you plan to keep, make certain they're unplugged before booting DBAN.
6
The Arch Linux Wiki has a comprehensive list of the field definitions in your /etc/fstab file, including those that you are asking about:
nodev - Don't interpret block special devices on the filesystem.
nosuid - Block the operation of suid, and sgid bits.
0 2 are, respectively, dump & pass:
<dump> - used by the dump utility to decide when to ...
6
It means that there are 22 sectors that could not be read. The next time you write to those sectors, if they can not be correctly written to, they will be remapped to a spare sector. You can use the badblocks utility to locate the bad sectors, and dd to write to them:
sudo badblocks -b 512 /dev/sda
For each sector listed, first verify that it can not be ...
6
Well, there are a couple of cases:
This disk is part of a RAID array. Good. Just have md 'repair' the array like this: echo 'repair' > /sys/block/md0/md/sync_action. Problem solved without data loss. (I'm guessing this isn't the case for you, but you really ought to consider changing that.)
You don't care about the data on the disk (or there isn't any). ...
Only top voted, non community-wiki answers of a minimum length are eligible