Tag Info

Hot answers tagged

50

Adding up numbers is easy. The problem is, there are many different numbers to add. How much disk space does a file use? The basic idea is that a file containing n bytes uses n bytes of disk space, plus a bit for some control information: the file's metadata (permissions, timestamps, etc.), and a bit of overhead for the information that the system needs to ...


22

Minimizing loss: If /usr is on separate partition a damaged /usr does not mean that you cannot recover /etc. Security: / cannot be always ro (/root may need to be rw etc.) but /usr can. It can be used to made ro as much as possible. Using different FS: I may want to use different system for /tmp (not reliable but fast for many files) and /home (have to be ...


22

This is a holdover from "ye olde tymes" when machines had trouble addressing large hard drives. The idea behind the /boot partition was to make the partition always accessible to any machine that the drive was plugged into. If the machine could get to the start of the drive (lower cylinder numbers) then it could bootstrap the system; from there the linux ...


22

It certainly is possible to share a home folder (or partition) over different linux distributions. But take the following notes: UID and GID must be the same on each distributions for the certain user(s). (as already pointed out) different configuration files for the same programs could result in unexpected behavior. If you install all distributions onto ...


22

There are misconceptions behind your questions. Swap is not mounted. Mounting isn't limited to partitions. Partitions A partition is a slice¹ of disk space that's devoted to a particular purpose. Here are some common purposes for partitions. A filesystem, i.e. files organized as a directory tree and stored in a format such as ext2, ext3, FFS, FAT, ...


20

Keep your /home on a separate partition. This way, it will not be overwritten when you switch to another distro or upgrade your current one. It's also a good idea to have your swap on its own partition. But that should be done automatically by your distro's installer. The way my laptop is setup, I have the following partitions: / /home /boot swap


20

That is not a Linux problem, but a BIOS problem, which affects only quite old systems (the first limit was about 504MiB; logical CHS addressing allowed for up to about 8GiB). The BIOS must be capable of using LBA (INT 13h Extensions, defined 1998 with virtually unlimited address space (64 bit)) for Linux to boot from behind 8GiB. There are several versions ...


18

The simplest solution is to use GPT partitioning, a 64-bit version of Linux, and XFS: GPT is necessary because the MS-DOS-style MBR partition table created by fdisk is limited to 2 TiB disks. So, you need to use parted or another GPT-aware partitioning program instead of fdisk. (gdisk, gparted, etc.) A 64-bit kernel is necessary because 32-bit kernels ...


17

Normally I would suggest a solution such as "hook up the 2nd hard drive using an external enclosure, boot from a linux CD, then use a command such as 'dd if=/dev/sda of=/dev/sdb bs=1G', but since you want to use the same technique for work, I have what may be a better solution. All of my servers and laptops get imaged at work using Clonezilla. There are ...


17

A separate /usr can be useful if you have several machines sharing the same OS. They can share a single central /usr instead of duplicating it on every system. /usr can be mounted read-only. /var and /tmp can be filled up by user programs or daemons. Therefore it can be safe to have these in separate partitions that would prevent /, the root partition, to ...


17

It's possible. In fact, you can share the swap space between completely different operating systems, as long as you initialize the swap space when you boot. It used to be relatively common to share swap space between Linux and Windows, back when it represented a significant portion of your hard disk. Two restrictions come to mind: The OSes cannot be ...


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


14

Such an utility is zerofree. From its description: Zerofree finds the unallocated, non-zeroed blocks in an ext2 or ext3 file-system and fills them with zeroes. This is useful if the device on which this file-system resides is a disk image. In this case, depending on the type of disk image, a secondary utility may be able to reduce the size of the disk ...


13

Yes, you can do this with the /sys filesystem. /sys is a fake filesystem dynamically generated by the kernel & kernel drivers. In this specific case you can go to /sys/block/sda and you will see a directory for each partition on the drive. There are 2 specific files in those folders you need, start and size. start contains the offset from the beginning ...


12

Every linux distro has its own default partition arrangement; some of them use dozens of partitions, some just a single one. 3 and 4 are quite common arrangements (/boot, /, swap and /home). Some older layouts often had /var on a separate partition and extreme systems hnd everything in /var/* and /opt/* on separate partitions! The best generalization I can ...


12

You start at the beginning, square one. I'm sorry but you wiped everything, that's a brutal command. Not only did you wipe out the linux install, but you took the windows data with it. What you did didn't just wipe stuff in the partitions (/dev/sda1, 2, etc.), it wiped the partition table too because it matched /dev/sda which is the drive device itself. ...


11

The main reason for the major enterprisey distro's like Red Hat and I think Suse to use a separate /boot is that they use LVM by default and Grub cannot be used to boot from LVM. It is that simple. So if you want to use LVM, and that is a boon, you use a separate /boot. Personally, I think it is good practice to use both LVM and separate partitions for a ...


11

Yes, you can. This is explained very nicely in the ext4-wiki at kernel.org. Basically it all boils down to tune2fs -O extents,uninit_bg,dir_index /dev/DEV e2fsck -fDC0 /dev/DEV with /dev/DEV replaced by the partition in question. Although this should be non-destructive, I'd still strongly suggest to back up your data before doing it.


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


11

In order to align partition with parted you can use --align option. Valid alignment types are: none - Use the minimum alignment allowed by the disk type. cylinder - Align partitions to cylinders. minimal - Use minimum alignment as given by the disk topology information. This and the opt value will use layout information provided by the disk to align the ...


10

The issue is that a full root fs makes the linux system unoperable to an extend that even an admin fix it without a recovery CD or similar. When /tmp and /var and in particular /home are in a separate partition, the root fs cannot never fill up without an admin doing it. Take /usr into the mix in which all the usual installs will be placed, and even ...


10

On “client” machines, the safe way to move /tmp is to reboot. Here, by client, I mean anything that runs programs that put sockets in /tmp, in particular X servers and screen. The new /tmp definitely needs to have the right permissions (1777), otherwise you can't hope to have a working system. For /tmp, you pretty much can't copy any files. That's because ...


10

Warning: doing anything to your filesystems without a known-restorable backup is ill-advised. Do not run any of the following steps if you're not sure your / is clean. If you're not sure, run the following (as root): # touch /forcefsck and reboot. This will do an fsck of all your partitions, to be on the safe side. That being said, since ...


9

In general, the arguments for having separate partitions are: Security: you can, for example, mount a partition read-only to keep malicious users (or processes) from overwriting or replacing binaries there with trojans. So if your ssh binary lives in /usr/local/bin and /usr/local is mounted read-only, it's going to be tough for anyone to replace that ...


9

Because ordinary users can cause things to be written to /var and /tmp, and thus potentially cause problems for the whole system. This way user processes can fill up /var and /tmp, but not the root fs. A separate /usr is useful for /usr over NFS, or other remote fs. (I hope this is clear, I haven't had any coffee yet)


9

Modern filesystems, particularly those designed to be efficient in multi-user and/or multi-tasking use cases, do a good fairly job of not fragmenting data until filesystems become near to full (there is no exact figure for where the "near to full" mark is as it depends on how large the filesystem is, the distribution of file sizes and what your access ...


9

Partprobe calls the BLKRRPART ioctl, which is documented in, err, include/linux/fs.h, and beyond that the kernel source (the meat is in rescan_partitions()): #define BLKRRPART _IO(0x12,95) /* re-read partition table */ The easiest way to find this out is to run strace -e raw=ioctl -e open,ioctl partprobe /dev/sdb. I think what you tried with ...


9

The correct answer, which will also work with GPT disks, was given here and here by Kris Harper. You need GPT fdisk. Look at the download page or run sudo apt-get install gdisk. Then use the sgdisk command like so sgdisk -R=/dev/sdb /dev/sda sgdisk -G /dev/sdb The first command copies the partition table of sda to sdb (be careful not to mix ...


9

Pro: you don't waste one disk sector on a partition table. (Yay.) Pro: the disk can be used in an operating system that doesn't support PC-style partitions. (Like you're going to use one.) Con: this is unusual and may confuse co-sysadmins. (See?) Irrelevant: extending the filesystem is not easier if it's directly on the disk than if it's in a partition, ...


9

So you know it is a bad idea and you can loose everything. If you still want to do it, here are the steps: Don't do it. If this doesn't help, then: Use the sfdisk tool: First, make a backup of the partition table using sfdisk -d /dev/sda > sda.out Then go for it: sfdisk /dev/sda -O sda-partition-sectors.save You will see something like this ...



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