Tag Info

Hot answers tagged

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 ...


11

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

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

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 ...


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 -------- ...


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 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

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 ...


4

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 ...


4

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 ...


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

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 ...


3

Whenever find expects a number, you can put a + sign before it to mean more than this number, or a - sign to mean less than this number. These are strict inequalities: +3 and -7 means 4, 5 or 6. With the -size primary, you need to add the suffix c to indicate that the number is a number of bytes. You can concatenate multiple primaries to take their ...


3

You could write a little bash script to do this. Just tail the file to a certain byte count using tail -c and overwrite the file. from man tail: -c, --bytes=N output the last N bytes; alternatively, use +N to output bytes starting with the Nth of each file If the first character of N (the number of bytes or lines) is a ...


3

Just make it work with a little bash scripting. Print the size and filename, if it is a directory add a trailing slash. du -ab | while IFS=$'\t' read -r size line; do printf "%s\t%s" $size "$line"; [[ -d $line ]] && printf "/"; echo; done This will work with any file name not containing newlines or ending with a tab.


3

Several possibilities. a) scp may not have copied hidden files/directories; hard to tell w/o knowing your data, seeing how you invoked scp. b) another scenario will be that the filesystems use different block-sizes, and du doesn't add up the files byte sizes, it measures occupied disk space.


3

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 ...


3

When you delete all the files from a directory, for most file systems, the directory remains the same size. If the directory is empty, rmdir ./directory_name; mkdir ./directory The resulting new directory will be smaller. But as files are added it will grow larger. Do not worry about directory file size as much as the number of files in a single ...


3

since you are using LVM to manage your /usr partition, you probably should check the LVM-documentation. to extend the partition (to e.g. 10GB) # lvextend -L10G /dev/mapper/vg0-usr after that you can extend the filesystem. this is fs-specific, under ext3 use: # resize2fs /dev/mapper/vg0-usr you might have to reboot between the two commands, and it ...


3

You can do this in two commands: find A -name "*.log" -size -10485760c -exec cp {} B/ + find A -name "*.log" -size +10485760c -exec cp -i {} B/ + The first finds files smaller than 10485760 and copies indiscriminately. The second finds files larger than 10485760 and copies interactively, prompting for each copy. Put them into a shell script or function ...


3

It always annoys how CentOS/RHEL, by default, on a large hard disk, create a fairly small / partition and a really huge /home partition. This is why, when install CentOS, I always manually partition, and never use LVM (which, I have heard, also reduces performance). LVM makes sense when you want to stream a partition across multiple hard disks, but not as ...


2

blockdev provides a way to set/get block device attributes. To get the size in bytes: blockdev --getsize64 /dev/sda Alternatively, some info is available under /sys/block/<device> directory, e.g. cat /sys/block/sda/size gives the sda size measured in blocks of 512 bytes. See /sys/block/sda/sda1/size for sda1 partition size. For sda size in KiB ...


2

Parsing fdisk -l /dev/sda should give you exactly that: Disk /dev/sda: 68.7 GB, 68719476736 bytes 255 heads, 63 sectors/track, 8354 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000bd83f Device Boot Start ...


2

I looked at it once, it's quite painful, because all is defined statically in the c++ source code. You have to define a certain number of rules among the one already existing in scintilla, for things like... well it's quite mangled. You can quickly search for "scintilla lexer" on google, but you to understand that syntax highlighters are very sophisticated ...



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