Tag Info

Hot answers tagged

57

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


26

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


24

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

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

One reason for having a /boot partition is that it allows for things like encrypted /, where the kernel and initrd are loaded from an unencrypted partition and then used to mount the encrypted root partition containing the operating system. It shouldn't matter for general usage however.


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


21

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


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

You can use sfdisk for this task. Save: sfdisk -d /dev/sda > part_table Restore: sfdisk /dev/sda < part_table


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


19

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


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


16

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


16

That is almost certainly the extended partition that contains your logical ones. You should be able to confirm by running parted -l (or fdisk -l) as root. For example, on my system: $ sudo parted -l Model: ATA ST9500420AS (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type ...


15

With udev, there's /dev/disk/by-label that has symlinks by label to at least some partition device nodes. Not sure what the logic of inclusion is, possibly the existence of a label.


15

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


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


13

One side effect I can think of is: Hibernate system1 (using the swap partition for hibernation). Boot system2. You could lose data.


13

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


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

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


11

There is a blkid command which may be what you are looking for. Results are similar to the following: $ sudo blkid /dev/mapper/vg_rootdisk-lv_var /dev/mapper/vg_rootdisk-lv_var: LABEL="LV_VAR" UUID="08520908-03cd-4e42-a4e4-0f5a771be16c" TYPE="ext4" One other option is to use the udevadm command, which likely will give you far more than you need: $ sudo ...


11

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


11

You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that. First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line. It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan ...


11

You can use pvmove to move those extents to the beginning of the device or another device: sudo pvmove --alloc anywhere /dev/device:60000-76182 Then pvmove chooses where to move the extents to, or you can specify where to move them. See pvs -v --segments /dev/device to see what extents are currently allocated.



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