Tag Info

Hot answers tagged

64

blockdev --getsize64 /dev/sda returns size in bytes. blockdev --getsize /dev/sda returns size in sectors.


26

fdisk doesn't understand the partition layout used by my Mac running Linux, nor any other non-PC partition format. (Yes, there's mac-fdisk for old Mac partition tables, and gdisk for newer GPT partition table, but those aren't the only other partition layouts out there.) Since the kernel already scanned the partition layouts when the block device came into ...


19

This is the size of space on the disk that is used to store the meta information for the directory (i.e. the table of files that belong to this directory). If it is i.e. 1024 this means that 1024 bytes on the disk are used (it always allocate full blocks) for this purpose.


12

It seems that you have a lot more files than normal expectation. I don't know whether there is a solution to change the inode table size dynamically. I'm afraid that you need to back-up your data, and create new filesystem, and restore your data. To create new filesystem with such a huge inode table, you need to use '-N' option of mke2fs(8). I'd ...


9

If your program doesn't need to write any OTHER files that would be larger than this limit, you can inform the kernel of this limit using ulimit. Before you run your command, run this to setup a 200MB file size limit for all process run in your current shell session: ulimit -f $((200*1024)) This will protect your system but it might be jaring for the ...


9

The dot file, like every directory, contains a list of names for the files in this directory and their inode numbers. So if you once had lots of files in that directory (not unlikely for a "tmp" directory) that would have made the directory entry grow to this size. After the files are gone, the file system doesn't automatically shrink the directory file ...


8

If your application (ie. run_program) does not support limiting the size of the log file, then you can check the file size periodically in a loop with an external application or script. You can also use logrotate(8) to rotate your logs, it has size parameter which you can use for your purpose: With this, the log file is rotated when the specified size ...


8

How about: fdisk -l This will give you a list of all your disks with their respective capacity, usage, and more.


8

This does the whole job in one go - in all child directories, all in a single stream without any filename problems. It'll copy from smallest to largest every file you have. You will need to mkdir ${DESTINATION} if it doesn't already exist. find . ! -type d -print0 | du -b0 --files0-from=/dev/stdin | sort -zk1,1n | sed -zn 's/^[^0-9]*[0-9]*[^.]*//p' | tar ...


7

A directory reserves 4096 bytes (at minimum) for meta-data about itself and its contents. Also, 4096 bytes is the default allocation unit (block) for ext2/ext3/ext4 filesystem and therefor a directory cannot be any smaller. On different filesystems you might find directories with different default sizes, that is due to the default block size of the ...


7

You can use the unzip utility with the -v flag: unzip -v files.zip Archive: files.zip Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 0 Stored 0 0% 11-23-2011 15:02 00000000 file1 0 Stored 0 0% 11-23-2011 15:02 00000000 file2 -------- ...


7

Virtualbox images can be resized from outside Virtualbox. Run this command on the VDI: VBoxManage modifyhd SLACK.vdi --resize 100000 That last number is the size in MiB.


6

find ./photos/john_doe -type f -name '*.jpg' -exec du -ch {} +


6

The -a in an explicit AND operator that allows you to conjoin two primaries. In this case creating a range using -size. find . -size +386b -a -size -390b -exec rm -f {} \; Note the size is a numeric argument that can optionally be prepended with + and -. From man 1 find: Numeric arguments can be specified as +n for greater than n, -n ...


6

Using sgdisk You can use sgdisk to print detailled information: sgdisk --print <device> […] Disk /dev/sdb: 15691776 sectors, 7.5 GiB Logical sector size: 512 bytes […] When you multiply the number of sectors with the sector size you get the exact byte count that should match the output of dd. Using /sys directly You can also get those numbers ...


5

You may create a new filesystem image, mount it using loop device and put the log file on that filesystem: dd if=/dev/zero of=./200mb.img bs=1024 count=200000 # create new empty 200MB file mkfs.ext2 200mb.img # or ext3, or whatever fits your needs mkdir logs sudo mount -t ext2 -o loop 200mb.img logs # only root can do '-o loop' by default run_program ...


5

You can truncate the output with head: size=$((200*1024*1024-$(stat -c %s myprogram.log))) run_program | head -c ${size} >> myprogram.log


5

A maximum resolution of 800x600 suggests that your X server inside the virtual machine is using the SVGA driver. SVGA is the highest resolution for which there is standard support; beyond that, you need a driver. VirtualBox emulates a graphics adapter that is specific to VirtualBox, it does not emulate a previously existing hardware component like most ...


5

Doesn't unzip -l somefile.zip do exactly what you want?


5

You could simply re-create the image "from scratch" with mkisofs. $ mkisofs -o new_image_name /path/to/the/mounted/dvd If you don't have the CD-ROM available anymore, loop-mount the iso image with: $ sudo mount -o loop /media/disk/linux.iso /path/to/the/mounted/dvd (And don't forget to unmount it.) This will not copy boot information from the DVD. If ...


5

Create an extended partition spanning the new free space, and create a logical partition inside it. (You could create a primary partition, but that would reduce your options later, because of the limit of 4 primary partitions or 3 primary and one extended.) You can do this with fdisk or cfdisk or parted. Set the type of the new partition to 8e (“Linux ...


5

You're using LVM, the logical volume manager. This gives you a lot more flexibility than you would get with simple partitions, but you need to understand how everything fits together. I would start first at the LVM page on Wikipedia, paying special attention to the diagram that shows all the parts. LVM is a stack, with your physical block devices -- ...


5

blockdev --getsize /dev/sda


5

List the files, extract the size in bytes from the list, sort it and count the occurrence of every size: find /my/directory -type f -exec ls -l {} + | cut -d' ' -f5 | sort -n | uniq -c not terribly efficient if there are many many files it may be better to save intermediate results in a temp file, sort it to another temp file, then "uniq" it here I use ...


5

If you want the size of the subdirectories, use du. This will print the size of the subdirectories recursively (-h is for human readable sizes): du -h /media/nss/MBVOL2/TEST1/ If you only want a summary and not each of the results, use -s: du -sh /media/nss/MBVOL2/TEST1/ If you want the size of the directories regarding the atime condition of your ...


4

find . -size -1M will only show file of size less than 1M, that is 0M. Yes, I know, it's confusing. find . -size 1M will show you files whose size (rounded up to the upper MiB) is 1M (so any file size from 1 to 1048576). If you want from 0 to 1048575 (< 1M), that would be: find . -size -1048576c If you want from 0 to 1048576 (<= 1M) find . -size ...


4

You need to use logrotate. Do something like this cat /etc/logrotate.conf /path/foo.txt { size 50M create 700 root root rotate 5 } size 50M – logrotate runs only if the filesize is equal to (or greater than) this size. create – rotate the original file and create the new file with specified permission, user and group. rotate – limits ...


4

Try this: locate apattern | xargs du -h



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