Tag Info

Hot answers tagged

68

Don't go straight to du /. Use df to find the partition that's hurting you, and then try du commands. One I like to try is du -h <dir> | grep '[0-9]G' because it prints sizes in "human readable form". Unless you've got really small partitions, grepping for directories in the gigabytes is a pretty good filter for what you want. This will take ...


36

du can be depth-restricted: du -d 5 Will only recurse to depth 5. /EDIT: This counts only for the display; the tool will still determine the total size of the whole directory tree but this is still much faster than running a full du.


27

For disk I/O trending there are a few options. My personal favorite in the sar command from sysstat. By default, it gives output like this: 09:25:01 AM CPU %user %nice %system %iowait %steal %idle 09:35:01 AM all 0.11 0.00 0.01 0.00 0.00 99.88 09:45:01 AM all 0.12 0.00 0.01 0.00 ...


18

Naturally, you need to unmount any filesystems on the disk, and it'd be a good idea to deactivate any LVM groups (vgchange -an), and generally make sure nothing is using the disk for anything. Once you've done that, it should be safe to unplug. If you want to be extra cautious, do echo 1 > /sys/block/(whatever)/device/delete first. That'll unregister ...


13

Assuming you're on Linux. Try: sudo /lib/udev/scsi_id --page=0x80 --whitelisted --device=/dev/sdc or: cat /sys/block/sdc/device/{vendor,model} You can also get information (including labels) from the filesystems on the different partitions with sudo blkid /dev/sdc1 The pathid will help to determine the type of device: readlink -f ...


12

As a general rule, physical access to the machine is all that's ever needed to compromise it. You are, after all, trusting that what the machine tells you is true; a person with physical access can void that trust. Consider that an attacker with physical access can theoretically do anything (including installation of hardware/firmware rootkits, etc). If the ...


11

I like dstat. It can show totals and statistics per disk and even md-devices (RAID), also can use colors for better overview: $ dstat -tdD total,sda,sdb,sdc,md1 60 ----system---- -dsk/total----dsk/sda-----dsk/sdb-----dsk/sdc-----dsk/md1-- time | read writ: read writ: read writ: read writ: read writ 08-11 22:08:17|3549k 277k: 144k 28k: 851k ...


9

If you are using /dev/sda1 as your current system root, you will be unable to unmount it, and doing so would prevent you from running parted from it anyway. resize2fs is able to enlarge ext3/4 filesystems while mounted on newer kernels, but not shrink them. Your best bet is probably to use the gparted live CD or gparted included with System Rescue CD. ...


9

Finding the biggest files on the filesystem is always going to take a long time. By definition you have to traverse the whole filesystem looking for big files. The only solution is probably to run a cron job on all your systems to have the file ready ahead of time. I'd like to have a system that builds a tree of file sizes at the same time as building the ...


8

On recent version of Linux, there are /dev/disk/by-{id,label,path,uuid} directories that contain automagic symlinks to the various /dev/sdX and /dev/sdXN entries (I believe all of these are setup by udev). These provide more stable and informative names for your disks and partitions. I find /dev/disk/by-label/ the most useful (especially if you label your ...


8

Look at this page http://linuxpoison.blogspot.com.au/2009/02/how-to-measure-and-read-disk-activity.html # cat /sys/block/sda/stat 11836508 1974427 276764974 242202738 13703385 18793696 597760590 2010426698 135 76333414 2253542452 Field 3 -- # of sectors read Field 7 -- # of sectors written


7

Using iotop. Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.5 (or Python ≥ 2.4 with the ctypes module) and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.


7

If on Linux, when loading the loop module, make sure you pass a max_part option to the module so that the loop devices are partitionable. Check the current value: cat /sys/module/loop/parameters/max_part If it's 0: modprobe -r loop # unload the module modprobe loop max_part=31 To make this setting persistent, add the following line to ...


6

The first idea I found is the vmstat -d command. It tells you the number of sectors written since booting. fdisk -l will tell you the sector size. By multiplying the two you can get the number of bytes touched. It seems my computer does roughly 1 gigabytes worth of writing in two hours. By doing a quick calculation a 128G SSD with 3000 write cycles would ...


6

Not sure if you're looking for tools that show this type of information in a real-time type of way or over a period of time, but here are 2 tools that show the real-time aspects of the disk being accessed. nmon You invoke it like so, nmon. Then once it's open you hit the j (Filesystems) followed by a d (Disk I/O Graphs D=Stats). See the built-in help (h) ...


6

I always use du -sm * | sort -n, which gives you a sorted list of how much the subdirectories of the current working directory use up, in mebibytes. You can also try Konqueror, which has a "size view" mode, which is similar to what WinDirStat does on Windows: it gives you a viual representation of which files/directories use up most of your space. Update: ...


6

For the commandline I think the du/sort method is the best. If you're not on a server you should take a look at Baobab - Disk usage analyzer. This program also takes some time to run, but you can easily find the sub directory deep, deep down where all the old Linux ISOs are.


5

udev knows your system. so you can get info through udevadm , under /sys/ like this (run as root, or with sudo depending on your distro) udevadm info -a -p /sys/block/sdb udevadm info -a -p /sys/block/sdc reading through the output you'll come across some meaningful results, such as ATTRS{vendor} ATTRS{model} you should be able to get some info about ...


5

Yes, it is true. The platters in a disk rotate at a fixed speed (7200 RPM in the common case). As such when the head is over the outer portion of the platter more surface area passes under the head per rotation than on the inside track. Thus more IO per rotation is possible. (The 'beginning' of the drive is the outside tracks of the platters) Now whether ...


5

That was very true a decade ago, when drive IO speeds were the major bottleneck. In fact, it was recommended placing your swap on a separate drive, to keep it off your primary's BUS. IO speeds have improved since then, partition placement for performance tweaks are negligible now. To add, and assuming placing swap closer would improve performance, it would ...


5

Turns out doing the mapping was easier than I realized. dmesg | grep ata2 | head gives the kernel's mapping of the drive during the boot process. Or you could just go for ata2.00 right away. [ 2.448300] ata2: SATA max UDMA/133 abar m1024@0xfeb0b000 port 0xfeb0b180 irq 19 [ 2.940139] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300) [ ...


5

This is just a thought and has more than one downside, but it might be usable enough anyway. How about creating an image file and a filesystem inside it on top of ramfs, then mount the image as a loop device? That way you could limit the size of ramdisk by simply limiting the image file size. For example: $ mkdir -p /ram/{ram,loop} $ mount -t ramfs none ...


4

Since the data has to be decrypted to be usable, it will be available in an unencrypted state during runtime. You should treat it as though the provider can access the live running system at any time without your knowledge. This includes data at rest on disk, data contained in memory (such as decryption keys) and even any keystrokes you send (i.e., assume ...


4

Finalized bash sample There is a little part of a script I wrote to create and install live usb key, (dual boot ubuntu - debian): The very first part USBKEYS=... is the answer to this question In short, this: list removable devices, driven by sd and having non zero size. Note This script use dialog which seem not installed by default on Ubuntu. But ...


4

Use umount. You ran umount -l, which specifically tells umount to leave the filesystem mounted until all processes are done with it. You really shouldn't need umount -l most of the time; the only purpose it serves is freeing up the mount point so you can mount something new there while the currently mounted partition is still in use. Now that you've already ...


4

Adding a virtual disk can be done either using virt-manager (A graphical interface for KVM) or virsh. Using virsh: virsh edit VM-name Modify your configuration file as needed and save the configuration file (See your vda configuration line). NOTE: You need to reboot the VM so the virtual disk is recognized. Shutdown your VM using virsh destroy ...


4

You can use the virsh option mentioned above (probably faster, in fact) or you can use the "Add Hardware" option in virt-manager to either add new space or assign existing space. Simply open the VM, go to "Details" (top left), and select "Add Hardware" (bottom left): Storage is the default type of hardware, so it should already be selected by default. ...


4

This is how you add another virtual hard disk to a VM in VirtualBox. Go into the VirtualBox Manager and make sure both VMs are shut down Right-click on the VM in question and pick Settings Go into the Storage category Select the controller on which you want to connect the virtual hard disk Click the "Add attachment" button and select "Add hard disk" from ...



Only top voted, non community-wiki answers of a minimum length are eligible