New answers tagged

3

Some quick answers: first, you didn't create a sparse file. Try these extra commands dd if=/tmp/BIL of=/tmp/sparse seek=1000 ls -ls /tmp/sparse You will see the size is 512003 bytes, but only takes 8 blocks. The null bytes have to occupy a whole block, and be on a block boundary for them to be possibly sparse in the filesystem. Why does the second ...


2

When the partition is in clean state, there is no actual fsck run, which is why the date isn't updated. If you want to force it, the -f option does just that: sudo fsck -f /dev/sda1.


0

Yes, sure. Add to kernel command line: root=host rootfstype=9p rootflags=trans=virtio And you may boot without initrd.


0

Keeping in mind that you should be removing packages (rather than individual files), I would first ensure that the filesystem supports the update of access-time when a program is executed, and then check which packages have not been used since the last boot-time. Assuming normal use of your system, that's as good a first guess at unused packages as you'll ...


1

You should not delete files directly from system directories. Instead you should remove unneeded packages. In this manner, the system will remove unnecessary files and its dependences. Note: you can remove every file (but not directories) in /var/cache. Additionally old logs in /var/log/ could be removed. Check about unread system mails (/var/mail/ or ...


0

This is also an experience based response rather that one backed up by hard data. I find that when deleting many files in similar trees with a lot of cross links it seems faster to delete isolated subtrees in parallel. Let me try and explain with a diagram: topdir1 |-a1 |-b1 |-c1 topdir2 |-a2 |-b2 |-c2 topdir3 |-a3 |-b3 ...


0

In my experience, the best way to speed up rsync+hardlink based backups was to decrease the number of files you have. A large number of small files slows down rsync a lot. If you can organize your data in such a way so that your mostly small-file, mostly read-only directories get tarred up, you should see a significant speed up in your backup script. (With ...


1

The df is reporting a small number because you're mostly deleting directories, which are relatively small. Also, depending on the filesystem, changes to directories and changes to the number of links to a file are journaled and/or synced to the disk immediately, since they're critical for fault recovery, and thus slower. That's actually a testament to the ...


1

You can touch a hidden file, eg.filename, after formatting the filesystem and use the unless parameter of exec, cat .filename in your unless parameter. If the file exists, the exec won't run. Explained here. Something like this : exec { "/sbin/mkfs.ext4 /dev/sdxx && mount /dev/sdxx /mnt/sdxx && touch /mnt/sdxx/.filename": ...


0

I can't see how your use of xargs in this way is anything but slow. My manpage says -P is the number of processes and -n is the number of arguments. There's no special value for -P0, so that's likely ignored (or, if honored, you get zero processes, which would explain 24 hours of nothing!). And -n1 ensures you get one exec(2) for each filename, which is ...


2

Structures fetched from Ultrix 3.0 v7 of restor so variations can occur: ftp://ftp.uvsq.fr/pub/tuhs/PDP-11/Distributions/dec/Ultrix-3.0/v7restor/include/sys/ The s5fs is rather archaic but ...: Disk layout could be something like: [B][S][Inode List][ Data Blocks ] | | | +-- Super Block +----- Boot Area The Super Block holds data for the file ...


0

This has been answered a number of times online, these two look like a pretty good place to start: What's the proper way to prepare chroot to recover a broken Linux installation? How to restore a system after accidentally removing all kernels? If you have specific problems while going through a tutorial you can create a question for that (provided it ...


0

The command mount /dev/sda12 /acctdata will mount partition #12 of disk sda to /acctdata. Therefore, the answer is "the filesystem can be accessed on /acctdata". Could the answer be /etc/fstab since it reads the content of the /etc/fstab configuration file to see if the given file system is listed? No, /etc/fstab is used to list partitions that must ...


0

gparted uses resize2fs to change the partition's size. It doesn't take many arguments. Below are the ones I've found useful. -M shrinks to the file system's minimum size. -p shows a percentage indicator. -P prints the file system's minimum size and exits.


5

If you're using ntfs-3g to mount your NTFS filesystem, the windows_names option will prevent files with problematic names from being created: ntfs-3g -o windows_names ...


1

In most cases, you wouldn't move the files from one filesystem to another. If you're enlarging the disk in a virtual machine or grabbing more space from the same disk, you'd enlarge the partition containing the filesystem then enlarge the filesystem to fill the partition (which commands to use depends on the partition type and filesystem type). If you're ...


-1

Do not use cp to copy large amounts of data. Use rsync as well, as it can be restarted if it is interrupted. Use the following: rsync -az -H /path/to/source /path/to/destination -a : Archive mode (i.e. recurse into directories, and preserve symlinks, file permissions, file modification times, file group, file owner, device files & special files) ...


1

You can use GNU stat on Linux: stat --file-system --format=%T /tmp/subdir/whatever tmpfs


1

So I made a mountinfo parser […] You're better off using setmntent() and getmntent() that are provided in the GNU C runtime library. My approach was to convert the mount options into the appropriate mountflags and to give special options straight to data […] What you need to do is take the mnt_opts given to you by getmntent() and ...


1

Some of the parameters given to mount(8) are translated to flags specified in the mountflags parameter to mount(2): sync is MS_SYNCHRONOUS; dirsync is MS_DIRSYNC; relatime is MS_RELATIME; rw is the default, so it can't be specified; ro would be MS_RDONLY.


-1

(add a space between o and remount) sudo mount -o remount,rw /


1

This appears to be a bug in older versions of LVM. A bug that could be corrected by compiling from source with a different set of flags to add support for thin devices. I can not speak for the SystemRescueCD you mentioned, because I have never used it, but it may be using an older version of LVM, for whatever reason, which may have this very bug. Since ...


2

Ext4 wasn't designed for flash media. It can work, and it's a safe value due to the extremely wide usage it gets, but it isn't necessarily the best choice, especially on flash media that doesn't do wear leveling. UBIFS is specifically designed for raw NAND flash. It doesn't work on arbitrary block devices, it requires an underlying MTD storage device (as ...


4

You could safely use ext3 with noatime option: then only actual file writes would touch your flash device in write mode. The ext3fs journal is a good thing in case of embedded system that may get lack of power suddenly. I personally run this way a few Raspberry PI's equipped with simple SD memory cards for a couple of years (24/7, not backed up by UPS and ...


1

Modular config files as a text processing function What you're asking for is more properly text processing than file processing, and it's largely dependent on what program is consuming the text files. The traditional straightforward way to do what you want is to have a top-level file that includes other files in a modular way, such as: ~/.bash_profile: ...


4

It doesn't duplicate the information: you can have more suffixes in a given directory than the plain ".1" or ".3", e.g., (depending on the platform) letters following the numbers. For example, Debian follows the ".3" with a an application suffix such as "pm" for Perl modules. Here is (part) of the listing from /usr/share/man/man1, to illustrate: ...


2

At this point I'd say the main reason is backwards compatibility — the directory split was there right from the start, in V4 (that's the fourth release of UNIX, not SVR4). Back then there could have been any number of reasons: avoiding having to handle many files in a single directory, thinking of the manual pages as parts of a book...


3

Quote from this answer : As of Linux 4.1, fallocate(2) supports the FALLOC_FL_INSERT_RANGE flag, which allows one to insert a hole of a given length in the middle of a file without rewriting the following data. However, it is rather limited: the hole must be inserted at a filesystem block boundary, and the size of the inserted hole must be a ...


3

The "blocks" that stat() reports are 512 byte units. The normal block size used by ext4 is 4kb, or 8 of these "blocks". That means that the space used by a file on ext4 must be an integer multiple of 8 "blocks", and so the smallest size used by any file less than or equal to 4096 bytes in size is 8 512 byte blocks.


-1

The ext4 filesystem speculates the size of a file when it is created. Quoting below from this link: When a file is first created, the block allocator speculatively allocates 8KiB of disk space to the file on the assumption that the space will get written soon. When the file is closed, the unused speculative allocations are of course freed, but if the ...


0

I have encountered this several times on micro SD cards running on a variation of Raspberry pi's - the fix has been fsck /dev/sdx -a where sdx is your partition.


0

A small correction to the otherwise very detailed answer: The first number is the number of free non-zero blocks. (I.e. it does not count non-zero file blocks). As such, it is never larger than the number of free blocks. If you run zerofree (without -n) on a filesystem, then run it again (optionally with -n for dry-run) you will see that the first number ...


1

ext2 may be fine if the total size is small, otherwise fsck will take ages. But for large things you should dedicate a block device (LV) anyhow, not rely on file in filesystem containers. It's easy to lose such containers to both inner and outer filesystem corruption. If you don't actually write the files, and they can be compressed, squashfs may be another ...


1

If a program has a file open when you delete it, the kernel only marks it as deleted, but doesn't free the disc space, to avoid breaking the program (it's can't know if the file is important to the function of the program). When the program closes the file the disc space is freed. When that happens you will see the "(deleted)" when you look at ...


0

I suspect transmission saves the file to a location unknown to you when downloading. After it is finished it creates a hardlink to that same file in your download folder, but still keeps the hardlink in it's own directory(probably ~/.transmission or something like that). You can find all hardlinks to the finished download as explained in How to find all ...


1

As you can see, what you're trying to do is not possible as you're moving files that are still open by another process, so they will continue to get updated properly, avoiding space that is already used by them. The free space reported is actually right, even if you don't see the files in the directory listing anymore. As long as the file is open by a ...


1

The read-only test only reads. That's basically the default testing method for just about everything and pretty much the same what disks do for SMART self-tests. The non-destructive read-write test works by overwriting data, then reading to verify, and then writing the original data back afterwards. The only way to verify that writing data works is by ...


1

This is because the device files you find in /dev aren't actually mount points *. They're just handy filesystem-based references to access the devices themselves. You can see a similar sort of hierarchy under /sys — particularly, look in /sys/block. Why is something like /dev/sda a special type of file rather than a directory under which there are ...


1

I believe Unix V1 would be run from a single disk. It had no real VFS. You can find the system filesystem at the root of the namespace, /. No indirection required; no SYSTEMROOT = c:/windows variable. Remember this was hand-written assembly code. Minimalist ideas were very useful. The ideas here are often described in terms of their elegance. I want to run ...


0

It's a convention. Simply called Filesystem Hierarchy Standard. There is nothing more to it. http://www.pathname.com/fhs/


3

No. The mount options trump all. That's what they're for: to ensure that nothing ever gets executed directly from that filesystem. To counter noexec, you can run most programs indirectly by invoking their launcher: If the program is a script (starting with a shebang), invoke the interpreter and pass it the script as its first argument. If the program is a ...


1

Thanks for Edouard Fazenda and thrig. I have solved this problem with their help. I mounted my /home with fourth field rw,relation,user. After read some doc,I use fourth field rw,relation,exec,suid. Now everything goes fine!Thanks again.


1

That depends on the underlying storage technology. Some storage allows a certain block size to be stored atomically, typically a power of 2 which is at least 256 and usually in the 1kB—4kB range. If that's the case, then the filesystem layer can replace blocks in place, provided that the replacement of the block yields a valid system state. This is fine ...


1

If you have a ext2/3/4 filesystem you can use debugfs for a low-level look at an inode. For example, to play without being root: $ truncate -s 1M myfile $ mkfs.ext2 -F myfile $ debugfs -w myfile debugfs: stat <2> Inode: 2 Type: directory Mode: 0755 Flags: 0x0 Generation: 0 Version: 0x00000000 User: 0 Group: 0 Size: ...


-1

an inode wil store only one file. try find /xxx -xdev -inum 1234 -print where /xxx is mounting point -inum 1234 search for an inode number 1234 -print self explainatory This suppose /xxx is mounted an healthy.


3

A disk should grant that a sector is written atomically. The sector size was 512 bytes and today is typically 4096 bytes for larger disks. In order to get no problem from partially written "blocks", it is important to write everything in a special order. Note that the only reason why there could be a partially written part in the filesystem is a power ...


-2

Generally, all moderm OSes 'll have a system call for writing data to a file (in Linux we have write system call). And because all system call should be atomic. So writing the entire block size (using only 1 system call) will be atomic.


2

The code that generates this file is in the unix_seq_show() function in net/unix/af_unix.c in the kernel source. Looking at include/net/af_unix.h is also helpful, to see the data structures in use. The socket path is always the last column in the output, and the Android kernel source matches the stock kernel in this respect. So unless I'm mistaken, that ...



Top 50 recent answers are included