date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,682,406,551,000 |
How do I extend the size of /dev/sda5 using the unallocated space on the top? I've tried using the resize/move option directly but can't do that because the partition is mounted and it can't be unmounted since it is the only partition. I tried swap-off and then increasing the size of swap. And it didn't work either.
|
Boot in a live usb and extend the partition. While it should work fine, better have a backup. You cannot extend ext4 foward (to leading empty space) on-line.
| How to extend partition size without losing data? |
1,682,406,551,000 |
I am trying to install Ubuntu 20.04 on a NVMe disk.
The installation wizard shows below disk info:
I don't quite understand it. My questions are:
Why the /dev/mapper/vgubuntu-root and /dev/mapper/vgubuntu-swap_1 are listed twice, respectively?
The /dev/mapper parts are for LVM, which is the logical view. Why /dev/nvme0n1 also needs to be listed, which is the physical view for the same disk?
Why I can do nothing when right clicking the /dev/nvme0n1p2? But I can change/delete the dev/nvme0n1p1?
I see the size of dev/nvme0n1p2 - two free space = /dev/mapper/vgubuntu-swap_1 + /dev/mapper/vgubuntu-root. Is this some coincidence?
ADD 1 - 9:25 PM 9/18/2021
Some more info.
I did clicked the Advanced features and choose the Use LVM for once as below. But I didn't click the Install Now button because I am not so sure about the LVM. I am not sure if the /dev/mapper paths are caused by this. If it is caused by this, is there way to revert the effect?
ADD 2 - 12:11 PM 9/18/2021
I dug a bit about the Linux LVM.
As I understand now, below diagram just gives me 2 different views of my block device.
In the yellow box, it is the LVM logical volume view.
In the red box, it is the traditional PC partition view.
LVM is the Linux native way of disk partitioning, which has some advantages and complexities.
Current questions:
1 - Where are the info of these 2 different views stored?
2 - If both of them are stored on the disk, is it kind of redundant?
|
I think most of your questions can be answered with: "Displaying LVM devices is not easy and the Ubuntu installer isn't doing great job here".
tl;dr description of LVM: LVM adds a second "logical" layer of storage that allows you to do things like joining multiple disks to a one device, you can setup RAIDs, cached devices etc. You have three types of device in LVM:
Physical volumes (PVs): these are existing block devices, like partitions or disks.
Volume groups (VGs): one or more PVs form a volume group. This is the part where two disks can be joined to a one device: a new VG can consist of two PVs on sda1 and sdb1.
Logical volumes (LVs): these are block devices allocated from a VG, you can picture these as partitions but created on a VG instead of a disk.
lsblk does a better job when displaying this structure and you see the devices are actually stacked on top of each other:
└─nvme0n1p3 259:3 0 892,7G 0 part
└─luks-dfcda59b-1322-4705-bb04-e09a72b2d678 253:0 0 892,7G 0 crypt
├─fedora_aida-root 253:1 0 70G 0 lvm /
└─fedora_aida-home 253:2 0 822,7G 0 lvm /home
(This is my setup with one encrypted PV, VG called fedora and two LVs root and home.)
In your case you have one PV on the second partition of your NVMe drive: /dev/nvme0n1p2. This PV is used by your VG called vgubuntu. And you have two logical volumes: root mounted on / and swap used as swap. (And you also have second swap on your first partition /dev/nvme0n1p1, I have no idea why).
To answer your questions:
Why the /dev/mapper/vgubuntu-root and /dev/mapper/vgubuntu-swap_1 are listed twice, respectively?
No idea. It's either a bug or weird UI decision.
The /dev/mapper parts are for LVM, which is the logical view. Why /dev/nvme0n1 also needs to be listed, which is the physical view for the same disk?
This is decision of whoever did the UI design of the installer. You can hide the PVs and show only the LVs or show both. In this case showing the PVs makes it a little bit confusing IMHO. But as I said, visualization of complex storage setups is not easy.
Why I can do nothing when right clicking the /dev/nvme0n1p2? But I can change/delete the /dev/nvme0n1p1?
/dev/nvme0n1p1 is a partition that is not part of the LVM setup so the installer allows you to change it. /dev/nvme0n1p2 is a PV and it has already the full LVM setup stacked on top of it so it makes sense the installer won't allow to delete it.
I see the size of dev/nvme0n1p2 - two free space = /dev/mapper/vgubuntu-swap_1 + /dev/mapper/vgubuntu-root. Is this some coincidence?
No, that's correct and this is how LVM works -- the LVs are allocated on the PV so the sum of all LVs (plus free space plus some LVM metadata) will be equal to the VG size which will be sum of the sizes of the PVs (so in your case of /dev/nvme0n1p2).
| Question about Ubuntu 20.04 disk partition during installation |
1,682,406,551,000 |
I'm figuring how can I split partition of /dev/sda1/ into /dev/sda1 and /dev/sda2 of my Ubuntu virtual box.
Right now, every time I create a new instance of Virtual Server with vagrant, I allocated 40GB of disk space to it and all of the disk spaces is alloted to /dev/sda1
I need a way to split /dev/sda1 partition into 2 with terminal (remote ssh).
So what I've tried so far is
// Step 1
root@server-1:~# fdisk /dev/sda
// Step 2 Delete sda1
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
// Step 3 Create 2 new Partition
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):p
Partition number (1-4, default 1):
First sector (2048-83886079, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-83886079, default 83886079): 61440000
Created a new partition 1 of type 'Linux' and of size 29.3 GiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (61440001-83886079, default 61442048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (61442048-83886079, default 83886079):
Created a new partition 2 of type 'Linux' and of size 10.7 GiB.
// Step 4 and last step is write it to disk
Command (m for help): w
So this way works as I want, but if I ran a fsck on /dev/sda1 I get an invalid checksum on the filesystem and whenever I rebooted the vm, the SSH refused to connect. It didn't even respond.
Is what I do correct ? is the partition corrupted ? is there any way to fix it ?
|
You have the right idea, but you're missing the first step. You first have to shrink the filesystem on partition sda1, before shrinking the partition itself. Shrinking filesystems is not always supported, and is inherently dangerous (just as this whole operation is). My suggestion is to shrink the filesystem to a bit less than you want to shrink the partition to, then re-grow the filesystem after you've shrunk the partition.
| How to split partition /dev/sda on Ubuntu |
1,682,406,551,000 |
I have a rooted Android tablet running Termux terminal. The device has 32gb built-in storage. 6gb is partitioned for "Internal Storage" and is used for apps/games/documents and such. 23gb is partitioned for external storage and is labeled "sdcard".
I would like to use gdisk to expand the "Internal Storage" partition and "Shrink" the sd card partition significantly.
I believe I have the understanding to complete the task. However, I'm unsure whether I'll have to re-create all the mounts and symlinks after the partition resize. I have to delete the two partitions, then recreate them with the same GUID but different sizes.
My question is, after reboot and the new partition table taking effect, will I have to remount all of the file systems? And will I have to re-do all of the symlinks?
I'm fairly new to linux, thanks for any help.
EDIT:
On the partition I plan on shrinking (sdcard), I plan on using resize2fs to shrink the filesystem to about 500mb. Then, I plan on using gdisk to delete the partition and recreate it with the same GUID to fit exactly with the 500mb.
I plan on doing the same thing in reverse for the partition I want to grow.
My understanding is I can do this without losing any data (as long as the data fits in the resized partition/file system). Which is why I was hoping I wouldn't lose my mounts or symlinks.
The problem is, I have to unmount the partitions I want to modify/delete/recreate with gdisk. That being said, will the mounts be recreated on reboot since the GUID is the same?
|
Expanding the internal partition is easy, expanding the filesystem on that partition will not cause data loss. You will have to delete the "sdcard" partition to do so (which you will then re-create), so any data on the current "sdcard" partition will be irrevocably lost, and you will have to take a backup of it and restore it if you want it to be present after the changes.
To expand:
Think of your disk as follows:
|------------|-----------------------------------------------|
| internal | sdcard |
|------------|-----------------------------------------------|
^^ ^^
The up arrows show where the filesystem layout information is kept (I'm vastly oversimplifying, but not to the point of error). When you expand "internal", it creeps out and takes up the area on the disk where the "sdcard" up arrows point to. Once you overwrite those areas by expanding the internal filesystem, the entire sdcard filesystem is lost (absent a significant investment in time and/or money which is usually only undertaken when truly critical, the-company-will-go-out-of-business-if-we-don't-get-it-back, data is lost - think tens of thousands of dollars to start).
You cannot have a partition scheme like this:
|------------|-----------------------|-------------------|
| internal | sdcard | more internal |
|------------|-----------------------|-------------------|
The only way to expand the internal storage is do so this:
|-------------------------|------------------------------|
| expanded internal | sdcard |
|-------------------------|------------------------------|
This isn't specific to Android or Linux, this is simply how disk partitioning works across all operating systems.
| Will I lose all mounts and symbolic links if I resize partitions with gdisk in Linux/Android? |
1,682,406,551,000 |
I am on an older netbook that cannot handle Windows 10 (nor Windows 11) anymore since the 64 GB fixed flash memory cannot handle the data.
It is a Medion Akoya netbook, model number: MD 61900, model: E2228T. Obviously, this question is not bound to just this special choice of hardware.
There are 50 similar questions on Stack Exchange, but just because of that, I could not find a clear help of how to over-install Linux on a Windows installation using UEFI and a Linux bootable.
Thus: how to really just do it?
|
Save any data that might be on the existing devices of the hard drive. If you want, save the license code of the installed Windows and other software, there are tools that can read it out.
Restart and press F2 at startup. Switch Secure Boot of the Security tab to Disabled:
Connect with a Linux bootable for GPT. I used the Linux Mint 20.2 image (which is just one out of a wide range of distributions, choose yourself) and put it on a micro SD card using the free software "rufus", a small executable, no need to install it. In some cases, it might be needed to use USB instead of a flash card. At least in my case, the card slot was somehow not active, but the same card could be used as a bootable using a USB adapter.
Save and restart
and press F9 at startup (or start with the NOVO button if you have it, it is a small button usually next to the power button) to enter the UEFI menu where you choose the Linux bootable.
In my case, it opened the Linux menu directly without the mentioned UEFI menu in between:
Start "Install Linux Mint".
When asked, choose to unmount the partitions in use (if you want to overwrite Windows).
When asked, click in the middle of the three checkboxes to clean the disk and install Linux. You may also choose "Advanced features" and encrypt your whole disk with LVM. The disk will then need to be unencrypted by a password at every startup. I recommend this for a laptop which can always get stolen or lost.
When asked, choose Continue to really format all of the listed devices - since you want to clean the disk from the existing Windows installation.
| How to install Linux from a UEFI bootable, overwriting an existing Windows installation |
1,682,406,551,000 |
According to redhat documentation on - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_file_systems/managing-layered-local-storage-with-stratis_managing-file-systems
Example 23.1. Viewing the UUID of Stratis file system
lsblk --output=UUID /stratis/my-pool/fs1
When I created a stratis filesystem there is no directory called /stratis. When I execute stratis filesystem list the device is under /dev/stratis/pool1/stratis-filesystem1.
I checked couple of textbooks on RHCSA and the examples they show the path under /stratis/pool/fileystem
Even when trying to mount, the device used to mount is /stratis/mypool/filesystem whereas I have to use /dev/startis/mypool/filesystem I am not sure where the discrepancy is coming from. I am using RHEL 8.4
|
The documentation is outdated (at least partially), the directory used for stratis devices was changed from /stratis to /dev/stratis in 2.2.0 (release notes). 8.4 has stratis 2.3.0 so just use /dev/stratis.
| Is stratis service suppose to create /stratis for device files? |
1,682,406,551,000 |
I created a partition with parted and then removed it using parted /dev/<partition> rm partition number. After that I executed partprobe,udevadm settle and systmelctl daemon-reload. Then I used lsblk and the partition was not showing. Then when I tried to create another partition with same size using parted I was able to but when I tried to use mkfs.xfs on that partition, it said the data already exists. It said use the -f option overwrite the data with new file system.
My question is that can you remove the partition and filesystem at the same time using parted? If not, then using fdisk or gdisk is better?
Also, what's the difference between partprobe,udevadm settle and systmelctl daemon-reload? Do you use it after creating a partition with parted or after writing a file system on it or both?
|
parted doesn't have an option for removing the filesystem, you can use wipefs before running the command. fdisk will ask you to remove existing filesystems when creating a partition and you can also use --wipe-partitions always to make this automatic.
partprobe tells kernel to re-read the partition table on the device. You don't need to run this manually, both parted and fdisk do this after making partition table changes (they use the BLKRRPART/BLKPG ioctls to do that).
udevadm settle just waits until UDev finishes with current queue of events. Again, no need to run this manually, you are not using any tool that relies on UDev (like UDisks) and again, it's up to the tools/users of UDev to deal with this.
systmelctl daemon-reload is used to reload systemd manager configuration. This has nothing to do with partitioning.
| Can you delete a partition and the filesystem on it with parted? |
1,682,406,551,000 |
An extract from a book-
Linux organizes attached storage as block devices, you can move to
the /sys/block/ directory and list its contents. Among the contents
will be a directory called sda/. (Remember that sda stands for
Storage Drive A.) That’s the first drive used by your system on boot:
Change to the sda/ directory and run ls. Among its contents,
you’ll probably see files with names like sda1, sda2, and sda5.
Each of these represents one of the partitions created by Linux to
better organize the data on your drive.
On my Ubuntu machine, the below partitions are shown for sda-
Running df -h | grep sda gives
As seen, /dev/sda5 is mounted on '/' and /dev/sda1 on /boot/efi.
Why is there no mounting point for partition sda2?
|
sda2 is an extended partition, which is a partition used with the MBR partitioning scheme to store other partitions. It contains sda5. It serves no purpose other than to store other partitions and is therefore not a candidate for mounting.
See What mount points exist on a typical Linux system? for details.
| Partitions and the mounting points |
1,682,406,551,000 |
I put /var/lib/dpkg/info on a new partition and put everything else in "/var" on another partition (suggestion 2 in #21941). Every partition was mounted with the defaults flag and nothing else (no noexec etc) during the installation.
Somehow, the installer for Debian buster failed to install new packages to the hard drive.
If I don't make a new partition for /var/lib/dpkg/info, the installer works fine.
What went wrong?
|
While it's difficult to say what went wrong in this particular case without suitable logs or debug output, in general, most programs don't gracefully handle arbitrary directories being mountpoints.
There are various top-level directories (e.g., /usr, /var, /home) that can successfully be mountpoints, and there are other directories maintained by one particular program that can often be mountpoints (e.g., /var/lib/mysql), but most programs don't test for arbitrary directories they use becoming mountpoints, so you'll often find that this results in breakage. If you very much want this to work, you can ask the dpkg maintainers to fix it, and it may be fixed in the release after bullseye (since bullseye is mostly frozen now). But otherwise, the general recommendation is to avoid doing this and live with the fact that /var is not mounted noexec.
| Can't put "/var/lib/dpkg/info" on a new partition with the debian installer |
1,682,406,551,000 |
I have a wokring image file for an ARM embedded Linux system.
The rootfs partition is way too big and I want to shrink it.
Initial scenario:
Disk /dev/loop0: 7,22 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 206847 204800 100M c W95 FAT32 (LBA)
/dev/loop0p2 206848 12789759 12582912 1G 83 Linux
/dev/loop0p3 12789760 12810239 20480 10M a2 unknown
The second partition (rootfs) is the one to be reduced.
I opened /dev/loop0 with gparted and reduced it to 1G.
Then I tried to move the third partition (I don't know that it is nor what contains) just after the previous - otherwise it makes non sense at all!
But gparted told me that moving this partition might prevent the os to boot.
As far as I know, only the "boot" partitions (i.e. the first ones) are critical for boot itself.
Why moving the third one might prevent the boot?
|
This is probably because the partition type is a2.
A2 Hard Processor System (HPS) ARM preloader
This partition type is used for bootable images of ARM-type computers.
For a normal Linux system that uses an x86, you should be able to delete this partition.
----edit----
Because this is ARM, it is the preloader image. It is a number of 64K blocks used as first stage boot loader. Whether or not you can move it, depends a bit on your board. Some boards use the partition table to find a type 42 image partition.
The preloader is used as an intermediate step between the bootrom and the boot loader, so it runs before Linux is booted.
| Moving the third partition might prevent the boot of os |
1,615,227,484,000 |
I am farely new to Linux in general, but I can use the command line to do some basic stuff.
Currently I am using Manjaro KDE.
Yesterday I followed allong with the Book Linux from Scratch to learn more about Linux.
The last thing I did was that I made my main partition smaller by 25 gb and created a new one (using cfdisk).
Everything was fine, expect when I logged into Manjaro today, I got the errors:
mount: /new_root: wrong fs type, bad superblock on /dev/nvme0n1p4, missing codepage or helper program, or other error.
and
sh: can't access tty: job control turned off
and was thrown into an emergency shell. As I said, i can use the command line to create,
copy and edit files, but this looks way too advanced for me.
EDIT
The last thing I did before everything broke was:
1st I shrinked my main partition by 25.6 gb using cfdisk.
2nd I created a new partition (20 gb) using cfdisk.
3rd I mounted the new partition.
4th I created a new ext4 filesystem on the new partition.
Then I shut down my pc and when I startet it today, it brought me straight into an emergency shell
I have already tried:
mount /dev/nvme0n1p4 / (in the recovery shell, same Error).
mount /dev/nvme0n1p4 /media/nvme (from a live usb stick, same Error).
Does anyone have an idea why this error ocured and how I can rescue my data?
|
If you did not use resize2fs to shrink the filesystem before using cfdisk to shrink the partition it's located in, you have caused the tail end of the filesystem to be cut off. The system is now detecting that the filesystem claims to be larger than the partition it's located in, which is an error.
While an ext2/3/4 filesystem can be enlarged while it's being used, shrinking still requires unmounting it first. And it looks like /dev/nvme0n1p4 is your root filesystem, which cannot be easily unmounted from / and requires special steps for mounting to / (mount it to somewhere else, minimize the number of processes running, and use pivot_root to switch to the new root filesystem), so the chances are high you did not use the proper procedure for resizing your root filesystem.
The easiest way to resize a root filesystem would have been to boot from external live media, and using that to resize the root filesystem of your installed OS while it's completely unmounted. The other alternative would be to ensure the filesystem resizing tool is present in initramfs, and then use the boot options to interrupt the boot within the initramfs boot phase, while the root filesystem is not yet mounted, and do the filesystem shrinking within the resulting emergency shell.
The problem now is that resizing the filesystem requires it to be free of errors first. Having a part of the filesystem violently cut off is definitely an error.
You would need to boot the system from live media, then use it to mount & backup the contents of the new partition you created (if there is any), then delete that partition and restore the /dev/nvme0n1p4 partition back to its original size. Then you should be able to run e2fsck -C0 /dev/nvme0n1p4 on it to check for errors (and hopefully fix any that might have been caused by the partial overwriting of the tail end of the filesystem).
Then, still in the live media environment, mount the root filesystem to a temporary location with
mkdir /media/nvme
mount /dev/nvme0n1p4 /media/nvme
and use it to edit the /etc/fstab of the installed OS (now at /media/nvme/etc/fstab) to temporarily comment out any reference to the new partition you created.
Then you can exit the live media and verify your installed OS again boots normally.
Then boot with the live media again to resize the root filesystem properly:
1.) First use resize2fs /dev/nvme0n1p4 <new-size> to resize the filesystem inside the partition. If you know the exact number of sectors the partition will have after resizing, you can use that as the <new-size> value. Otherwise, you should shrink the filesystem to slightly smaller size than you intend to shrink the partition to, to guard against rounding (and base-2 vs. base-10) errors in unit conversions.
2.) Then shrink the partition containing the filesystem. You can also create the new partition using the free space as part of this step.
3.) Exit the live media and boot into the installed OS to confirm it still works normally. If you resized the filesystem to a size smaller than the new partition size, you can now use resize2fs /dev/nvme0n1p4 to auto-detect the current partition size and expand the filesystem to exactly match it. (Yes, you can do this while the filesystem is mounted.)
4.) Now you can proceed with creating the filesystem on your new partition, uncommenting/adding the /etc/fstab line for it, and mounting the new filesystem.
| mount: /new_root: wrong fs type, bad superblock on /dev/nvme0n1p4, missing codepage or helper program, or other error |
1,615,227,484,000 |
I've successfully installed u-boot and linux kernel on STM32F469-disco board but I still don't have a rootfs. my board has 16MB RAM and 16MB FLASH storage and 32GB SDCARD and the CPU core of it is ARM Cortex-M4 32bit processor. I want to know can I just copy my busybox rootfs to a fat32 partition and expect the linux kernel to read it?
when I try to copy it to an NTFS partition it throws this error:
PS C:\Users\mahya> copy -r z:\home\mahyar1284\my_projects\buildroot\buildroot-2020.08\output\target\ c:\users\mahya\desktop\target
Copy-Item: The name of the file cannot be resolved by the system. : 'Z:\home\mahyar1284\my_projects\buildroot\buildroot-2020.08\output\target\linuxrc'
UPDATE
tried it with tar command:
C:\Users\mahya>tar -cf -r z:\home\mahyar1284\my_projects\buildroot\buildroot-2020.08\output\target\*
tar: Couldn't open z:/home/mahyar1284/my_projects/buildroot/buildroot-2020.08/output/target/linuxrc: Invalid argument
tar: Error exit delayed from previous errors.
|
At the moment you can't use NTFS or FAT32/exFAT to host the root filesystem:
FAT32/ExFAT do not support permissions or symbolic/hard links
NTFS* works via the userspace fuse daemon, so an entire filesystem will belong to a single user which is again incompatible with most Linux distros
I'm now running Fedora 33, and I have a number of files not owned by root:
/usr/share/polkit-1/rules.d
/etc/polkit-1/rules.d
/var/log/ntpstats
/var/log/chrony
/var/lib/geoclue
/var/lib/chrony
/var/lib/chrony/drift
/var/lib/avahi-autoipd
/var/lib/avahi-autoipd/*
/var/lib/tpm2-tss/system/keystore
/var/lib/openvpn
/var/lib/ntp
/var/lib/unbound
/var/spool/mail/*
*Update: Starting with Linux 5.15, NTFS now has a proper kernel driver (module) which allows to use NTFS as a root FS.
| is it possible to have a fat32 rootfs partition instead of ext4? |
1,615,227,484,000 |
Is it possible to write an image larger than the partition using dd? Supposing I had:
blah.img: 8GB
/dev/sda1: 3GB
/dev/sda2: 4GB
/dev/sda3: 4GB
...
Are consecutive partitions guaranteed to be laid out adjacently and without padding, such that I could expect this to precisely overwrite both /dev/sda2 and /dev/sda3?
dd if=./blah.img of=/dev/sda2
And would that be the same as if I copied from the disks and concatenated?
dd "if=/dev/sda{2,3}" of=./blah.img
|
Partition block devices (/dev/sda2 etc.) won’t allow you to write beyond their limits, so you can’t write past the end of /dev/sda2 through /dev/sda2.
You could overwrite multiple partitions by writing to the appropriate offset of the containing device (/dev/sda); however partitions are not guaranteed to be laid out on disk in their numeric order, without padding. /dev/sda3 could point to disk blocks before /dev/sda2.
Reading /dev/sda2 and /dev/sda3 successively will only give you the data contained inside each partition, it’s not equivalent to reading from the start of /dev/sda2 to the end of /dev/sda3 (assuming /dev/sda3 is laid out after /dev/sda2 on disk).
| Writing single image to consecutive partitions using dd |
1,615,227,484,000 |
As described here, not all partitions of Flatcar Linux's root filesystem support RAID 1
Other system partitions, such as USR-A, USR-B, OEM, and EFI-SYSTEM,
cannot be placed on a software RAID array
What are the implications of this? Suppose the root filesystem is configured with RAID 1, can either drive fail? Or if the drive containing the single copy of the above partitions fails, would the OS fail to function?
|
The problem with partitions like EFI or /boot and RAID is that UEFI and GRUB don't understand RAID metadata -- they need the partition superblock to be certain type (FAT in case of EFI) and if there are RAID metadata it will simply think the partition isn't EFI and won't use it.
This is usually solved by using MD RAID metadata version 0.90 -- in this version metadata are stored at the end of the block device so for all other purposes the partition still looks like EFI one and you just have two copies. I'm not familiar with Flatcar Linux, but from the linked documentation it doesn't look like it offers such option. But you might be able to configure this storage setup manually.
Suppose the root filesystem is configured with RAID 1, can either drive fail? Or if the drive containing the single copy of the above partitions fails, would the OS fail to function?
Yes, if you have only one copy of the EFI partition and the drive fails, the system will fail to boot. You won't loose data, but you'll need to either reinstall the system or restore the EFI partition from a backup.
| What are the implications of Flatcar Linux's root filesystem RAID limitations? |
1,615,227,484,000 |
I am maintaining a Linux-Server (Ubuntu 18.04 still) that, among other things, runs a virtual Windows 10 machine on it. The Windows machine uses a logical volume as its hard drive.
My goal is to backup certain files on the windows machine by mounting a snapshot of its LV in the host systems directory tree and then using rsync to backup the files (as I am doing for files on the Linux host system).
Here is what I was doing:
# create snapshot
lvcreate --snapshot --size 20G --name windows-backup /dev/vg0/vmachine
# mount snapshot
mkdir /mnt/windows-backup
mount --read-only /dev/vg0/windows-backup /mnt/windows-backup
However, the mounting failed with the following error message:
mount: /mnt/windows-backup: wrong fs type, bad option, bad superblock on /dev/mapper/vg0-windows--backup, missing codepage or helper program, or other error.
I suspected that's because the LV consists of multiple partitions and following the output of fdisk -l /dev/vg0/windows-backup
Disk /dev/vg0/windows-backup: 250 GiB, 268435456000 bytes, 524288000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x6be134ed
Device Boot Start End Sectors Size Id Type
/dev/vg0/windows-backup1 * 2048 1126399 1124352 549M 7 HPFS/NTFS/exFAT
/dev/vg0/windows-backup2 1126400 523192612 522066213 249G 7 HPFS/NTFS/exFAT
/dev/vg0/windows-backup3 523194368 524283903 1089536 532M 27 Hidden NTFS WinRE
I then tried
mount --read-only --types ntfs -o offset=$((512*1126400)) /dev/vg0/windows-backup /mnt/windows-backup
which yielded the desired result.
My question: Can I somehow get rid of the step of having to manually lookup the partition offset prior to the mount, i.e. hard-coding the value in the backup script in my case. After all, this offset could theoretically (whereas unlikely) change?! Is there some way of dynamically determining the offset of the biggest NTFS partition?
Another thing that leaves me a bit puzzled is the fact that the first mount command (no offset, no specifying of the filesystem type) used to work some time ago without me changing the partition layout of the LV in the meantime. Why is that?
|
You shouldn't try to mount the device itself, but the partition(s) on it. The problem here is that system doesn't try to detect partitions on LVs by default (because it usually doesn't make sense to create partitions on top of LVs) so you first need to tell kernel to read the partition table using partprobe /dev/vg0/windows-backup and then mount /dev/vg0/windows-backup2.
It also might be a better idea to use some virtualization tools, like libguestfs to access the data, instead of accessing the LV directly, I'm not really sure it's safe to access the data directly (but I'm not virtualization expert and you have a snapshot so it might be ok).
| Partition offset when mounting logical volume |
1,615,227,484,000 |
df -i report 96% left, df report 0% left (but 609M available), gparted report 18.55G left
All for the same partition
Is there any space left?
df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sdx0 23419200 705376 22713824 4% /home
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdx0 370150344 350620020 705948 100% /home
|
For an ext4 filesystem it looks good to me.
Disk space available: 353 GiB
Disk space used: 334.3 GiB
Actual remaining disk space: 18.7 GiB
The extN filesystems reserve 5% for root access, so that when users fill up the filesystem there's still a little left for the system, and for housekeeping and filesystem maintenance.
5% of available disk space: 353 * 5% = 17.7 GiB
Total effectively available disk space: 353 * 95% = 335.4 GiB
Effectively remaining disk space: 335.4 - 334.3 = 1.1 GiB, i.e. it's near enough full
The remaining difference between my 17.7 GiB and parted's 18.63 GiB is just under 1 GiB, which could conceivably be explained as filesystem overhead for the metadata (directory structures, etc.)
I would assume that the "603.5 MB free" message may creep upwards towards my theoretical 1.1 GiB a little once you've emptied the "trash" folder, but basically as far as (non-root) users are concerned the disk is full as evidenced by the 100% shown in your output from df:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdx0 370150344 350620020 705948 100% /home
Given that this isn't the root filesystem, you might want to consider reducing the 5% reservation down to, say, 2%. Here's how I might do it for a filesystem here:
tune2fs -l /dev/sda1 | grep -i 'block count'
Block count: 1572608
Reserved block count: 78630
awk 'BEGIN { print int( (78630 * 100) / 1572608 +.5 ) }' # Current %
5
tune2fs -m 2 /dev/sda1 # Change reservation %
tune2fs 1.43.4 (31-Jan-2017)
Setting reserved blocks percentage to 2% (31452 blocks)
Confirm that we have what we expect
tune2fs -l /dev/sda1 | grep -i 'block count'
Block count: 1572608
Reserved block count: 78630
awk 'BEGIN { print int( (31452 * 100) / 1572608 +.5 ) }' # New %
2
| df gparted space left [closed] |
1,615,227,484,000 |
I have one 100GB partition that is part of ZFS storage pool. How can I notify ZFS about new partition size after resizing the partition to 200GB?
|
Change size of your partition using your favourite partitioning tool.
cfdisk and cgdisk have simple interface that allows creation, resizing and deletion of partitions.
Make sure the new partition size was acknowledged by Linux. lsblk will show you table of disks and their partitions.
If not, run partprobe to refresh all partition lists. GPT-partitioned disks (maybe only on older kernels) usually need this.
Use zpool online -e (-e stands for expand):
zpool online -e poolName /dev/sdxX
You do not have to execute zpool offline before that.
(Optional) Adjust quotas if you want to. If you don't have set quota, underlying volumes will automatically get the new size.
| How can I change size of partition that is part of zpool |
1,615,227,484,000 |
After a failed resizing operation, mount operation is failing with:
Failed to read last sector (718198764): Invalid argument
The partition is not accessible with Gparted and other GUI tools. How can we fix such issue?
|
Analyse
ntfsfix -n /dev/sda5 the n parameter will make the tool output the repair solution without applying it (be very prudent using such tool as automated repair tools can choose the wrong decision to repair the partition)
ntfsresize -if /dev/sda5 this will tell us what's going on exactly...
Backup
First thing first before doing anything a full image backup is recommended... otherwise just backup the partition table with
sfdisk -d /dev/sda > sda.partition.table.txt
Explanation
In this particular case Failed to read last sector (345345...) this mean that the partition is bigger than what's indicated on the partition table, this can happen when the partition is resized (shrinked) without shrinking the file-system (ntfs here)... the solution is to revert the resize (on the partition table)...
Note that ntfsfix may guess the good old value and restore it BUT the tool can also guess a wrong value and make you loose part/all of your datas... if the partition can be mounted after the repair that does not mean you did not lost any datas especially when chkdsk is correcting a lot of errors...
Solution
Backup the current partition table with sfdisk -d /dev/sda > sda.partition.table.txt
Failed to read last sector (345345...) indicate that the real partition end sector is [start.sector]+[345345...] thus, we need to calculate the real end sector location by adding the start sector of the partition and the last sector shown on the error
Edit sda.partition.table.txt and replace the end sector with the new calculated one... (for the sda5)
Restore the partition table with sfdisk /dev/sda < sda.partition.table.txt
| Partition mounting/resizing failed to read last sector? |
1,615,227,484,000 |
I don't know what my colleague exactly did but I know that he was trying to increase the size of LVM. For now I can see such an output after executing the command lsblk:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 39G 0 part
│ ├─rhel-root 253:0 0 95G 0 lvm /
│ └─rhel-swap 253:1 0 4G 0 lvm [SWAP]
└─sda3 8:3 0 60G 0 part
└─rhel-root 253:0 0 95G 0 lvm /
As you see, there are two same names rhel-root under sda2 and sda3, and both of them are mounted on thr root directory /.
However, the output of df -h is:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.6M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 35G 28G 7.3G 80% /
/dev/sda1 1014M 285M 730M 29% /boot
tmpfs 783M 8.0K 783M 1% /run/user/42
tmpfs 783M 0 783M 0% /run/user/1001
It seems that the size of / is still 35G, meaning that it is not expanded.
It seems that I need to merge sda3 and sda2 but I don't know how to fix this issue.
Output of lvs:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- 94.99g
swap rhel -wi-ao---- 4.00g
Output of vgs:
VG #PV #LV #SN Attr VSize VFree
rhel 2 2 0 wz--n- 98.99g 0
Output of pvs:
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <39.00g 0
/dev/sda3 rhel lvm2 a-- <60.00g 0
Output of vgdisplay:
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 98.99 GiB
PE Size 4.00 MiB
Total PE 25342
Alloc PE / Size 25342 / 98.99 GiB
Free PE / Size 0 / 0
VG UUID tPY1JO-AwK2-ULra-Matz-5VVy-lxWK-CL60ng
|
Your colleague has successfully extended the rhel-root LV with lvextend, so one part of it is now on sda2 and another on sda3. But the filesystem inside the LV has not been extended yet.
There is just one rhel-root LV, but lsblk shows it here in a way that can be a bit confusing: it shows the total size of the LV apparently in association with each individual part.
The sda2 and sda3 PVs are already merged into the rhel VG, so LVs within that VG can grow beyond the limits of a single PV. Apparently your colleague wanted to avoid the risks associated with editing the partition containing the root filesystem on-the-fly, and just created a new partition using the new space, and added it as a new PV to the existing VG. In my opinion, this is the safest way to extend a VG on a bootable disk: although it leaves you with multiple partitions-as-PVs which may offend your sense of neatness, it really has no other significant effect.
At this point, if you really want, you can still remove sda3 and extend sda2 instead. The procedure is as follows:
First, very carefully use lvreduce to shrink the root LV back to what it used to be. You can use the LVM backup files at /etc/lvm/archive to find out the exact size, or you could use lvdisplay -m /dev/mapper/rhel-root to see how many extents are located on the sda2 PV, and use that value. If you choose to do this, you must be very careful not to shrink the LV any smaller than the current size of the filesystem inside it: you don't want to cut off the tail end of the filesystem, not even a tiny bit.
Then remove the now-empty sda3 PV from the rhel VG with vgreduce rhel /dev/sda3, then edit the partition table to delete sda3 and extend sda2, use partprobe /dev/sda to make the system accept the new partition table while the disk is in use (or reboot if partprobe is not available or fails to do the job), then pvresize /dev/sda2 to extend the rhel VG by extending the sda2 PV to take up the new space. Use lvextend -l +100%FREE /dev/mapper/rhel-root to re-extend the root LV.
Now you are at the same point your colleague got to, but without the aesthetically-displeasing sda3.
The last step your colleague missed is actually extending the filesystem to take advantage of the increased capacity of the LV. By the presence of /run in df -h output, and the VG name rhel, I assume this system is RHEL 7 or newer. So the default filesystem type is XFS, which means the command to extend the filesystem will be:
fsadm resize /dev/mapper/rhel-root
or
xfs_growfs /
Note: think carefully before doing this, as there is currently no production-quality tool to shrink a XFS filesystem, neither on-line or offline. So once you extend the filesystem, you won't be able to shrink it back to a smaller size.
This command will be the same, no matter whether you chose to remove sda3 and extend sda2 instead, or keep your colleague's work as-is.
| How to merge lvm |
1,615,227,484,000 |
I have a dual booted machine (Linux Mint 19.3 Cinnamon and Windows 10) and am looking to allocate space from Windows to Linux. I have already removed space from my C:\ and D:\ Drive without any issues, but I am having trouble extending my Linux Partitions. My Allocated space is BELOW the unallocated space. Here is a screenshot(It is as accurate as I could make it):
I would like to add the Unallocated Space above the "Linux Root" partition to the partition named "Linux Home." I would also like to add the unallocated space at the very bottom to "Linux Root."
|
First, backup your data.
Boot Linux from a Live USB (GParted or your Linux Mint 19.3 Cinnamon Live USB) and start GParted.
Instead of assigning the unallocated space at the bottom to "Linux Root", it's easier to use a part (~14GB?) of the unallocated space at the top.
Resize/move /dev/sda5 "Linux Root", grow the partition to the wanted size, i.e. if you enlarge the partition by 14 GiB, move the partition to the left side so you'll end up with about 50 GiB after "Linux Root":
...
/dev/sda3 Basic data partition
/dev/sda5 Linux Root 27.94 + 14 GiB
unallocated ~50 GiB
/dev/sda6 Linux Swap
/dev/sda7 Linux Home
/dev/sda4 Basic data partition
unallocated 14.65 GiB
Move /dev/sda6 "Linux Swap" to the left:
...
/dev/sda3 Basic data partition
/dev/sda5 Linux Root 27.94 + 14 GiB
/dev/sda6 Linux Swap
unallocated ~50 GiB
/dev/sda7 Linux Home
/dev/sda4 Basic data partition
unallocated 14.65 GiB
Move /dev/sda4 "Basic data partition" to the right:
...
/dev/sda3 Basic data partition
/dev/sda5 Linux Root 27.94 + 14 GiB
/dev/sda6 Linux Swap
unallocated ~50 GiB
/dev/sda7 Linux Home
unallocated 14.65 GiB
/dev/sda4 Basic data partition
Resize /dev/sda7 "Linux Home" to take up the unallocated space before and after the partition.
| Merge Allocated Space with Unallocated space in Gparted |
1,615,227,484,000 |
I have recently bought a 2TB HDD drive, to install in my PC. After installation, I plan to have 3 partitions:
OS: Partition on SSD drive (240GB) that will contain the Operating System files, binaries + some important applications;
Software: Partition on HDD, containing applications and games;
Files: Partition on HDD, with all the files (photos, text files, videos, etc).
I am not sure what to do with my home folder. Is it a good idea to split it to Software and Files?
Also how much memory should I allocate to the Software partition and how much to Files one (again, they are on HDD drive with 2TB of disk space)?
I use Linux Mint 19.3 Cinnamon
|
The problem with your planned partitioning scheme is that it does not conform to the Linux Filesystem Hierarchy Standard. I don't know to what extent Linux Mint complies with the standard, but it's quite likely that it aims to be mostly compliant.
What this means in your particular case, is that applications are installed by the Mint package manager into predefined locations; Ex. Some files will be stored in /usr/bin while others in /etc, while others in /usr/share... and so on. This means it's not possible to install some programs in one partition and other programs in another. Notable exceptions are third-party programs installed with scripts (usually installed in /opt) and AppImage applications.
I think a suitable partitioning scheme for you is as follows:
SSD
/boot (or /boot/efi) - The Linux Mint boot partition.
/ - Your root filesystem
HDD
/home - The partition for all user files. This should work for Steam games as well.
| Linux Mint: Splitting disks to 3 partitions |
1,615,227,484,000 |
I am writing a script (for learning purpose) which will help me to automate Arch Linux installation. In this script, I am stuck at partitioning. Although, I know that how to partition using fdisk, cfdisk, gparted, but all these tools require manual intervention. However, I want to create partition automatically. In this respect, I have to embed following steps in my script:
Create GPT partition table on /dev/sda
Create primary boot partition - efi (FAT32) - 500MB - /dev/sda1
Create primary root partition - ext4 - 17GB - /dev/sda2
Create primary swap partition - swap - 2GB - /dev/sda3
I know that filesystem can later be implemented via mkfs command. However, in case of EFI and SWAP partition, it is necessary to tell system (at the time of partitioning) that this is not regular "Linux" partition. Can you guide me that how can I achieve these steps automatically in my script?
|
You can use this structure. This is a script I use to create a 25MB partition in FAT format.
First run the command fdisk interatively, and annotate every response. Put that response in the rigth order using echo. An empty echo means the default option.
(
echo o;
echo n;
echo ;
echo ;
echo ;
echo +25M;
echo a;
echo n;
echo ;
echo ;
echo ;
echo ;
echo w;
) | fdisk /dev/sdb
mkfs.vfat -n 'BOOT' /dev/sdb1
| Auto partition via script |
1,615,227,484,000 |
I'm baffled by this one. I'm trying to install Pop!_OS 19.10 and I have a significant discrepancy.
You can see in these two pictures (sorry for the poor quality, need to click on them to make them larger to see what I'm talking about), one with preexisting partitions and one with the drive clean, that there is a ~80% discrepancy in size between the front and back windows during install.
The problem is I have a 850MB EFI, well above the minimum 500MB, and it says it is too small because it shows as like 111.4MB and then can't install the OS.
When the drive is clean, it shows its total size as 512.1GB, when it is actually 3.73TB (shown on the front window).
Formatting partitions as ext4.
Drive is tested and works fine in Windows 10, macOS 10.14.5, Ubuntu 19.10. Just only happens with Pop!_OS.
Any suggestions as to what is causing this?
|
I think your NVMe SSD might be using 4096 byte block size instead of the classic 512 byte size, and the main installer (the back window) cannot take that into account, but the GParted partitioning tool (the front window) can.
The difference is not exactly 8x because the installer reports the disk size in SI-style unit prefixes (1 GB = 1000^3 bytes) while GParted uses powers-of-two based prefixes (1 GiB = 1024^3 bytes).
You might want to file a bug report on the Pop!_OS installer.
| ~80% discrepancy in disk space/size installing Pop!_OS |
1,615,227,484,000 |
I'm transfering the content from one smaller partition to another larger using rsync -vacHS --progress /oldPartMountPoint/ /newPartMountPoint/. The data is large ~1TB, I left it overnight but at the morning I found it with almost no progress. Also, the two partitions are just ISCSI devices shared from a NAS. The NAS doesn't show any disk ot network activity coming from the VM I am using to transfer the files. I know the name of the last transfered directory. Can I renew the process in some way that I only have to transfer the last of the files that have not being copied , not everything from start?
|
Unfortunately this is one of the least efficient scenarios for rsync. You have two remote filesystems, both mounted locally. This means that rsync cannot optimise file transfers for files that already exist on the target by sending only changed blocks. Furthermore you've specified -c (--checksum) so on restart every completed pair of source and destination files will have to be verified with a full data checksum.
The only improvement I can offer here is for you to remove -c from the list of options. If you don't have hard-linked files then also omit -H (--hard-links).
rsync -vaHS --progress /oldPartMountPoint/ /newPartMountPoint/
You can rerun this command as many times as you need, and it will skip previously copied files.
I'm aware this doesn't address the lack of disk or network activity on your VM; you will have to add details of that into your question if you need answers to address that issue.
| Resume rsync transfer after failure? |
1,615,227,484,000 |
I'm on PopOS 19.10, and I try to create a partition on my new SSD (Crucial MX500, 1TB).
Note that it worked on Windows, I could create a NTFS partition, so from this base I admit my SSD is healthy (can I ?).
First I tried from GParted, but it gives me a warning: unrecognised disk label. I have to create a partition table, what I do, but it seems to do nothing. Then I try to create a partition, which I can't do because I have to create the partition table before...
So with some search I tried to use fdisk /dev/sdc. I typed n, p, then keep default values. With i I got what I want, a partition:
Partition 1 sélectionnée
Device: /dev/sdc1
Start: 2048
End: 1953525167
Sectors: 1953523120
Cylinders: 121602
Size: 931,5G
Id: 83
Type: Linux
Start-C/H/S: 0/32/33
End-C/H/S: 769/80/63
So I leave with w. But no partition was created, when I return to fdisk it doesn't show me any partition.
Then I tried with parted:
(parted) unit GB
(parted) mklabel msdos
(parted) mkpart primary ext4 0 500
(parted) print
Modèle: ATA CT1000MX500SSD1 (scsi)
Disque /dev/sdc : 1000GB
Taille des secteurs (logiques/physiques): 512B/4096B
Table de partitions : msdos
Disk Flags:
Numéro Début Fin Taille Type Système de fichiers Fanions
1 0,00GB 500GB 500GB primary ext4 lba
But as with fdisk nothing is done. When I redo parted, then print I got this:
(parted) print
Erreur: Impossible d'ouvrir /dev/sdc - étiquette de disque non reconnue. (= unrecognized disk label)
Modèle: ATA CT1000MX500SSD1 (scsi)
Disque /dev/sdc : 1000GB
Taille des secteurs (logiques/physiques): 512B/4096B
Table de partitions : unknown
Disk Flags:
I thought it may be a refresh issue, so I tried partprobe /dev/sdc without any change.
And of course restarted the computer.
I really don't know what to do...
Thank you for any help you could give !
|
I solved my issue. The fault was due to the SATA cable ! I just changed it and everything works fine now.
Thank you @Jonas Berlin @schweik for your helps !
| Cannot create partition on hard drive |
1,615,227,484,000 |
In order to bypass the operating system cache when reading a file, I used O_DIRECT flag when calling open(). In Wikipedia it says that there is no difference between the two. Yet, does defining a HD (or more specifically a partition) as a raw device allows to avoid using a file system? (In this Stack Overflow post a comment says it's impossible since a file system was already preformatted. )
Moreover, except from the file system question, If one can share a good guild for defining and working with raw device I would be really grateful.
|
No, accessing the raw device does not need a filesystem. Well, you could say you are using a virtual filesystem /dev but that's only needed to expose the name of the device, after that your i/o is going to the device.
But there are many levels of cache/buffering. Filesystem is just one of them, the system will have its own set and disk hardware does too. If you want to get even closer to the device you will need to access other interfaces.
You might be better off with an existing tool, say dd and hdparm. "Test disk i/o performance with dd" or "Disk Speed Test (Read/Write): HDD, SSD Performance in Linux".
| Does a raw device need a file system? |
1,615,227,484,000 |
I want to change a partition to Ext3 or Ext4 and used fdisk to print the availlable partition types:
19 Linux swap 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
20 Linux filesystem 0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data 3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86) 44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM) 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64) B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64) 993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID A19D880F-05FC-4D3B-A006-743F0F84911E
30 Linux extended boot BC13C2FF-59E6-4262-A352-B275FD6F7172
31 Linux LVM E6D6D379-F507-44C2-A23C-238F2A3DF928
So, I guess i will go with 20 or maybe 28...
EDIT: Full list of availlable partition types I can chose from:
1 EFI System C12A7328-F81F-11D2-BA4B-00A0C93EC93B
2 MBR partition scheme 024DEE41-33E7-11D3-9D69-0008C781F39F
3 Intel Fast Flash D3BFE2DE-3DAF-11DF-BA40-E3A556D89593
4 BIOS boot 21686148-6449-6E6F-744E-656564454649
5 Sony boot partition F4019732-066E-4E12-8273-346C5641494F
6 Lenovo boot partition BFBFAFE7-A34F-448A-9A5B-6213EB736C22
7 PowerPC PReP boot 9E1A2D38-C612-4316-AA26-8B49521E5A8B
8 ONIE boot 7412F7D5-A156-4B13-81DC-867174929325
9 ONIE config D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149
10 Microsoft reserved E3C9E316-0B5C-4DB8-817D-F92DF00215AE
11 Microsoft basic data EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
12 Microsoft LDM metadata 5808C8AA-7E8F-42E0-85D2-E1E90434CFB3
13 Microsoft LDM data AF9B60A0-1431-4F62-BC68-3311714A69AD
14 Windows recovery environment DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
15 IBM General Parallel Fs 37AFFC90-EF7D-4E96-91C3-2D7AE055B174
16 Microsoft Storage Spaces E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D
17 HP-UX data 75894C1E-3AEB-11D3-B7C1-7B03A0000000
18 HP-UX service E2A1E728-32E3-11D6-A682-7B03A0000000
19 Linux swap 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
20 Linux filesystem 0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data 3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86) 44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM) 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64) B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64) 993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID A19D880F-05FC-4D3B-A006-743F0F84911E
30 Linux extended boot BC13C2FF-59E6-4262-A352-B275FD6F7172
31 Linux LVM E6D6D379-F507-44C2-A23C-238F2A3DF928
32 FreeBSD data 516E7CB4-6ECF-11D6-8FF8-00022D09712B
33 FreeBSD boot 83BD6B9D-7F41-11DC-BE0B-001560B84F0F
34 FreeBSD swap 516E7CB5-6ECF-11D6-8FF8-00022D09712B
35 FreeBSD UFS 516E7CB6-6ECF-11D6-8FF8-00022D09712B
36 FreeBSD ZFS 516E7CBA-6ECF-11D6-8FF8-00022D09712B
37 FreeBSD Vinum 516E7CB8-6ECF-11D6-8FF8-00022D09712B
38 Apple HFS/HFS+ 48465300-0000-11AA-AA11-00306543ECAC
39 Apple UFS 55465300-0000-11AA-AA11-00306543ECAC
40 Apple RAID 52414944-0000-11AA-AA11-00306543ECAC
41 Apple RAID offline 52414944-5F4F-11AA-AA11-00306543ECAC
42 Apple boot 426F6F74-0000-11AA-AA11-00306543ECAC
43 Apple label 4C616265-6C00-11AA-AA11-00306543ECAC
44 Apple TV recovery 5265636F-7665-11AA-AA11-00306543ECAC
45 Apple Core storage 53746F72-6167-11AA-AA11-00306543ECAC
46 Solaris boot 6A82CB45-1DD2-11B2-99A6-080020736631
47 Solaris root 6A85CF4D-1DD2-11B2-99A6-080020736631
48 Solaris /usr & Apple ZFS 6A898CC3-1DD2-11B2-99A6-080020736631
49 Solaris swap 6A87C46F-1DD2-11B2-99A6-080020736631
50 Solaris backup 6A8B642B-1DD2-11B2-99A6-080020736631
51 Solaris /var 6A8EF2E9-1DD2-11B2-99A6-080020736631
52 Solaris /home 6A90BA39-1DD2-11B2-99A6-080020736631
53 Solaris alternate sector 6A9283A5-1DD2-11B2-99A6-080020736631
54 Solaris reserved 1 6A945A3B-1DD2-11B2-99A6-080020736631
55 Solaris reserved 2 6A9630D1-1DD2-11B2-99A6-080020736631
56 Solaris reserved 3 6A980767-1DD2-11B2-99A6-080020736631
57 Solaris reserved 4 6A96237F-1DD2-11B2-99A6-080020736631
58 Solaris reserved 5 6A8D2AC7-1DD2-11B2-99A6-080020736631
59 NetBSD swap 49F48D32-B10E-11DC-B99B-0019D1879648
60 NetBSD FFS 49F48D5A-B10E-11DC-B99B-0019D1879648
61 NetBSD LFS 49F48D82-B10E-11DC-B99B-0019D1879648
62 NetBSD concatenated 2DB519C4-B10E-11DC-B99B-0019D1879648
63 NetBSD encrypted 2DB519EC-B10E-11DC-B99B-0019D1879648
64 NetBSD RAID 49F48DAA-B10E-11DC-B99B-0019D1879648
65 ChromeOS kernel FE3A2A5D-4F32-41A7-B725-ACCC3285A309
66 ChromeOS root fs 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC
67 ChromeOS reserved 2E0A753D-9E48-43B0-8337-B15192CB1B5E
68 MidnightBSD data 85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7
69 MidnightBSD boot 85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7
70 MidnightBSD swap 85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7
71 MidnightBSD UFS 0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7
72 MidnightBSD ZFS 85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7
73 MidnightBSD Vinum 85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7
74 Ceph Journal 45B0969E-9B03-4F30-B4C6-B4B80CEFF106
75 Ceph Encrypted Journal 45B0969E-9B03-4F30-B4C6-5EC00CEFF106
76 Ceph OSD 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D
77 Ceph crypt OSD 4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D
78 Ceph disk in creation 89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE
79 Ceph crypt disk in creation 89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE
80 VMware VMFS AA31E02A-400F-11DB-9590-000C2911D1B8
81 VMware Diagnostic 9D275380-40AD-11DB-BF97-000C2911D1B8
82 VMware Virtual SAN 381CFCCC-7288-11E0-92EE-000C2911D0B2
83 VMware Virsto 77719A0C-A4A0-11E3-A47E-000C29745A24
84 VMware Reserved 9198EFFC-31C0-11DB-8F78-000C2911D1B8
85 OpenBSD data 824CC7A0-36A8-11E3-890A-952519AD3F61
86 QNX6 file system CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1
87 Plan 9 partition C91818F9-8025-47AF-89D2-F030D7000C2C
|
Text mode
Let fdisk do it's job on the external drive (if you need to create one or more partitions). Use the default partition type (don't worry about it).
Then use mkfs.ext4 and create an ext4 file system.
Graphical mode
Use gparted and let it create partition(s) and file system(s).
| Which Linux partition type to chose for external USB HDD with EXT3 or EXT4? |
1,615,227,484,000 |
I'm trying to expand my main linux partition from a Debian install, /dev/sda1 into the 7gb unallocated free space. Normally I would just use the resize feature in GParted but because the free-space isn't alongside /dev/sda1 I can't. How can I expand my main partition without corrupting the partitions/losing data?
|
Back up your data.
Use a live USB system or similar and then from it:
Move the swap to the end of sda2.
Shrink sda2.
Enlarge sda1.
In fact there's no point in keeping the logical sda2 just for swap, so you might prefer to remove the swap and then sda2, and finally just build a new swap partition at the end and follow on with point 5.
| GParted - expand main Debian partition into freespace |
1,615,227,484,000 |
As far as I know, this just amounts to a change in the partition table and it is a relatively safe operation that is rather cheap.
Is there any significant cost or drawback(s) to...
Creating and destroying partitions all the time
Having lots of partitions, mounting them, and actually using them to write and read lots of data and expecting this to perform at the same level as if we were dealing with directories in a larger partition
For the latter, I can think of several factors that could affect this in theory, but all of them should be negligible in practice.
Just general curiosity, this is not something with a real use case
|
The single most important reason to avoid too many partitions on the same harddisk is space usage: As your harddisk fills up, the partitions will fill up to a different degree, and you can't use free space in one partition in another partition if the latter partition gets full.
While you can resize partitions, doing so is time consuming, and in case of SSD causes unnecessary wear.
To a lesser degree, destroying and re-creating partitions is also time consuming: You must not only create the partition, you also must initialize the file system on it (mkfs), and that takes a bit for large partitions.
Otherwise, there's in principle no downside to mounting and using many partitions with respect to performance etc. However, it's a bit difficult to come up with a use case for that, and in particular a use case where it's obvious how to distribute the files you have on those many partitions.
| Is there a reason to avoid frequently creating and 'destroying' partitions and having lots of them? [closed] |
1,615,227,484,000 |
I currently have a hard drive with a boot partition and an extended partition; the extended partition contains /, swap, and /home partitions, as shown in the screenshot below:
I recently acquired a new 1TB drive and I'm planning to install a new OS. I want to use LVM for flexibility. However, I need to get all the data that's on my current /home partition onto the new disk somehow.
If I use LVM on the new drive and then install the OS (Linux Mint, if that's relevant), can I somehow temporarily mount my existing (partitioned, non-LVM) drive to copy the data over? (I do not want to include the old drive in my storage pool, or at least not yet. I'm still figuring out what to do with the old drive, which is partly why I want the flexibility of LVM.)
|
Yes, Mint (and Ubuntu, and Debian) will allow you to have multiple drives with different partitioning, e.g., LVM on one physical drive and ext4 on another. It's just another partition; LVM coexists with ext4 just like ZFS can coexist with a different device formatted for ext4. The Debian link in the first line here shows LVM co-existing with non-LVM /boot, and that's as authoritative as they come.
LVM is explained here, as well as on the five web links under every instance of LVM which were added to your original question.
You may also eliminate the swap partition and use a swap file instead, as the performance penalty for a swap file has been resolved.
| Can I temporarily mount a partitioned hard drive while using LVM? |
1,615,227,484,000 |
I have a partition structure as follows:
/dev/sdc1 => Partition 1 ( My OS. [ Linux flavour ] )
/dev/sdc2 => Partition 2 ( This contents some data. )
/dev/sdc3 => Partition 3 ( This also contents some data. )
/dev/sdc4 => Partition 4 ( I want this as a deciding partition. )
I am trying to mount partition 2 or partition 3 dynamically depending on the file present in partition 4.
For example:- Partition 2 will be mounted if partition 4 consists of a file named two. Partition 3 will be mounted if partition 4 consists of a file named three.
Note:- This partition will never be mounted together i.e. if Partition 2 is mounted partition 3 will be not be mounted until partition 2 is unmounted. Thus I can use a common directory for both partitions.
As I have systemd available on my os I can write a startup script which can read from partition 4 and mount the appropriate partition at boot and write the partition record into /etc/fstab.
But according to my understanding fstab is critical file and if any failure happens or fstab get's corrupt it's going to stop the system from booting.
Question:
Now what I am trying to achieve is can I add an entry in fstab which will read dynamically partition 4 and add the entry for partition 2 or partition 3 depending on the file that exists in the partition 4.
|
The solution should be systemd-based, you do NOT have to edit /etc/fstab with systemd, why would you ? You just mount the partition, depending on the factors you have outlined, and leave it at that.
I do not understand why you would want to edit /etc/fstab if systemd can mount what you need. Do note that systemd will refuse to boot if an entry in /etc/fstab is not available. This entails that on systems with systemd, /etc/fstab should only be used for boot-essential static file systems.
| Can fstab dynamically mount a partition by reading from a file or filename? |
1,615,227,484,000 |
I have the following:
Western Digital 2 TB HDD (65GB used space)
Seagate 250 GB HDD (with nothing on it)
The 2 TB HDD has Mac OS X 10.6.8 that I need to clone onto the smaller drive in order to use it with a Mac Pro (A1186). I want to shrink the partition on the 2 TB drive via gparted and then use clonezilla to clone that partition along with the boot partition onto the 250 GB HDD. When I open gparted terminal shows an error that says it only supports 512 bytes length sector and gparted shows the partition with a caution exclamation mark that indicates it can not read the contents of the drive. Mounting the drive allows gparted to read the contents and tells me how much used/free space I have but I can't shrink the partition while its mounted. So how do I go about shrinking the partition ensuring both HDDs have the same byte sector size and cloning it to the other drive in order to make it bootable?
Please see images that show gparted with drive unmounted and with the drive mounted.
Terminal states: "the sector sized stored in the journal is not 512 bytes. Parted only supports 512 bytes length sectors"
|
You can restore the drive with DiskUtility in Snow Leopard, no shrinking needed.
Erase the 250GB as "Mac OS Extended (Case-sensitive Journaled)" (or without "Case-sensitive")
Right-click "Restore" on the 2TB, choose source and destination (drag the partitions into the fields), click "Restore".
Finished
| How do I clone a 2 TB HDD onto a 120 GB HDD (shrink partition using gparted) |
1,554,377,940,000 |
I have a ssd(256 Gb), when I'm trying to part it:
sfdisk /dev/sda << EOF
2048,8388608,S
,104857600,L
,,E
,20971520,L
,20971520,L
,20971520,L
,,L
EOF
fi
the output is:
Disk /dev/sda: 238.5GiB, 256060514304 bytes, 500118192 sectors
Disklabel type: dos
Disk identifier: 0xdedcd8ac
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 8390655 8388608 4G 82 Linux swap
/dev/sda2 8390656 113248255 104857600 50G 83 Linux
/dev/sda3 113248256 500118191 386869936 184.5G 5 Extended
/dev/sda5 113250304 134221823 20971520 10G 83 Linux
/dev/sda6 134223872 155195391 20971520 10G 83 Linux
/dev/sda7 155197440 176168959 20971520 10G 83 Linux
/dev/sda8 176171008 500118191 323947184 154.5G 83 Linux
How could it be? The total size of parts more than ssd size (423>256).
|
Partition 3 is an extended partition and shows its size as sum of parts 5, 6, 7, 8.
| sfdisk strange behavior: total size of partitions greater than device size |
1,554,377,940,000 |
I plan to encrypt a user's /home directory, prefering dm-crypt over eCryptfs, which seems to read data x times faster. But encrypting the whole /home would be a problem for others, entering an encryption key at every login.
Is it possible to separate /home/$USER as a partition?
|
Log out as that user, proceed as root. Create said additional partition with fdisk or parted. Make temporary mountpoint for that partition, say /mnt/tempuser. Mount it to that mountpoint. Rsync /home/$USER to /mnt/tempuser/ and then mv /home/$USER /home/originaluser. Mkdir /home/$USER and chown it to said $USER
Now try logging in as $USER. su - $USER from that same root console for example. Should be enough to test if it worked or what went wrong. Fallback would be
umount /home/$USER ; mv /home/$USER /home/faileduser ; mv /home/originaluser /home/$USER
Then if all seems fine with logging in like that, add it to /etc/fstab so it gets mounted on boot, define mountpoint here as /home/$USER
| A separate partition for a user's /home directory? |
1,554,377,940,000 |
I have the following setup:
sda7 is my /home (Linux Mint) that I want to merge with sda8 (which I cut out of Windows). I read here that I can't combine two partitions that are not adjacent and that they can't be both extended. Is this true? If so, should I convert one of them into something else? I have no option to drag any of them with a mouse.
|
Here's a high-level overview for how to get some unallocated space you can use for sda7.
Get the contents of sda8 and add them into sda7.
Delete sda8.
In the unallocated space where sda8 was, create a new Linux swap partition; The same size as the one you already have.
Delete the "old" Linux swap partition, sda6.
That should allow you to drag sda5 and sda7 to the left, freeing up space after sda7. Then you can extend sda7 to consume the remaining free space.
| How do I merge two ext4 partitions? |
1,554,377,940,000 |
I enlarged LV swap from 1G to 4G. I also moved / and /home in a single PV to two different LVs, by shrinking LV root and create LV home on the freed space, and then following https://askubuntu.com/a/923943/1471
$ sudo mkdir /mnt/home
$ sudo mount /dev/mapper/lubuntu--vg-home /mnt/home/
$ sudo cp -r /home/* /mnt/home/
$ sudo mv /home /home-orig
$ sudo mkdir /home
and modified /etc/fstab into the following content, where I renamed /dev/mapper/lubuntu--vg-swap_1 to /dev/mapper/lubuntu--vg-swap (because I have renamed LV from default name swap_1 to swap by lvrename), and add a line for mounting /dev/mapper/lubuntu--vg-home at /home.
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/lubuntu--vg-root / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=0C1E-EE69 /boot/efi vfat umask=0077 0 1
/dev/mapper/lubuntu--vg-swap none swap sw 0 0
# my change:
/dev/mapper/lubuntu--vg-home /home ext4 defaults 0 2
After I reboot, it seems that LV home is correctly mounted at /home:
$ pwd
/home/t
t@olive:~$ df .
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/lubuntu--vg-home 425480640 180336 403617312 1% /home
but there are two problems
although I can still login in virtual console, I can't log in LXDE of Lubuntu.
free shows that the swap size is still 1GB.
$ free -h
total used free shared buff/cache available
Mem: 3.3G 196M 2.9G 5.3M 239M 2.9G
Swap: 979M 0B 979M
$ cat /proc/swaps
Filename Type Size Used Priority
/dev/dm-1 partition 1003516 0 -2
$ ls /dev/mapper/ -la
total 0
drwxr-xr-x 2 root root 120 Feb 23 16:47 .
drwxr-xr-x 22 root root 4260 Feb 23 16:47 ..
crw------- 1 root root 10, 236 Feb 23 16:47 control
lrwxrwxrwx 1 root root 7 Feb 23 16:52 lubuntu--vg-home -> ../dm-2
lrwxrwxrwx 1 root root 7 Feb 23 16:52 lubuntu--vg-root -> ../dm-0
lrwxrwxrwx 1 root root 7 Feb 23 16:52 lubuntu--vg-swap -> ../dm-1
How can I solve the problems? Thanks.
|
For starters your cp hasn't retained permissions or ownerships. Use cp -a instead of cp -r.
To be going on, you haven't resized swap itself, just the LV where swap is stored. You'll need to rerun mkswap.
| Can't log in desktop environment after moving `/` and `/home` into different LVs and enlarge swap |
1,554,377,940,000 |
I want to duel boot windows and Ubuntu, however i don't want anything on windows to be able to access my Linux partition. Is there anyway to do this without encryption? As i don't want to slowdown read/write times on my Linux system.
|
You have 2 options, to stop deletion.
Separate hard-disks, and hardware switches.
If you want to do it with the same hard-disk, then you will need some virtualisation software to run under MS-Windows.
There is no other way, as MS-Windows is an operating system, it can do what ever it wants with the hardware.
To stop read, then you can use encryption (your solution).
| Protect linux partition from windows |
1,554,377,940,000 |
I am using Opensuse Tumbleweed and set up the root partition as btrfs and home partition as ext4. I used lvm during installation.When installed, the root partition had 40GB and home partition had 25 GB space allocated. Approximately 300GB was not allocated. Now, as I'm running out of space in /home, I resized my Linux LVM partition from 75GB to 187.9GB. I also extended the lvm partition using lvextend -L+20GB /dev/system/home which I thought would add an extra 20GB to my home partition. The output from fdisk -l shows that the partition was resized as follows:
Disk /dev/sda: 477 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron_1100_MTFD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 04174A0E-F3C6-459F-A2AB-93E3BED5D4D7
Device Start End Sectors Size Type
/dev/sda1 411648 394334207 393922560 187.9G Linux LVM
/dev/sda4 2048 411647 409600 200M BIOS boot
Partition table entries are not in disk order.
Disk /dev/mapper/system-root: 40 GiB, 42949672960 bytes, 83886080 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/system-swap: 7.7 GiB, 8246001664 bytes, 16105472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/system-home: 45 GiB, 48318382080 bytes, 94371840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes/
I/O size (minimum/optimal): 512 bytes / 512 bytes
The df -h output shows that the /home directory remained at the same size as follows:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 57M 3.8G 2% /dev/shm
tmpfs 3.9G 1.7M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/system-root 40G 14G 27G 34% /
/dev/mapper/system-root 40G 14G 27G 34% /boot/grub2/i386-pc
/dev/mapper/system-root 40G 14G 27G 34% /.snapshots
/dev/mapper/system-root 40G 14G 27G 34% /boot/grub2/x86_64-efi
/dev/mapper/system-root 40G 14G 27G 34% /srv
/dev/mapper/system-root 40G 14G 27G 34% /var
/dev/mapper/system-root 40G 14G 27G 34% /tmp
/dev/mapper/system-root 40G 14G 27G 34% /usr/local
/dev/mapper/system-root 40G 14G 27G 34% /opt
/dev/mapper/system-home 25G 22G 1.7G 94% /home
tmpfs 786M 16K 786M 1% /run/user/1000
What steps did I miss while resizing the partition? Why is the changed size not affecting the /home directory?
Thanks
EDIT
As requested, the output of lsblk -f /dev/mapper/system-home:
NAME FSTYPE LABEL UUID FSAVAIL
FSUSE% MOUNTPOINT
system-home ext4 9315a4b3-2dde-41ad-8937-20c492304639 1.6G 88% /home
|
To extend the filesystem after extend LV you should exec command
resize2fs /dev/mapper/system-home
Usually this can be done on the fly (w/o need to unmount the filesystem)
| Resizing /home in Opensuse |
1,554,377,940,000 |
I follow a tutorial to secure my /etc/fstab file. This is a certain part about /var and /tmp
UUID=XXXX-XXXX-XXXX /var ext4 defaults,nodev,nosuid,noexec 1 2
UUID=ZZZZ-ZZZZ-ZZZZ /tmp ext4 defaults,nodev,nosuid,noexec 1 2
I executed the following commands to test the configuration :
touch /tmp/testFile
chmod u+s /tmp/testFile
I was expecting an error message but nothing... Is it normal ? Is it dangerous ?
|
nosuid doesn’t prevent setting the bits; it means that they don’t have any effect. (That way, previously-set bits are also rendered ineffective.)
Setting the bits is only dangerous if the file system is later mounted without nosuid; but if anyone has sufficient access to set those bits on your file system, you’ve lost anyway.
| nosuid doesn't prevent chmod u+s |
1,554,377,940,000 |
I have an external USB drive which is formatted in FAT32. That's the output of the fdisk -l command:
/dev/sdb1 * 56 15728639 15728584 7.5G c W95 FAT32 (LBA)
I have the following entry in my /etc/fstab:
UUID=FAF0-4AE6 /media/usb vfat defaults,auto,rw,users,nofail,x-systemd.automount,x-systemd.device-timeout=1 0 0
I am mounting the drive using: sudo mount -a but then everything is owned by root:root and I cannot change the ownership of the different directories and to copy files from my internal partition to the external USB drive. It gives me:
cp: cannot create regular file ... Permission denied
Are my fstab options correct, why I can't use my USB flash drive with regular user's permissions?
|
Vfat partitions don't support file owners/groups. Thus, the Linux kernel has to fake it. By default, it makes root:root own everything. To change this, add uid=youruser,gid=yourgroup to the mount options. Then, that user and group will own everything instead.
| “cp: cannot create regular file” on a VFAT formatted external USB flash drive |
1,554,377,940,000 |
I want to remove my swap LVM LV out of its current LUKS container, and have it unencrypted instead.
I want to avoid something like gparted to have control of every step in the process.
After doing lvremove on the swap LV and pvmove to get contiguous PV extents, how do I work out the minimum size to pass to pvresize?
Given the now shrunken PV, how do I work out exactly how many sectors or MiB the LUKS container should contain, so I can shrink the LUKS partition to match?
Am I right in thinking that a LUKS container doesn't have a length, and is shrunk by simply shrinking the partition?
Is there a way of checking at the LVM level that the final extents of the PV are still accessible, ie, that they are indeed inside the shrunken partition's addressable sectors?
|
1.)
From the man page:
pvresize will refuse to shrink PhysicalVolume if it has allocated extents after where its new end would be.
So you could just do this by trial & error. Actually pvresize will tell you part of it:
/dev/dm-7: cannot resize to 17564 extents as 18620 are allocated.
To determine the exact size, you need to know the PE size (e.g. 4MiB) and 1st PE offset (e.g. 1MiB). And of course, the number of the last allocated extent.
pvs -o pv_name,pe_start,vg_extent_size,seg_pe_ranges
So the total size could for example be 1MiB (1st PE) + 18620 * 4MiB (PE size).
2.)
You need to know the LUKS header size / data offset. Usually this is 4096 sectors, i.e. 2MiB. Check with cryptsetup luksDump, Payload offset.
So your new partition size is the LUKS Payload offset plus whatever size you resized the PV itself to.
3.)
Yes and no. LUKS doesn't keep the size in its metadata, so if you are going to close the LUKS container, or even reboot, then yes, it will just use the size of the block device itself.
But for an online resize, you would need to set it with cryptsetup resize, to whatever size you used in pvresize.
4.)
I sometimes do this by passing the offending device in read-only mode to a qemu/KVM instance, running some Linux rescue system. It's hard to check on the host (with, say, a read-only loop device) because LVM doesn't like to see duplicate PV UUIDs, or VG/LV names. LVM will refuse to activate, should the PV turn out to be smaller than expected.
| Maximally shrink LVM PV and LUKS container / partition [closed] |
1,554,377,940,000 |
I extended an lvm from the terminal in system rescue live CD using the commands:
# pvcreate /dev/sda7
# vgextend fedora /dev/sda7
# lvextend -l +100%FREE /dev/fedora/root
The above worked but when I try to check the LV file system or resize it I get the following errors:
# e2fsck -f /dev/fedora/root
e2fsck: No such file or directory while trying to open /dev/fedora/root
Possibly non-existent device?
# resize2fs /dev/fedora/root
open: No such file or directory while opening /dev/fedora/root
Do I have to activate or mount the volume before I run those commands? I didn't change the name of the volume group.
UPDATE
Resolved by simply adding command provided by Hauke Laging before resize2fs or e2fsck
|
It is not enough that a LV exists on the PV, it must also be active for being used i.e. the device mapper device (/dev/mapper/fedora-root) must be created:
lvchange -ay fedora/root
or
vgchange -ay fedora
| LVM not able to be resized or checked with resize2fs and e2fsck |
1,554,377,940,000 |
There is already:
$ umount -l
.
But is there a way to unmount silently?
This means, in example: If a photo on the unmounted partition is inside of a device, then Linux should preferrably keep it in the cache, the file managers should still display the files and folders, and the cached files should be accessible until that cache space is needed for something else.
How can a partition be unmounted sthealthily?
|
Obviously you have found no approach in man umount.
So long as devices are accessed through device-mapper (/dev/mapper/ / /dev/dm-*), you can implement surprising re-mappings with dmsetup. Conveniently this includes
remove [-f|--force] device_name
Removes a device. It will no longer be visible to dmsetup.
Open devices cannot be removed except with older kernels that
contain a version of device-mapper prior to 4.8.0. In this case
the device will be deleted when its open_count drops to zero.
From version 4.8.0 onwards, if a device can't be removed because
an uninterruptible process is waiting for I/O to return from it,
adding --force will replace the table with one that fails all
I/O, which might allow the process to be killed.
I thought you might get more reliable behaviour if you could do the equivalent at the filesystem level, but the options for this seem to be even more obscure. E.g. you want some construction like a FUSE network filesystem, sshfs... as a network filesystem it must support read caching... and from the man page it looks like the cache timeouts e.g. for dirs can be set high as you would need... sshfs supports retries, so you should be able to kill the SSH listener... In this example, reads not satisfied by cache would hard-block indefinitely.
Hence I suggest spending some time with the device mapper and dmsetup.
In either case, you're not unmounting the filesystem used by the application. The mount entry will still be visible in /proc/mounts etc. This will be absolutely necessary; an open file must point to some filesystem. Instead, you're detaching that filesystem from its original backing store.
| U(n)mount sthealthily without notifying applications or clearing cache. (testing purposes) |
1,554,377,940,000 |
I am a new Linux user, and I installed Ubuntu from scratch yesterday for the first time. I am dual booting Ubuntu and Windows 10, so following these instructions, I partitioned my drive to leave ~100GB for Ubuntu, with 10GB as root, 5GB as swap and 80GB as home.
I was installing packages, and went to install TeXlive (it's around 3.5GB). I got an error saying I'd run out of disk space. Sure enough, I open Disk Usage Analyser and the / directory (is this called root?) is using up 9.8 GB. Quick googling informs me this is where packages are stored. If that's the case, then I'm not surprised it's using up all of its space - if I intend to continue to install packages, do I need to enlarge it in some way?
If I do need to change the sizes of my partition, is this likely to be dangerous? The first time I tried to resize my partitions I made a mistake and had to format the whole drive to start from scratch, so I'd prefer not to mess around with that until I have some more experience, unless I really have to.
Finally, if it really is the case that I need to wipe everything and start again, please say so (the installation is still quite clean so I won't lose anything more than the time I've spent on this one). But please also tell me how to avoid making this mistake in the future!
|
I'd use the following partitioning:
/ 30 Gb
/home 68 Gb
swap 2 Gb
Swap isn't as important nowadays - due to the high amount of RAM - as it was in the past. So unless you plan to hibernate your machine, 2 Gb of swap is fine. Since this looks like a small install, you could even ditch the separate home partition and go for this:
/ 98 Gb
swap 2 Gb
In this way any free space will be shared between root and home.
As said in the comments, it is possible to live repartition the whole disk, but for cleanliness I'd suggest you go for a fresh install (after backing up any personal data).
| My disk is full - have I made a mistake partitioning? |
1,554,377,940,000 |
We are using a Python script for running sfdisk creating partitions on our Linux.
The code is as below:
stdin,stdout=\
(lambda x:(x.stdin,x.stdout))\
(subprocess.Popen(
["/sbin/sfdisk","-uM","--no-reread",device],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT))
#<start>;<size>;<id>;<bootable>;
t="""0;95;83;
;160;b;*
;;E;
;0;;
;20;b;
;95;b;
;;b;
"""
print "Writing\n%s"%(t,)
stdin.write(t)
stdin.close()
"""Explanation:
/ 100MB (hda1)
/mnt/system 175MB (hda2)
/mnt/configuration 25MB (hda5)
/mnt/logs 100MB (hda6)
/mnt/user 88MB (hda7)
"""
After running this command I am seeing that the explanation is correct and for example systm has 175 MB. What I don't understand is how the size 95 is mapped to 100 Megabyte, 160 to 175, 20 to 25 and so on.
The other question is if I want to increase the size of system to 210 megabyte then what is correct number to write in the command?
|
Note, you have a slightly out-of-date sfdisk command, as since 2015 version 2.26 it no longer accepts -uM, which is used to set the default "unit".
The difference you are seeing is due to whether numbers are given in MB i.e. Megabytes (1000*1000) or MiB i.e. Mebibytes (1024*1024). 100MB is approximately 95MiB.
If you want to future proof your code against a newer sfdisk you should remove the -uM and assume sizes are in sectors of 512 bytes.
The newer version allows you to give numbers with a suffix like MiB.
210MB can be calculated as:
echo '210*1000*1000/1024/1024' | bc
about 200MiB.
| how mapping of sfdisk partition size is working |
1,554,377,940,000 |
So I do have disk space for the vm available 40G.
and I want to custom the partitioning in the following way: using LVM with a vol group = vg_root
/ -2GB
/usr - 5GB
/var -2GB
/tmp- 1GB
/opt - 1GB
/home - 2GB
/swap - 4GB
When I try to proceed with this, it gives me error message that the /boot is not assigned and can't be LVM.
My question is, do we always have to provide a /boot parition and it should never be of type lvm ?
|
Yes, you have to separate /boot partition & it is also a good practice to have swap both out of LVM partitions.
| custom partitioning failed for a centosVM |
1,554,377,940,000 |
I kinda messed up... I was editing a partition from a external volume and I might have edited boot partition accidentally.
My machine isn't able to boot, it says error: no such partition. entering rescue mode. grub rescue> (screenshot 1)
I tried to list the partitions with grub rescue, but they seem empty?
System Info:
Ubuntu 16.04 running on amd64
trying to boot from SSD with boot and OS etc.
no backup of entire disk
Everything worked fine before
Anyway I tried to
set boot=(hd1)
set prefix=(hd1)/boot/grub
insmod normal
which returns
Can't find /boot/grub/i386-pc/normal.mod (Beacause it's empty?) No fix I found so far helped.
I also tried starting with Ubuntu-live, where I can access the files of my SSD.
There I opened gparted (screenshot 2) and used fdisk -l (screenshot 3), which tells me, there is no boot enabled partition. I suppose W95 Ext'd should usually be Linux, right? If so, is there a way to "convert" that table?
If you have other suspicions, please let me know.
Thx for any hints or resources that might be helpful!
|
Note that the issues you're experiencing apply to legacy mode booting. (Your partition table in gparted will say msdos) If you use GPT with BIOS or UEFI this doesn't apply.
error: no such partition. entering rescue mode. Implies that grub can not load modules and the file system on the same disk can no longer be found. In grubs terminology this is called stage 2. Either this is because your /boot partition was deleted or formatted. This also applies if your root was deleted containing a /boot directory.
You can try simply recreating the boot partition if it was deleted as unallocated space at the beginning of the disk of around 500MB was most probably your boot partition.
In gparted you can select the unallocated space and create a new partition but when creating it make the file system type unformatted. This is very important. It will default to taking up all the continuous free space and will be a primary partition. Free space preceding and following should be 0 After that click apply and after it loads it will detect that its ext3 or ext4 if that worked. This is not full proof and you may want to use testdisk to automatically find lost partitions instead.
| System not booting, grub rescue failing. Partition restoring? |
1,554,377,940,000 |
I want to install centOS 7 along side windows 8.1 for this I'm planning to do partition in a following way.
/boot - 500MB - Standard Partition
/swap - Half of my RAM size
/root - 20GB - Standard Partition
/home - Rest of my space - Standard Partition
The problem is: if I create /swap first, then I couldn't create Standard Partition anymore. Likewise if I create Standard first, I couldn't create /swap.
The error message is: Unable to allocate requested partition scheme.
After research, I understand that my MBR disk can not have more than 4 primary partition. Here is the current status of my disk
As per as my understanding, Windows already took 3 primary partition
System (C)
System Reversed (E)
Extended Partition (container of Data and AOMEI Recovery Partition)
and CentOS require 2 more Primary Partition: one for /boot and one for the rest (correct me this part if I'm wrong)
Now I have no idea what I should do next to fix this problem. Should I change the setup of CentOS partition or do something to reduce the number of Primary Partitions on Windows and how to do this without losing data.
|
Here is the way I solved this problem:
Move 115 GB unallocated (the one with black bar) into the Extended Partition. Then it would become freespace (with green bar). Now you can install CentOS on this free partition. I used EaseUS to move the partition.
Before partition format (not working):
System Reversed (E)
Unallocated Space
System (C)
Extended Partition (container of Data, AOMEI Recovery Partition)
Working partition format:
System Reversed (E)
System (C)
Extended Partition (container of Data, AOMEI Recovery Partition, Free space)
| First time install CentOS 7 problem |
1,554,377,940,000 |
I started with this in my kickstart file:
%pre
#***********************************************
#
# Get disk name to generate partition
#
#***********************************************
DIR="/sys/block"
# minimum size of hard drive needed specified in GIGABYTES
MINSIZE=50
ROOTDRIVE=""
# /sys/block/*/size is in 512 byte chunks
for DEV in xvda sda sdb sdc sdd; do
if [ -d $DIR/$DEV ]; then
REMOVABLE=`cat $DIR/$DEV/removable`
if (( $REMOVABLE == 0 )); then
echo $DEV
SIZE=`cat $DIR/$DEV/size`
GB=$(($SIZE/2**21))
if [ $GB -gt $MINSIZE ]; then
echo "$(($SIZE/2**21))"
if [ -z $ROOTDRIVE ]; then
ROOTDRIVE=$DEV
fi
fi
fi
fi
done
echo "ROOTDRIVE=$ROOTDRIVE"
cat > /tmp/ks-partition.txt <<EOF
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=$ROOTDRIVE
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype=ext4 --ondisk=$ROOTDRIVE --size=1000
part pv.00 --fstype="lvmpv" --ondisk=$ROOTDRIVE --size=1024 --grow
volgroup vg00 pv.00
logvol swap --fstype="swap" --size=4096 --name=swap --vgname=vg00
logvol /var/log/audit --fstype="ext4" --percent=10 --name=var_log_audit --vgname=vg00
logvol /var/log --fstype="ext4" --percent=10 --name=var_log --vgname=vg00
logvol /var --fstype="ext4" --percent=10 --name=var --vgname=vg00
logvol /opt --fstype="ext4" --percent=30 --name=opt --vgname=vg00
logvol / --fstype="ext4" --size=1000 --grow --name=root --vgname=vg00
EOF
%end
And wittled it all the way down to what you see below before it would work (many partial changes in between). Every time I kicked it I would see something like "is_valid_stage1_device: False" in the anaconda.log and it would ask me to manually configure partitioning to continue. Any ideas?
Using 7.2 and the thing i'm kickstarting is a VM. To be clear the below works like a champ but I need/want to automate like the above.
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=xvda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype=ext4 --ondisk=xvda --size=1000
part pv.00 --fstype="lvmpv" --ondisk=xvda --size=1024 --grow
volgroup vg00 pv.00
logvol swap --fstype="swap" --size=4096 --name=swap --
vgname=vg00
logvol /var/log/audit --fstype="ext4" --percent=10 --name=var_log_audit --vgname=vg00
logvol /var/log --fstype="ext4" --percent=10 --name=var_log --vgname=vg00
logvol /var --fstype="ext4" --percent=10 --name=var --vgname=vg00
logvol /opt --fstype="ext4" --percent=30 --name=opt --vgname=vg00
logvol / --fstype="ext4" --size=1000 --grow --name=root --vgname=vg00
|
Got it! It wasn't the %pre config at all... I missed the %include for the partition file... dumb.
Here's the line I added (outside of the %pre - above it in my case.)
%include /tmp/ks-partition.txt
| Kickstart failing partition creation |
1,554,377,940,000 |
I'm unsure why but when trying to boot my CentOS 5 Server today it failed to boot and stops with the message
/dev/md1 not cleanly unmounted, check forced
And then it's dead in it's tracks, how can I run an fsck command to check this? I'm not getting any log in and no command exits this
|
Reboot and at Grub press e key to edit the boot parameters of your kernel. Get to the kernel line and you will se something like linux /vmlinuz... root=/dev/.... ro ... notice the ro part, modify it to rw and add the word sigle before it. Then press ctrl+x to boot this particular, temoporary, version of options. You will enter the single user mode where you can safely run fsck on your devices.
Alternatively, boot from CD or USB and enter Repair mode.
| CentOS 5 Unable to Boot Not Cleanly Unmounted |
1,554,377,940,000 |
I am running CentOS 7.3 on x86_64. I have a two disk, first one is 256GB SSD where /root, /boot, swap and /home is configured. 0Second one is a 4TB HDD which is mounted as /data and currently has more than 1 TB of data.
I want to expand /home, as it's not sufficient and will run out of space soon. To achieve this, I want to make use of the 4TB HDD I have, such that I can use it both as /home and /data.
/data and not just /home because I already have some application and data configured with some absolute paths like /data/xyz/pqr.
Is it possible to achieve this without formatting anything and hopefully not loosing out on any data?
I am sharing below system information, if more details are required please let me know.
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl-root 55G 27G 29G 50% /
devtmpfs 55G 0 55G 0% /dev
tmpfs 55G 0 55G 0% /dev/shm
tmpfs 55G 18M 55G 1% /run
tmpfs 55G 0 55G 0% /sys/fs/cgroup
/dev/sda1 1.9G 173M 1.7G 10% /boot
/dev/sdb1 3.6T 708G 2.8T 21% /data
/dev/mapper/cl-home 165G 3.0G 162G 2% /home
tmpfs 11G 12K 11G 1% /run/user/42
tmpfs 11G 0 11G 0% /run/user/1001
cat /etc/fstab
/dev/mapper/cl-root / xfs defaults 0 0
UUID=02663577-6456-477e-8489-3565659de456 /boot xfs defaults 0 0
/dev/mapper/cl-home /home xfs defaults 0 0
/dev/mapper/cl-swap swap swap defaults 0 0
/dev/sdb1 /data ext4 defaults 0 0
|
Yes, it's possible. You'll have to shrink the /data filesystem first. Umount it, check filesystem integrity:
e2fsck /dev/sdb1
Shrink with to 999G (or your desired size)
resize2fs /dev/sdb1 999G
And use gparted to resize the partition /dev/sdb1 to 1000G. Then you can fill the filesystem to the size of the /dev/sdb1 with:
resize2fs /dev/sdb1
Now you have the rest of the /dev/sdb available for your new /home. The best if you create there the LVM2 volume group (VG):
vgcreate lvm01 /dev/sdb2
And logical volume (LV) with sufficient size for your /home (500G is example).
lvcreate -n home.vol -L 500G lvm01
Create filesystem on the new LV
mkfs.ext4 /dev/mapper/lvm01-home.vol
Then mount it under temporary mountpoint, logout from ordinary user and under root move content of the /home to the temporary mounpoint, change /etc/fstab entry of /home to the new LV and restart.
| Mount Existing Hard Disk As /home And /data |
1,554,377,940,000 |
I am going to install BunsenLabs Crunchbang on my laptop that has 250gb SSD and a 1tb HDD. I am coming from a Windows 8/10 background so I am not familiar with the way the file system works.
I want to have my OS files on the SSD with the majority of my programs installed on the HHD. Yet I would like some programs installed on the SSD. How would I set the drives up to achieve this? Do I need to partition the disks on install or is it easier to change each program's install directory individually?
|
If you install software using package managers such as RPM (in Fedora and Redhat) and APT (in Debian and Ubuntu), the applications usually will be installed in folders such as /usr/bin, /usr/local/bin and /opt. Tipically, software that is not part of the operating system will reside in /opt.
To use a different disk for the applications, you may (1) mount the other disk as /opt or a sub directory of /opt, or (2) create a symbolic link that redirect the folder /opt or one of its sub directories to a folder in the other disk.
I prefer the second option. Suppose that you have the other disk in /mnt/otherdisk, you can create a folder before installing the software. Note that you must configure the file permissions properly. For instance, if the software will be installed in /opt/software
mkdir /mnt/otherdisk/opt/software
ln -s /mnt/otherdisk/opt/software /opt/software
# then install the software
If you have installed the software, you can move the files and create the link too. Suppose that the software is installed in /some/dir and the other disk is in /mnt/otherdisk:
mv /some/dir /mnt/otherdisk/some/dir
ln -s /mnt/otherdisk/some/dir /some/dir
| Install programs files to separate disk to OS [closed] |
1,554,377,940,000 |
from my linux redhat machine we run lsblk
and we get the following:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 14.6T 0 disk
sdb 8:16 0 372.6G 0 disk
├─sdb1 8:17 0 512M 0 part
│ └─md0 9:0 0 512M 0 raid1 /boot
└─sdb2 8:18 0 372.1G 0 part
└─md1 9:1 0 372G 0 raid1
├─vg00-lv_root 253:0 0 50G 0 lvm /
├─vg00-lv_swap 253:1 0 16G 0 lvm [SWAP]
└─vg00-lv_var 253:2 0 30G 0 lvm /var
sdc 8:32 0 372.6G 0 disk
├─sdc1 8:33 0 512M 0 part
│ └─md0 9:0 0 512M 0 raid1 /boot
└─sdc2 8:34 0 372.1G 0 part
└─md1 9:1 0 372G 0 raid1
├─vg00-lv_root 253:0 0 50G 0 lvm /
├─vg00-lv_swap 253:1 0 16G 0 lvm [SWAP]
└─vg00-lv_var 253:2 0 30G 0 lvm /var
what inst reasonable is why we get two duplicate partitions here , as /boot ?
is that mean we need to push out the second disk as sdc?
my disk's in the HW:
sfdisk -s
/dev/sda: 15623782400
/dev/sdb: 390711384
/dev/md1: 390054912
/dev/md0: 524224
/dev/sdc: 390711384
cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1] sdb1[0]
524224 blocks super 1.0 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md1 : active raid1 sdc2[1] sdb2[0]
390054912 blocks super 1.2 [2/2] [UU]
bitmap: 0/3 pages [0KB], 65536KB chunk
|
The thing is that lsblk doesn't list partitions, it lists block devices.
You're seeing /boot twice, but that's referring to the /boot mount point, which is mounted from a RAID1 multiple device (md) block device composed of two partitions: sdc1 and sdb1.
Since disks, partitions, and multiple device are all block devices, you're bound to see duplication in the mount points.
| linux + lsblk command |
1,554,377,940,000 |
I have a linux mint 18 installation with a luks encrypted / and swap partitions. / which is /dev/sda6 unlocks and mounts fine at boot up. The system then goes into emergency mode. journalctl says timeout trying to reach the swap partition.
I tried running cryptsetup open --type luks /dev/sda5 sda5_cryptand that returns
Device /dev/sda5 is not a valid LUKS device.
|
DopeGhoti is correct.
To confirm a corrupted LUKS header, you can use the following command:
cryptsetup luksDump /dev/sda5
You should get the same error message.
To fix it, re-create the LUKS container, setup the swap again, and take a backup of the LUKS header. Something like this:
cryptsetup luksFormat /dev/sda5
cryptsetup open --type luks /dev/sda5 sda5_crypt
mkswap -L SWAP /dev/mapper/sda5_crypt
swapon -L SWAP
cryptsetup luksHeaderBackup /dev/sda5 --header-backup-file /root/sda5_luks_header.img
The LUKS header is so vulnerable. There's only one copy so when you lose it, there's no way to unlock the device. Unless... you have a backup ;)
| LUKS encrypted swap partition is no longer recognized after power failure |
1,554,377,940,000 |
I created a dual boot awhile ago on a 1 Terabyte SSD for Linux and Windows. Thinking I'd only need 100 (and that it was excessive), I've been happy for awhile.
Unfortunately, as I've spent more and more time and been learning more about Linux I've discovered a need for more space. I wanted to move 100 Gigabytes from Windows' free space over to my primary Linux boot.
This is what it looks like:
It's only allowing me to let my windows partition regain the space. What do I do about this? I have Gparted on a DVD and had attempted to do this the way I'd first done when I'd installed the dual-boot and grub.
|
You cannot expand your Linux ext4 partition because the unallocated space is not adjacent to the Linux partition.
You have two choices here - (1) move the Windows 10 partition to after the unallocated space or (2) create a Linux partition using the unallocated space and mount it via a suitable mount point into your existing Linux root file system.
| Unable to absorb partition into primary OS partition |
1,554,377,940,000 |
I have a problem with used space and available disk space in lvm.
Please see this results :
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup 3 3 0 wz--n- 6.78t 736.00m
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a--u 3.50t 0
/dev/sdb1 VolGroup lvm2 a--u 2.50t 0
/dev/sdb2 VolGroup lvm2 a--u 798.72g 736.00m
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home VolGroup -wi-ao---- 6.73t
lv_root VolGroup -wi-ao---- 50.00g
lv_swap VolGroup -wi-ao---- 4.90g
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
50G 2.5G 45G 6% /
tmpfs 4.9G 0 4.9G 0% /dev/shm
/dev/sda1 477M 28M 425M 7% /boot
/dev/mapper/VolGroup-lv_home
6.7T 5.8T 531G 92% /home
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
ext4 50G 2.5G 45G 6% /
tmpfs tmpfs 4.9G 0 4.9G 0% /dev/shm
/dev/sda1 ext4 477M 28M 425M 7% /boot
/dev/mapper/VolGroup-lv_home
ext4 6.7T 5.8T 529G 92% /home
[root@localhost ~]# arch
x86_64
as you see I assigned about 6.7T to /home via lvm but I can't use more than 6.3T ( difference of Used and Avail in df ) space.
I would be glad if someone could help me.
Thanks
|
I think that the part of storage in lake in the Logical Volume, is the part reseved of root rescue, the 5% reserved for root for emergency situation, this part is 5% by default, it's set when its you create the file system.
look, with dumpe2fs -h /dev/mapper/VolGroup-lv_home | grep -i reserved , will give you the amount of blok reserved, you multiply the value by the size of the block, and you will get the size in bits, you convert to Gb and you will find the lost space.
to have the lost space back to 0% or 1% do this and print us the result of df after :
tune2fs -m 1 /dev/mapper/VolGroup-lv_home
or , for freeing the total space reserved do this :
tune2fs -m 0 /dev/mapper/VolGroup-lv_home
| Inappropriate used and available space in lvm and disk free [duplicate] |
1,554,377,940,000 |
I'm running Xubuntu and don't have a usb or CD available but want to replace my OS with Manjaro.
Is it possible to create a new disk partition and then use that as a media device for installing the OS?
What would the process be for doing this?
|
dump the iso image on partition with:
dd if=file.iso of=/dev/sdX
Then, make the partition bootable (with gparted, parted or fdisk) and move it in order boot to first position.
| Install linux from parition instead of usb? |
1,554,377,940,000 |
I've created a software RAID 6 from five 4TB drives with mdadm --create /dev/md0 --chunk=256 --level=6 --raid-devices=5 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1. Before that, I've created partitions on each drive with the max size. 'fdisk -l' shows below output. However, the overall size is only 6TB. With Raid 6 having 2 parity, shouldn't there be around 12TB?
Disk /dev/sda: 525.1 GB, 525112713216 bytes, 1025610768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
# Start End Size Type Name
1 46139392 83888127 18G Microsoft basic
2 8390656 46139391 18G Microsoft basic
3 87033856 1025610734 447.6G Linux LVM
4 83888128 84936703 512M BIOS boot parti
5 2048 8390655 4G Microsoft basic
6 84936704 87033855 1G Linux swap
Disk /dev/sdb: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/sdc: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdc1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/sde: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sde1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/sdd: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdd1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/sdf: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdf1 1 4294967295 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
Disk /dev/mapper/XSLocalEXT--b30a297a--410a--d586--640b--e10ac011aaf3-b30a297a--410a--d586--640b--e10ac011aaf3: 480.5 GB, 480537214976 bytes, 938549248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
Your partitions are much smaller than the full disks:
/dev/sdc1 1 4294967295 2147483647+ ee GPT
occupies only 4294967295 sectors (out of 7814037168), i.e. just under 2TiB.
If you intend to use the full disks in a RAID array, I would suggest just using the whole disks without bothering with partitions. First, zero out anything looking like an md superblock:
mdadm --zero-superblock /dev/sdb
mdadm --zero-superblock /dev/sdc
mdadm --zero-superblock /dev/sdd
mdadm --zero-superblock /dev/sde
mdadm --zero-superblock /dev/sdf
Then create the array:
mdadm --create /dev/md0 --chunk=256 --level=6 --raid-devices=5 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
If you want to allow replacing failing drives with drives with a slightly smaller number of sectors, you may want to leave some space free; you can do this with the --size= option which takes a size (the amount of disk space to use) in kibibytes, e.g. in your case somewhere around 3,907,018,300KiB (your drives have 3,907,018,584KiB total space, of which 128KiB needs to be kept for the RAID superblock).
| Software RAID too small |
1,554,377,940,000 |
Background
I am an inexperienced Linux user. I want to install Mint on a computer that currently has Xubuntu. I want to install on my SSD drive, which is a secondary hard drive because of hardware reasons out of my control. My primary hard drive is a regular hard drive on which I keep data. The installer wanted to install Mint on the primary hard drive so I picked the "Something else" option to manually select where to install it and I now have to setup partitions. The issue is that when I installed Xubuntu on my SSD the installation process created a logical partition that occupies the entire disk. And that is blocking me from modifying any partitions on my SSD. Screenshots
Question
My question is how do I get rid of the logical volume so that I can setup partitions for my Mint installation?
|
NOTE This will make your current installation un-bootable and any data in the volume group inaccessible.
first in a terminal window start
sudo fdisk /dev/sdb
then press d (the partition delete command)
then press 3 (the number of partition to delete)
then press w (write changes and exit)
| How to get rid of a LVM partition when switching distributions? |
1,554,377,940,000 |
I would like to know if I can reclaim all of my storage. I do not need to recover data, I am free to be as invasive as I need to be.
Situation: two controllers, each with eight disks, two RAID sets (RAID6). One RAID set is handed off to the OS showing 2.2TB, the other shows 12TB.
I ran a deep scan using testdisk and it returned several dozens of "unrecoverable partitions" but I couldn't find a way to tell testdisk to just remove those partitions and give me all my space back.
testdisk has come back with: The harddisk (2199 GB / 2048 GiB) seems too small! (< 29 TB / 26 TiB) Check the harddisk size: HD jumpers settings, BIOS detection... (maybe there is a jumper or setting somewhere?)
Are the unrecoverable partitions preventing the OS from "seeing" the full size of 12TB? How can I remove unrecoverable partitions and get all of my disk space back?
Adaptec Controllers
Other than the following meaningless diffs, they are both Adaptec 5805 controllers running 1.2.0.30300:
root@system:~# arcconf getconfig 2 AD > /tmp/adapter2.info
root@system:~# arcconf getconfig 1 AD > /tmp/adapter1.info
root@system:~# diff /tmp/adapter1.info /tmp/adapter2.info
8,10c8,10
< Controller Serial Number : xxxxxxxxxxx
< Physical Slot : 3
< Temperature : 77 C/ 170 F (Normal)
> Controller Serial Number : yyyyyyyyyyy
> Physical Slot : 4
> Temperature : 76 C/ 168 F (Normal)
RAID sets
The RAID sets are as I'd expect according to the RAID controller's mgmt tool, arcconf:
root@system:~# arcconf getconfig 1 ld
Controllers found: 2
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
Logical device name : STORAGE1
RAID level : 6 Reed-Solomon
Status of logical device : Optimal
Size : 11427830 MB
Stripe-unit size : 256 KB
<...snip...>
root@system:~# arcconf getconfig 2 ld | more
Controllers found: 2
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
Logical device name : STORAGE2
RAID level : 6 Reed-Solomon
Status of logical device : Optimal
Size : 11427830 MB
Stripe-unit size : 256 KB
<...snip...>
OS programs
lsscsi output:
root@system:~# lsscsi -s | grep Adaptec
[0:0:0:0] disk Adaptec STORAGE1 V1.0 /dev/sdc 2.19TB
[7:0:0:0] disk Adaptec STORAGE2 V1.0 /dev/sdd 11.9TB
testdisk reports:
Disk /dev/sdc - 2199 GB / 2048 GiB - CHS 267349 255 63
Disk /dev/sdd - 11 TB / 10 TiB - Adaptec STORAGE2
After a scan, testdisk shows several partitions:
The following partitions can't be recovered:
Partition Start End Size in sectors
> MS Data 52734 19503545853 19503493120
MS Data 52736 19503545855 19503493120
MS Data 262654 19503755773 19503493120
MS Data 262656 19503755775 19503493120
MS Data 367102 19503860221 19503493120
MS Data 367104 19503860223 19503493120
MS Data 1311742 19504804861 19503493120
MS Data 1311744 19504804863 19503493120
MS Data 1312254 19504805373 19503493120
MS Data 1312256 19504805375 19503493120
<...snip...>
lsblk also only shows 2TB:
root@system:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdc 8:32 1 2T 0 disk
sdd 8:48 1 10.9T 0 disk
Other things
I've tried:
1.) Use dd to write all zeros to the full disk but it only wrote to 2.2TB until stopped with the message "No space left on device". Again, only writing to 2.2TB of space.
root@system:~# dd if=/dev/zero of=/dev/sdc bs=8M
dd: error writing ‘/dev/sdc’: No space left on device
262145+0 records in
262144+0 records out
2199023255552 bytes (2.2 TB) copied, 2870.71 s, 766 MB/s
root@system:~# fdisk -l /dev/sdc
Disk /dev/sdc: 2 TiB, 2199023255552 bytes, 4294967296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
2.) Use parted to remove all partitions and just hand the OS an unpartitioned drive.
root@system:~# parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Error: /dev/sdc: unrecognised disk label
Model: Adaptec STORAGE1 (scsi)
Disk /dev/sdc: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
3.) I've attempted to rebuild the RAID set, deleting and recreating the RAID set, and smartctl scanning all disks. No change.
4.) gpart /dev/sdc returns some stuff but doesn't suggest that I can do much about it (just returns me to my prompt, doesn't stay in gpart interactive mode).
root@system:~# gpart /dev/sdc
Begin scan...
End scan.
Checking partitions...
Ok.
Guessed primary partition table:
Primary partition(1)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(2)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(3)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
Primary partition(4)
type: 000(0x00)(unused)
size: 0mb #s(0) s(0-0)
chs: (0/0/0)-(0/0/0)d (0/0/0)-(0/0/0)r
|
Well, after performing the following:
arcconf delete 1 logicaldrive all
arcconf tast start 1 device all intialize
arcconf CREATE 1 LOGICALDRIVE Name STORAGE1 blah..blah...
I now have what I'd expect:
root@system:~# lsscsi -s | grep Adaptec
[0:0:0:0] disk Adaptec STORAGE1 V1.0 /dev/sda 11.9TB
[7:0:0:0] disk Adaptec STORAGE2 V1.0 /dev/sdc 11.9TB
Problem solved. Hardware seems fine.
| Can I reclaim "unrecoverable partition" on storage device (RAID set) - no data recovery required |
1,554,377,940,000 |
Total space of sda3 is 80.2 GiB ( 29.8 + .218 + 3.7 + 30 + 6.3 = 70.018 )
I don't understand where is the rest 80.2 -70.018 = 10.182 GB
[root@centos ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 30G 6.0G 24G 21% /
devtmpfs devtmpfs 7.7G 0 7.7G 0% /dev
tmpfs tmpfs 7.8G 43M 7.7G 1% /dev/shm
tmpfs tmpfs 7.8G 18M 7.7G 1% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-home xfs 30G 21G 9.3G 70% /home
/dev/mapper/centos-var xfs 6.3G 3.7G 2.7G 58% /var
/dev/mapper/centos-boot xfs 221M 175M 47M 80% /boot
tmpfs tmpfs 1.6G 32K 1.6G 1% /run/user/1000
/dev/sdb5 vfat 29G 757M 29G 3% /run/media/mukesh/SANDISK
/dev/sdc1 fuseblk 2.8T 269G 2.5T 10% /run/media/mukesh/Elements
/dev/sda6 fuseblk 199G 121G 78G 62% /run/media/mukesh/Local Disk SSD
/dev/sda5 fuseblk 119G 109G 10G 92% /run/media/mukesh/Local Disk SSD1
/dev/sda2 fuseblk 70G 59G 12G 84% /run/media/mukesh/Local Disk SSD2
fdisk /dev/sda output :
Command (m for help): p
Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x5a508cde
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sda2 208896 145287167 72539136 7 HPFS/NTFS/exFAT
/dev/sda3 145287168 313476344 84094588+ 83 Linux
/dev/sda4 313476345 976771071 331647363+ f W95 Ext'd (LBA)
/dev/sda5 313476408 561230774 123877183+ 7 HPFS/NTFS/exFAT
/dev/sda6 561231872 976771071 207769600 7 HPFS/NTFS/exFAT
vgdisplay -v output
Using volume group(s) on command line.
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
Act PV 1
VG Size 70.02 GiB
PE Size 4.00 MiB
Total PE 17926
Alloc PE / Size 17925 / 70.02 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID DLdDuG-mytg-aMZs-OaJ3-CRzG-2z4r-sp5Btf
--- Logical volume ---
LV Path /dev/centos/boot
LV Name boot
VG Name centos
LV UUID Q2XDnm-UxsM-XY0q-BbR1-6tOD-zLKu-1Jduhk
LV Write Access read/write
LV Creation host, time localhost, 2016-03-03 22:26:22 +0530
LV Status available
# open 1
LV Size 224.00 MiB
Current LE 56
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID R4x09z-Mt0a-T9TW-VIEj-bfNX-Lf5G-lpJYhP
LV Write Access read/write
LV Creation host, time localhost, 2016-03-03 22:26:22 +0530
LV Status available
# open 1
LV Size 29.80 GiB
Current LE 7628
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID 9mkF24-VeHW-luVs-UF62-yQTG-3Lj0-6tgx6m
LV Write Access read/write
LV Creation host, time localhost, 2016-03-03 22:26:23 +0530
LV Status available
# open 1
LV Size 30.00 GiB
Current LE 7679
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
--- Logical volume ---
LV Path /dev/centos/var
LV Name var
VG Name centos
LV UUID pmsJiw-HqoT-dqyi-XaEc-JT8v-bU07-hf16Xn
LV Write Access read/write
LV Creation host, time localhost, 2016-03-03 22:26:23 +0530
LV Status available
# open 1
LV Size 6.28 GiB
Current LE 1608
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID rdlDnE-t62f-LMAo-l4ao-GkDq-6Iy9-sJ7BIm
LV Write Access read/write
LV Creation host, time localhost, 2016-03-03 22:26:23 +0530
LV Status available
# open 2
LV Size 3.73 GiB
Current LE 954
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Physical volumes ---
PV Name /dev/sda3
PV UUID Iw7LYC-j6Bz-P1Lw-uqCz-kc0W-dElK-rqsQoI
PV Status allocatable
Total PE / Free PE 17926 / 1
|
Your PV is 17926 physical extents large (with 4MiB PEs, that's 70.02 GiB), which means it doesn't take the full extent of the partition.
Possibly the partition was enlarged after the PV was created. You should be able to use pvresize to let it stretch to the full extent of the partition.
BTW, vgs, lvs and pvs are good commands to quickly show allocation in VG/LV/PVs.
See also pvs --units B -o all | less -S for precise and complete information about PVs.
| Is there some free space on this sda3 partition? |
1,468,249,506,000 |
I have a bootable USB stick as shown in the screenshot:
# dd if=/path/to/os_image.iso of=/dev/sdb
(...everything OK...)
# sudo dumpe2fs /dev/sdb
dumpe2fs 1.42.9 (4-Feb-2014)
dumpe2fs: Bad magic number in super-block while trying to open /dev/sdb
Couldn't find valid filesystem superblock.
GParted doesn't recognize any partitions.
The GUI file manager reports the filesystem as isofs. The system boots and everything works fine.
The problem is, I want to use the USB stick for a live OS and as a storage with PCs and TVs which only recognize FAT32 and NTFS.
I have tried creating two partitions, doing dd on sdb1 and making sdb1 the only bootable partition, but the system didn't boot.
How to put both FAT32/NTFS and (any) bootable ISO image on an MBR-partitioned disk without using an external bootable USB creator program? I would like to simply use dd, as I do now.
Presumably this could be solved using the right bootloader with the right configuration. I just don't know which bootloader and what configuration.
|
Bootable usb thumb drive with 2 partitions.
Windows and others may only see the first partition on a usb device even when there are multiple partitions. Therefore make your first primary partition the fat32 or NTFS partition so windows can see and use it.
partition 1 - ntfs or vfat
partition 2 - ext4
The second partition is where you will store the bootable iso.
Use grub to load and select what live OS you want to use.
steps:
1: zero out partition table
sudo dd if=/dev/zero of=/dev/sdx bs=512 count=4
2: Create partitions (use cli “fdisk” or gui “gparted”)
create partition table "msdos"
create 2 partitions
p1 = ntfs
p2 = ext4 -- tag as bootable.
format partitions.
3: Install grub bootloader to usb device
sudo grub-install --boot-directory /mnt/usbp2/boot /dev/sdx
Verify: If these exist all is well so far...
/mnt/usbp2/boot/grub/fonts -- minimum unicode.pf2
/mnt/usbp2/boot/grub/i386-pc -- *.mod modules to load in you grub.cfg
/mnt/usbp2/boot/grub/local -- languages
/mnt/usbp2/boot/grub/grubenv -- environment variable storage
4: Create a grub.cfg file for the OS's on this pc
sudo grub-mkconfig --output=/mnt/usbp2/boot/grub/grub.cfg
Test by booting to usb
5: Copy support files to the usb
iso files
memdisk binary -- get from syslinux
grub.cfg -- custom for your usb stick. Overwrite grub.cfg created by grub-mkconfig
Note: each live iso may require different grub information.
Note: If you only get a grub command line, your grub.cfg probably contains errors. Go minimal to start.
6: Create your custom usb boot installer.
Copy the MBR and Partition Table
dd if=/dev/sdx of=/custom_boot/cb_mbr.img bs=512 count=1
Copy the bootable partition
dd if=/dev/sdx2 of=/custom_boot/cb_ext4.img bs=512
7: Create new bootable usb device
Delete all existing partitions and clean MBR
fdisk or gparted (delete partitions)
dd if=dev/zero of=/dev/sdx bs=512 count=1
restore MBR and Partition Table
dd if=/custom_boot/cb_mbr.img of=/dev/sdx bs=512
Restore bootable partition
dd if=/custom_boot/cb_ext4.img of=/dev/sdx2 bs=512
Fix the first partition and reformat (fat32 or ntfs)
fdisk or gparted
My grub.cfg
My Notes
| FAT32 / NTFS + isofs on USB flash drive |
1,468,249,506,000 |
I have a server with two HDDs (/dev/sda and sdb) with 1.8TB each.
On both disks, there is a 500MB Swap and an 800GB partition, that are in a raid md0 and md1:
pvs
PV VG Fmt Attr PSize PFree
/dev/md1 vg0 lvm2 a-- 799,87g 63,87g
I am root in Dom0 and created a new partition /dev/sda3 in the former free space with cfdisk. Now it looks like:
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1050624 1048577 512M fd Linux raid autodetect
/dev/sda2 1052672 1678774272 1677721601 800G fd Linux raid autodetect
/dev/sda3 1678776320 3907029167 2228252848 1T 83 Linux
I want to use this free space as backupspace, so I don't want a raid here, but I cannot create a filesystem on /dev/sda3 now:
$ mkfs.ext4 /dev/sda3
mke2fs 1.42.12 (29-Aug-2014)
The file /dev/sda3 does not exist and no size was specified.
And it doesn't appear in
# ls -l /dev/sda*
brw-rw---- 1 root disk 8, 0 Mai 24 22:07 /dev/sda
brw-rw---- 1 root disk 8, 1 Mai 24 22:07 /dev/sda1
brw-rw---- 1 root disk 8, 2 Mai 24 22:07 /dev/sda2
How can I create a non-raid filesystem now in /dev/sda3?
|
You need to tell the kernel that the partition table has changed after you make any changes to partition tables with fdisk, cfdisk, or parted etc.
There are two main ways of doing this:
Reboot. The kernel will detect the new partition table and use it automatically.
run partprobe as root. This will tell the kernel to scan the block-device partitions and update its internal partition table records.
partprobe is in the parted package. apt-get install parted
Until you do this, there will be no device node for the new parition(s) in /dev, so you will not be able to run mkfs to format it.
| Create a new volume on free diskspace from inside Dom0 |
1,468,249,506,000 |
I partitioned a MMC card into multiple partitions (in GPT format), and the very first partition is just padding space so that all other partitions are aligned to a optimal boundary.
Problem is, on boot Linux always tries to mount the first partition, which is almost guaranteed to fail, which 1) takes time, 2) if it should succeed, behavior is highly undefined.
Is there a flag I can set for the partition, or a config file that I can change, to prevent certain partitions of certain block devices from being mounted?
|
Use the option noauto in /etc/fstab for that mount point to make sure the init process will not mount it at boot.
You might have a line like this in /etc/fstab :
/dev/sda1 /mnt/your_partition ntfs-3g defaults,noauto 0 0
| How to mark a partition as unmountable? |
1,468,249,506,000 |
I need partitioning my USB stick into two parts.
Specifically my aim is to install Windows-to-go on the second partition and use the first one as a multiboot device for my Linux distros; these distros are already installed on it and so I prefer not to delete the current partition, if possible, so I would like to resize it only without affecting the files.
This is what I've been trying to do so far:
I inserted my USB stick, I could open and explore the files and even copypaste them on it, create folders and so on, so apparently it doesn't have any problem.
I run Gparted on Kali Linux and selected the device, it could see it but an exclamation mark appeared on it and when I right-clicked and tried to resize the current partition I couldn't do it.
By clicking on the exclamation mark I got the following errors (see the message into the grey window in the middle, it says that the device is not mounted ):
At the end of the message it also says that I probably miss two packages (dosfstools and mtools), then I run apt-get install to get them but it seems they are already installed.
Furthermore, on the terminal I run parted -l and fdisk -l and obtained the following outputs:
1) parted -l gives ->
Model: ATA ST1000LM024 HN-M (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 968GB 968GB primary ntfs boot
2 968GB 1000GB 32,2GB extended
5 968GB 999GB 30,9GB logical ext4
6 999GB 1000GB 1356MB logical linux-swap(v1)
Model: ATA INTEL SSDSC2CW06 (scsi)
Disk /dev/sdb: 60,0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 105MB 104MB primary ntfs boot
2 106MB 60,0GB 59,9GB primary ntfs
Model: KINGSTON DataTraveler 3.0 (scsi)
Disk /dev/sdc: 15,6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0,00B 15,6GB 15,6GB fat32
2) fdisk -l gives ->
Disk /dev/sdb: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders, total 117231408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x26443af5
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 204799 101376 7 HPFS/NTFS/exFAT
/dev/sdb2 206848 117227519 58510336 7 HPFS/NTFS/exFAT
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xfe2335fe
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1890607103 945302528 7 HPFS/NTFS/exFAT
/dev/sda2 1890609150 1953523711 31457281 5 Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5 1890609152 1950873599 30132224 83 Linux
/dev/sda6 1950875648 1953523711 1324032 82 Linux swap / Solaris
Disk /dev/sdc: 15.6 GB, 15552479232 bytes
64 heads, 32 sectors/track, 14832 cylinders, total 30375936 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x20ac7dda
This doesn't look like a partition table
Probably you selected the wrong device.
Device Boot Start End Blocks Id System
/dev/sdc1 ? 3224498923 3657370039 216435558+ 7 HPFS/NTFS/exFAT
/dev/sdc2 ? 3272020941 5225480974 976730017 16 Hidden FAT16
/dev/sdc3 ? 0 0 0 6f Unknown
/dev/sdc4 50200576 974536369 462167897 0 Empty
Partition table entries are not in disk order
|
From the above output (repeated below) the USB device does not contain a partition table. Instead the device is formatted entirely with the fat32 file system starting at 0. This means that no space was left at the start of the device for a partition table.
Model: KINGSTON DataTraveler 3.0 (scsi)
Disk /dev/sdc: 15,6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0,00B 15,6GB 15,6GB fat32
If you wish to work with devices without partition tables then use at least GParted v0.22.0. Currently the most recent version of GParted is 0.25.0.
| partitioning a usb stick with gparted |
1,468,249,506,000 |
I have Manjaro Linux installed on my laptop. When I log in I get a message
Only 0.22GB or 28.71 GB left on /
Previous suggestions were to run Pacman -Scc to clear the pacman cache, and that worked for a while, but now its still warning me after I do that.
I opened up GParted to look at the partitions, and I basically have one large Partition for the system.
Running df -h shows the following (which doesn't match what I see in GParted):
Filesystem Size Used Avail Use% Mounted on
dev 1.9G 0 1.9G 0% /dev
run 1.9G 1.1M 1.9G 1% /run
/dev/mapper/ManjaroVG-ManjaroRoot 29G 28G 226M 100% /
tmpfs 1.9G 104K 1.9G 1% /dev/shm
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 1.9G 56K 1.9G 1% /tmp
/dev/sda3 248M 97M 139M 42% /boot
/dev/mapper/ManjaroVG-ManjaroHome 426G 122G 283G 31% /home
/dev/sda2 99M 356K 99M 1% /boot/efi
tmpfs 385M 20K 385M 1% /run/user/1000
This /dev/mapper/ partitions are new to me. Can someone explain how they work, and how I can resize them?
|
These are logical volumes, so you can resize them using lvresize.
However, that is just the resizing of the underlying block device, you still have to resize the filesystem on top of it, and the way to do this will depend on the filesystem type and its initial configuration.
Most commonly used Linux filesystems support online resizing, ext2-based use resize2fs and xfs uses xfs_growfs.
| Low disk space on Manjaro / , how to resize /dev/mapper/ partitions? |
1,468,249,506,000 |
Why am I getting inconsistent/conflicting pictures of the DATA partitions that were created in the CentOS 7 installation process when I use df -T -h, parted ... print, and fdisk -l? In case it matters, used xfs file system because that was the default.
The Background of the process is:
During a recent installation of CentOS 7, I chose Manual Partitioning in the Installation Destination part of the process. The tutorial in this link contains screen shots illustrating the installation process, and the screen in the process where the DATA partitions are created is shown below (from the same tutorial).
(source: tecmint.com)
In the above screen shot, my installation wizard automatically created a /home DATA partition. I shrunk the auto-created /home partition, and created four new 300 GB DATA partitions called /public, /vpn, /data, and /test using the screen shown in the screen shot, and I then completed the installation.
df -T -h results:
In the resulting installation, typing df -T -h results in:
[root@localhost ~]# df -T -h
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 1016M 49G 2% /
devtmpfs devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs tmpfs 3.8G 17M 3.8G 1% /run
tmpfs tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/sda2 xfs 494M 139M 355M 29% /boot
/dev/mapper/centos-home xfs 605G 33M 605G 1% /home
/dev/sda1 vfat 200M 9.8M 191M 5% /boot/efi
/dev/mapper/centos-01 xfs 280G 33M 280G 1% /public
/dev/mapper/centos-02 xfs 280G 33M 280G 1% /data
/dev/mapper/centos-03 xfs 280G 33M 280G 1% /test
/dev/mapper/centos-00 xfs 280G 33M 280G 1% /vpn
**parted ... quit results:
However, parted does not seem to see the four new DATA partitions, as shown below:
[root@localhost ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA WDC WD20EZRX-00D (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 211MB 210MB fat16 EFI System Partition boot
2 211MB 735MB 524MB xfs
3 735MB 1912GB 1911GB
fdisk -l results:
The fdisk -l results seem to be a blend of the parted and df results shown above, but here treating the four new partitions as a separate category:
[root@localhost ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 3734071295 1.8T Microsoft basic
Disk /dev/mapper/luks-49495fd0-6120-48d9-915a-d88903765021: 1911.1 GB, 1911107354624 bytes, 3732631552 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-swap: 8187 MB, 8187281408 bytes, 15990784 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-home: 649.2 GB, 649223733248 bytes, 1268015104 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-00: 300.0 GB, 299997593600 bytes, 585932800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-01: 300.0 GB, 299997593600 bytes, 585932800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-02: 300.0 GB, 299997593600 bytes, 585932800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/centos-03: 300.0 GB, 299997593600 bytes, 585932800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
(parted) quit
|
It appears you chose to use logical volumes (LVM) rather than partitions. These are not partitions, and are managed using a different mechanism.
Try using an LVM command like sudo lvm lvs. This should list the logical volumes.
| why are DATA partitions not consistently reported in CentOS 7? |
1,468,249,506,000 |
I have a 32GB USB drive with 2 partitions,
Partition 1: FAT32 used as storage
Partition 2: ext4 intended to be a bootable live Ubuntu 15.04.
How can I install the Ubuntu ISO file to the ext4 partition on the USB drive and make it bootable?
I tried booting DamnSmallLinux and DSL-N from another 512MB USB drive I have but couldn't find how to make this work.
I'm running Windows 7 on desktop PC and OS X Yosemite 10.10.4 on laptop.
|
Okay, if I get you right dd is what you need (comes with OS X). You can create bootable USB with the following command:
dd if=/path/to/your/ubuntu.iso of=/dev/xxx bs=4M
(Make sure you saved all necessary data from USB)
Replace xxx in /dev/xxx with your USB device. You can list devices with diskutil list command to find out which one is your USB.
After following this steps you will get bootable USB with Ubuntu and some unallocated free space. So you will be able to boot from it and create some additional partitions on it with GParted.
If you want to install Ubuntu on your USB you should create bootable USB first anyway. Then you can boot from it and install Ubuntu on another USB drive following any Ubuntu installation tutorial on youtube.
| How to install Ubuntu on a USB drive ext4 partition? |
1,468,249,506,000 |
I just installed Linux Mint Maya (13.2) onto a USB stick with uNetbootin (http://sourceforge.net/projects/unetbootin/). The install seems to work ok, and has a "persistence" partition which allows changes to persist between sessions.
One thing which is weird is that i can't do df to see the available space:
$ df -h
df: cannot read table of mounted file systems: Is a directory
I assume it's talking about /etc/mtab, and indeed when i look at mtab i can see it's not a file, it's a directory:
$ ls -l /etc
....
-rw-r--r-- 1 root root 63 Jul 29 13:16 fstab
drwxr-xr-x 2 root root 3 Mar 30 2012 fstab.d
....
drwxr-xr-x 2 root root 4096 Jul 29 12:03 mtab
-rw------- 1 root mint 0 Jul 29 11:43 mtab.fuselock
....
(i've just listed entries which i think are relevant). When i look in /etc/ls -l mtab there's lots of links:
$ ls -l /etc/mtab
total 0
lrwxrwxrwx 1 root root 18 Jul 29 11:29 ex -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:29 ex.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 14 Jul 29 12:03 gnome-text-editor -> /usr/bin/gedit
lrwxrwxrwx 1 root root 30 Jul 29 12:03 gnome-text-editor.1.gz -> /usr/share/man/man1/gedit.1.gz
lrwxrwxrwx 1 root root 29 Jul 29 11:42 gnome-www-browser -> /usr/bin/google-chrome-stable
lrwxrwxrwx 1 root root 29 Jul 29 11:42 google-chrome -> /usr/bin/google-chrome-stable
lrwxrwxrwx 1 root root 18 Jul 29 11:28 rview -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 rvim -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vi -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:28 vi.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 18 Jul 29 11:29 view -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:29 view.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vim -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vimdiff -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 29 Jul 29 11:42 x-www-browser -> /usr/bin/google-chrome-stable
fstab seems normal, FWIW.
$ cat /etc/fstab
overlayfs / overlayfs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0
Does anyone know
1) what's going on with mtab here?
2) how i can fix it without cocking up my USB install (which has taken me ages to get working up to this point)
thanks! max
EDIT: (too long-winded for a comment) This is in response to an answer by @Celada pointing out that /etc/mtab looks like it's holding the contents of /etc/alternatives: that's right, it does!
/etc/alternatives is there as well, and has everything that's in /etc/mtab, plus lots more. (i've checked this by copying the contents into an array and subtracting one from the other).
Looking at the contents of /etc/mtab, the lines in there all refer to software i have installed since first booting the usb stick install: namely, vim, (full version instead of the 'mini' one that comes with the install) chrome and gedit (a text editor). As i said these lines are all in /etc/alternatives too.
I've done the following:
$ sudo mv /etc/mtab /etc/mtab_BACK
$ sudo ln -s /proc/mounts /etc/mtab
and now i can df again:
$ df -h
df: `/cow': No such file or directory
df: `/home/max/.gvfs': Transport endpoint is not connected
Filesystem Size Used Avail Use% Mounted on
rootfs 4.0G 872M 2.9G 23% /
udev 1.2G 4.0K 1.2G 1% /dev
tmpfs 465M 984K 464M 1% /run
/dev/sdb1 15G 5.0G 9.8G 34% /cdrom
/dev/loop0 869M 869M 0 100% /rofs
/cow 4.0G 872M 2.9G 23% /
tmpfs 1.2G 16K 1.2G 1% /tmp
none 5.0M 0 5.0M 0% /run/lock
none 1.2G 144K 1.2G 1% /run/shm
The error message at the top is confusing: /cow is listed (this is the persistence partition i think) but the error says df: '/cow': No such file or directory. Is this a problem do you think?
|
The file listing of /etc/mtab appears to belong to /etc/alternatives! Is there any way you could have accidentally renamed /etc/alternatives to /etc/mtab?
Is /etc/alternatives missing? If so, then the fix is just to rename /etc/mtab back to /etc/alternatives. If not, then you are stuck with the problem of merging the contents of the real /etc/alternatives with the /etc/mtab which is supposed to be /etc/alternatives.
Once /etc/mtab is moved out of the way, the easiest thing to do would be to just recreate it as a symlink to /proc/mounts:
ln -s /proc/mounts /etc/mtab
| Linux Mint on USB - mtab is a folder, not a file |
1,468,249,506,000 |
I would like to know the benefits & usage of creating separate partitions for different areas like swap, /, /boot, /home, /var etc. How much size should i assign to them ?
Although i want to install separate /home & / partition since i may need to try different distros. So, creating separate / & /home will be helpful there but do i need to create other partitions separately also ?
|
There is generally no benefit to creating further partitions. Having a separate swap partition used to be the only way to have swap on linux ( a really long time ago ), and the habit still sticks around. You can use a swap file instead though. The reason for a separate /boot is if your bios is broken and can not access the entire disk, then you need to have /boot in the early part of the disk where the bios can reach it. A /var partition is really only useful if for some reason, you want to normally run with your root mounted read only, which is rather unusual these days.
| Separate Partitions usage [closed] |
1,468,249,506,000 |
I would like to execute the Linux command "parted" through a C language function?
I am using Linux Ubuntu , eclipse.
Thanks!
|
In theory, in your C program, you should add a line like this:
int res = system("/bin/parted <options>");
The C program must be executed with root privileges (or run through sudo). The res variable contains the result of the command (see man system for details).
As an alternative, use a command of the exec family (see man exec for details).
For instance, this should read the partition table for the /dev/sdb disk.
#include <stdlib.h>
int main(int argc, char **argv)
{
int res = 0;
res = system("/bin/parted -s /dev/sdb print > /var/log/mypartedlist.txt");
if (res == -1) /* command not executed */
exit(1);
else /* command ok */
{
if (WIFEXITED(res))
{
if (WEXITSTATUS(res) == 0)
printf("Command executed ok\n");
else
printf("Command had a trouble\n");
}
else
{
printf("Problems running system\n");
exit(2);
}
}
}
| How do I execute a parted command with a C function? |
1,468,249,506,000 |
In the texts I study (like: LPIC_1 study guide by R.W. Smith), the linux partitions have been introduced directories split as /home, /boot, /usr and /etc...
Looking at what lsblk returns as follows:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 100M 0 part
├─sda2 8:2 0 195.2G 0 part
├─sda3 8:3 0 146.5G 0 part /run/media/user/28082EC8082E953A
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 500M 0 part /boot
└─sda6 8:6 0 123.5G 0 part
├─fedora-swap 253:0 0 7.9G 0 lvm [SWAP]
...
We can see SCSI drivers and their partitioning tree and their mount points (which were introduced as common partitions in linux as mentioned above.)
I'm kind of confused by the concept of partitioning in linux. Do we call the logical partitions of the physical disks (sda, sdb) partitioning or the directories such as /home or /boot or...?
If logical partitions of physical disks (sda1, sdb1 and ...) are the partitions, what do files like /dev/sda2 represent?
|
The logical partitions (like sda1, sda2) of the physical disks (like sda, sdb) are the partitions. So partitioning is the task of modifying the partition tables of these physical disks. The Folders are only mount points where you can mount the partitions. I guess because the most partitions have a specific mount point (like /home) its obvious to name the partions after there mountpoint. Like /dev/sda1 is mounted to /home so thats now our home partition or /home partition.
The /dev directory contains among other things the software representaion of the hardware devices: en.wikipedia.org/wiki/Device_file#Block_devices sda1 is the partition but the the coresponding software interface is /dev/sda1 ... And because its a direct representation you can call /dev/sda1 a partiton too.
| How are logical partitions represented in Linux? |
1,468,249,506,000 |
I have a NTFS hard drive internally attached to my computer and it's causing problems with the other Windows installation on my dual (or triple?) boot machine.
I'm not sure if the partition scheme is GPT or MBR, but how can I create a backup of the partition table using dd and then wipe it from the drive so it isn't recognized by the other Windows as it starts up?
|
To backup DOS label (MBR) use this:
dd if=/dev/sdX of=mbr bs=512 count=1
To backup GPT label use this:
dummy=$(parted -ms /dev/sdX print | tail -1| cut -b1)
size=$((128 * dummy + 1024))
dd if=/dev/sdX of=gpt bs=1 count=$size
To wipeout the labels use this:
dd if=/dev/zero of=/dev/sdX bs=Y count=Z
partprobe /dev/sdX
HTH
| Backup and then wipe partition table from head of drive |
1,468,249,506,000 |
I have a CentOS system that has 508 G free space.
I want to create a new partition from it.
It locates in extended partition.
I create new partition and format it as anything (ext4, fat32), after apply it can't finish the process and gives me this error:
An error occurred while applying the operations
See the details for more information.
IMPORTANT
If you want support, you need to provide the saved details!
See http://gparted.sourceforge.net/larry/tips/save_details.htm for more information.
and when I save the save_details.htm it contains this information:
GParted 0.6.0
Libparted 2.1
Create Logical Partition #1 (fat32, 508.23 GiB) on /dev/sda 00:00:01 ( ERROR )
calibrate New Partition #1 00:00:00 ( SUCCESS )
path: /dev/sda-1
start: 184424448
end: 1250263039
size: 1065838592 (508.23 GiB)
create empty partition 00:00:01 ( ERROR )
libparted messages ( INFO )
WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
========================================
I used fdisk and created /dev/sda6, and I see partitions like this:
$ sudo fdisk -l
Disk /dev/sda: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xa62a8bc3
Device Boot Start End Blocks Id System
/dev/sda1 * 1 262 2097152 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 262 5361 40960000 83 Linux
/dev/sda3 5361 10460 40960000 83 Linux
/dev/sda4 10460 77826 541113344 5 Extended
/dev/sda5 10461 11480 8192000 82 Linux swap / Solaris
/dev/sda6 11480 77825 532917056+ 83 Linux
Partition 6 does not start on physical sector boundary.
but when I use mkfs to format it I see this error:
$ sudo mkfs -t ext4 /dev/sda6
mke2fs 1.41.12 (17-May-2010)
Could not stat /dev/sda6 --- No such file or directory
The device apparently does not exist; did you specify it correctly?
What is the problem?
|
You Should inform kernel about the changes made to the disk. for that you need to run partprobe.
# partprobe /dev/sda6
Then you should run mkfs.ext4 to assign the filesystem to the newly created partition.
# mkfs.ext4 /dev/sda6
In this way your partition is ready to mount
# mount /dev/sda6 /mountpoint
| Can not create new partition |
1,468,249,506,000 |
I have an vmware ext4 file system that non-lvm, non-partitioned file system that resides on a virtual 300GB disk. In other words, there is no partition and the file system was probably created by:
mkfs.ext4 /dev/sdd1
The disk is barely used (1%) but I would like to keep the data on it. Is there a safe way to shrink it? I was thinking of resizing the disk in Vmware from 300 to 100 and running resize2fs /dev/sdd1 but am not certain if I will not lose anything on it.
Any pieces of advice would be highly appreciated.
P.
|
Your question is inconsistent: if there's a partition, the filesystem was created by a command like mkfs.ext4 /dev/sdd1. If there's no partition, the filesystem was created by a command line mkfs.ext4 /dev/sdd. Check the output of df /path/to/some/directory/on/that/filesystem to see which one it is.
Either way, you can call resize2fs to shrink the filesystem. This is independent of any use of LVM. You can only shrink the filesystem while it's unmounted, so if it's your root filesystem, you need to do that from a rescue system. Note that the disk letter might be different in the rescue system, e.g. sdb instead of sdd.
After shrinking the filesystem to the desired size, if it's on a partition, you need to shrink the partition. You can use fdisk for that, but it's a bit delicate: you need to delete and recreate the partition, making sure that you don't change its start location. You can also use parted, which combines filesystem resizing and partition resizing, but it's also cumbersome to use because you need to compute the target start address.
After this, you can shrink the size of the disk image in VMware. Make sure that the filesystem (and partition, if applicable) fit inside the disk image; if there's a partition, remember that the partition table uses an extra 512B at the beginning.
| Shrink/reduce non-lvm disk file system |
1,468,249,506,000 |
I'm trying to shrink a partition on a 64GB SD Card down so that I can fit it on a 32GB USB thumb drive, but I'm not having any success. I have the SD card plugged into a USB adapter, which is plugged into a Raspberry Pi running Raspbian.
Here is the output of fdisk -l:
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c262
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 15523839 7700480 83 Linux
Disk /dev/sda: 63.9 GB, 63864569856 bytes
4 heads, 32 sectors/track, 974496 cylinders, total 124735488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000798a3
Device Boot Start End Blocks Id System
/dev/sda1 4096 147455 71680 c W95 FAT32 (LBA)
/dev/sda2 151552 124735487 62291968 83 Linux
It's /dev/sda2 that I want to shrink, but when I try resize2fs /dev/sda2 20G I get:
resize2fs 1.42.5 (29-Jul-2012)
resize2fs: Bad magic number in super-block while trying to open /dev/sda2
Couldn't find valid filesystem superblock.
I also tried shrinking the partition first via fdisk and then running resize2fs, but it failed with the same error message.
How can I shrink my partition?
PS. I have already imaged the card so I can restore should anything go wrong.
|
I don't understand the problem.
If the motivation for shrinking the partition is that you want to move it to another physical storage then the "shrinking magic" is:
create the partition on the target storage
format the new partition
mount the partition (and the source partition)
cp -a /path/to/source/. /path/to/target
Much faster, much easier, less dangerous, clean filesystem.
| Shrinking a partition |
1,468,249,506,000 |
I'm about to get a Linux laptop with Ubuntu preinstalled. Among my first tasks will be a dual-boot installation of Linux Mint. From what I can tell, the following seems like an okay partition structure:
Partition 1: / [ Root partition for Ubuntu ]
Partition 2: / [ Root partition for Mint ]
Partition 3: Swap [ Shared between the systems ]
Partition 4: Other shared data
The root partitions would contain the standard directory hierarchies. Partition 4 would be used for /tmp and Dropbox data, plus whatever other data might be convenient to share among an arbitrary number of distros.
Is this a reasonable plan?
(Sorry if this is a dup. I'm not finding anything quite like it here.)
|
My proposed partitions are working fine. The caveat, as I understand it, is that a shared swap partition might be dicey if you hibernate one distro and switch to the other. I don't do that, so it's not an issue.
| Safe Linux dual-boot partitioning? |
1,468,249,506,000 |
I'm trying to install FreeBSD 9.1-i386 in VMware Workstation.
I'm following the guide in the manual on freebsd.org to do this.
When I come to the partitioning part I use the guided setting and it looks as following:
After this I commit the changes and it passes all the checksums. After this it reboots, I don't know if this is normal behavior or not but I think so.
Anyway, when it tries to boot I get the error below. I tried to solve it based on something I found online but it didn't work:
|
From my experience, the 9.x installer is a mess. Kept losing labels for the GPT partitions I wanted to create.
I had to partition the disk manually, create the destination fstab entries by hand, and only then use the installer to copy the data. And this last step could have been done manually as well.
In here you get a detailed step by step guide to use the installer.
If you want to setup the disk manually, you can make use of this tutorial
| Can't boot after installing FreeBSD in VMware Workstation |
1,468,249,506,000 |
I installed Ubuntu 12.10 on my SSD. /dev/sda1. No other partitions. No swap.
Then I went about reading how to optimize usage, and have come to the conclusion I want my /home, /var and /tmp mounted on my hard disk drive. I don't have it mounted yet, but I have a line in my fstab that lists the UUID of my HDD and has it (/dev/sdb1) mounted in /media/hdd. Hard disk too, no partitions. Just plain disk space.
I do NOT want to create partitions on either my SSD or HDD. All I want however, is to move my /tmp, /home and /var partitions to my HDD.
What are my options to do this cleanly, preferably without using a LiveCD to login? (I am imagining I could use a LiveCD, literally do
mv /home /media/hdd/home
ln -s /media/hdd/home /home
mv /var /media/hdd/var
ln -s /media/hdd/var /var
mv /tmp /media/hdd/tmp
ln -s /media/hdd/tmp /tmp
What about permissions?
Is my thinking correct? Can I somehow use a mount --bind option to achieve the same?
|
The example you described in your question is going to be the only way I know how to do this without creating individual partitions on your HDD.
| Moving stuff off of SSD to HDD after installation. Using mount --bind? LiveCD? |
1,468,249,506,000 |
I've installed Fedora 18 Spherical Cow with the new installer and I created 3 partitions from free space on the hard drive (/, /boot and swap).
After I completed the installation, I figured out that there is 8G still free and I want to use it for a /home partition.
Is that possible now? How I do it?
Hard drive:
primary partition (for windows system) NTFS
logical partition ( for data ) NTFS
/boot partition (ext4)
LVM Volum group :
[ -Fedora-root partition (ext4)&
Fedora-Swap partition ]
And 8G free space.
|
Use cfdisk as root to create a partition in the free space. Provided the new partition is named, say, sda5, you have to create a filesystem on it with the
mkfs family of commands: 'mkfs.ext4 /dev/sda5' will work if you choose ext4. As for mounting, mount it on a temporary mountpoint, copy all your files from the present /home there, mount sda5 to /home, copy back, make it a permanent mount point by editing /etc/fstab and reboot. :)
| How to make "/home" partition after installation completed in Fedora 18? |
1,468,249,506,000 |
I have recently had an incident in which my /var/mail/spool/ file grew to the size of 32G (yes, that is gigabytes), completely filling its system partition (/dev/sda2) and most of what I saw inside were Hibernate messages.
When I tried to restart my laptop, I got an error message from the GUI saying that the system was unable to start. Then I went into the recovery mode (command-line only) and was able to shell into the system. I did some du investigation and found the above described anomaly. I deleted the file and then was able to log into X11 (KDE Desktop) fine.
My question is: Why does X11 on Fedora 16 rely on non-boot device for startup? Can it be configured to only use the boot device or is X11 considered almost like any other application? I would like to be able to at least get inside my D.E. even if all other disk partitions are unusable but the boot partition is.
RELATED:
Disk size management
|
If a filesystem fills up, that can cause all sort of grief. The graphical environment uses space for temporary files in /tmp and /var/tmp, in /var/log the system keeps logs (and if there isn't space it will cause problems). And so on. You should be able to log in in rescue mode (single-user mode, boot with kernel argument 1) and clean up.
| Why does X11 on Fedora 16 rely on non-boot device for startup? |
1,468,249,506,000 |
I want to reinstall Linux OS, and before that, I think I will partition my hard disk again. (I just use a simple one partition / for root, and make Linux automatically put all other directories there).
I often save software installations in /usr/local. So, my question is: suppose I create a new partition, /usr/local, and save data there; if I reinstall Linux again, can I continue to use this software and not need to install again?
I'm new to Linux World, so I'm not sure of these things.
|
My suggestion on this was, make a backup of whole root fs (including /usr/local), then re-partition, mount all partition, and extract everything.
After that all your files would stand, and your disk got re-partitioned.
If you simply backup /usr/local, there's a risk that once your system libraries get updated, those software (non-static ones) might need re-linking.
| Partition /usr/local : Can I use the software there after reinstall? |
1,468,249,506,000 |
Is right to create a filesystem without to create a partition table in external devices non-boot?
I've created directly a filesystem into a memory card (SD) and it has been mounted automatically when I inserted it.
|
Most FOSS *nices do not have an issue with partition tables on USB keys, SD cards, etc. It is typically the closed OSes (with one in particular) that act strange with such a configuration.
| Don't create partition schema in external devices |
1,468,249,506,000 |
I've seen instructions for shrinking the .vdi image for a Windows guest machine in VirtualBox 4.1.8. However, it used a tool to write zeroes to free space in the .vdi (nullfile-1.02.exe) that is for Windows only.
The page did say you should find a zerospace.c to do so in a Linux guest, but I can't find such a file any where on the Internet.
Does anyone here have experience shrinking VirtualBox Linux guests?
|
Writing zeroes to free space isn't difficult (even on Windows!). Just write a file containing zeroes, until you run out of space. On unix, it's a simple shell command:
cat /dev/zero >fill_er_up
rm fill_er_up
| Shrink a Linux guest .vdi in VirtualBox? |
1,468,249,506,000 |
I recently installed an setup an Ubuntu Server machine. It has two drives in it and the other drive has windows installed on it. (I didn't want to overwrite the windows installation until I had my server setup and working). Now I would like to format that hard drive so that I can use it as a remote time machine backup for my mac.
So my question is, how can I format that drive to be available from the server and also have grub forget about the windows installation? (all without affecting the existing ubuntu installation). Also keep in mind, I need this to either be a command line solution or something I can run from a usb drive.
Thanks!
|
From the command line: start a root shell (sudo -s). First, unmount the Windows partition if it's mounted. Then list the partitions on your system to see which one is the Windows partition:
fdisk -l
Given your disk arrangement, the Windows partition is likely to be /dev/sdb1 (first partition (1) of the second disk (b)). To confirm, run file - </dev/sdb1, which should report an NTFS filesystem.
Create a Linux filesystem on the partition:
mkfs.ext4 /dev/sdb1
Change the partition type (this isn't strictly necessary as Linux doesn't care, but having contradictory information is likely to be confusing):
fdisk /dev/sdb
t
1
83
w
Obtain the UUID of the newly created filesystem:
blkid -s UUID -o value /dev/sdb1
Edit /etc/fstab. Remove the entry corresponding to the former Windows filesystem, and add an entry corresponding to the new Linux filesystem.
UUID=01234567-89ab-cdef-0123-456789abcdef /BACKUPS ext4 errors=remount,ro 0 2
Mount the new filesystem with mount /BACKUPS (this will be performed automatically at boot time).
Finally, run update-grub to regenerate the Grub boot menu. Since the Windows installation has disappeared from the disk, it will disappear from the boot menu.
| Formatting secondary hard drive that has windows on it |
1,716,883,558,000 |
I am using the FreeBSD 14.0.
I follow the instructions at https://www.transip.eu/knowledgebase/entry/138-how-do-create-partition-freebsd/ to create a UFS partition, as below:
But always get "Invalid argument" error. The main problem is that the error does not provide enough details on which argument is invalid. So I totally get confused on this.
Thanks
|
I destroy the original MBR first:
gpart destroy da1
Then create GPT on the disk:
gpart create -s GPT da1
Then show the partition table
gpart show
Then create the new partition:
gpart add -t freebsd-ufs -b 40 -s 133120 da1
That completes successfully!
| gpart will always say "Invalid argument" when add a new ufs partition |
1,716,883,558,000 |
Problem Overview
I recently upgraded my remote server contract with IONOS, increasing my hard drive space from 8GB to 80GB. I have an Ubuntu OS running bash.
I then went about extending my working partition, following a tutorial here:
https://www.ryadel.com/en/resize-extend-disk-partition-unallocated-disk-space-linux-centos-rhel-ubuntu-debian/
All was OK, I wrote a new partition map, then rebooted my system. I waited a minute or two and then attempted to ssh into my server as usual. Problem. My ssh connection hangs, until eventually exiting with a time out.
Solution Attempts
At first, I reasoned the process of rebooting after a partition map change may take some time, and this was the cause of the timeout. After several more ssh attempts, this did not seem likely.
I used a 'KVM Console' provided in my IONOS console - here, the shell is in a state of (initramfs).
In attempting to diagnose the issue, I have tried the following:
Running: fsck /dev/sda1
Result: /dev/sda1: clean, 312/124672 files, 26890/124672 blocks
Running: fsck /dev/sda1
Result: fsck: error 2 (No such file or directory) while executing fsck.ext2 for /dev/sda2
Running: blkid
Result:
/dev/sda1: UUID="longString" TYPE="ext4" PARTUUID="520f1760-01"
/dev/sda2: PARTUUID="520f1760-02"
Running all of the following commands returns sh: command name: not found. These are:
vgdisplay -v vg00
parted -l /dev/sda
free -m
cfdisk
lvdisplay -v
fdisk /dev/sda
pvresize /dev/sda2
The output of cat proc/partitions is:
major minor #blocks name
8 0 83886080 sda
8 1 498688 sda1
8 2 83386368 sda2
11 0 1048575 sr0
From the above, I am confused why (2) returns no such file or directory - the entry sda2 is listed under the directory dev.
The output of cat /proc/cmdline is:
BOOT_IMAGE=/vmlinuz-5.4.0-132-generic root=/dev/mapper/vg00-lv01 ro apparmor=0
After entering lvm and then vgscan -ccc, the output is:
....
Start of output not visible in terminal window due to no scrolling
....
filter caching bad /dev/loop5
Opened /dev/loop6 RO O_DIRECT
/dev/loop6: size is 0 sectors
Closed /dev/loop6
/dev/loop6: Skipping: Too small to hold a PV
filter caching bad /dev/loop6
Opended /dev/loop7 RO O_DIRECT
/dev/loop7: size is 0 sectors
Closed /dev/loop7
/dev/loop7: Skipping: Too small to hold a PV
filter caching bad /dev/loop7
Will scan 3 devices skip 0
Checking fd limit for num_devs 3 want 35 soft 1024 hard 4096
Scanning 3 devices for VG info
Scanning submitted 3 reads
Processing data from device /dev/sda 8:0 fd 4 block 0x55b511a17cd0
Scan filtering /dev/sda
/dev/sda: using cached size 167772160 sectors
/dev/sda: Skipping: Partition table signature found
filter caching bad /dev/sda
/dev/sda: Not processing filtered
Processing data from device /dev/sda1 8:1 fd 5 block 0x55b511a17d10
Scan filtering /dev/sda1
/dev/sda1: using cached size 997376 sectors
/dev/sda1: Device is a partition, using primary device sda for mpath component detection
/dev/sda1: using cached size 997376 sectors
filter caching good /dev/sda1
/dev/sda1: No lvm label detected
Processing data from device /dev/sda2 8:2 fd 6 block 0x55b511a17d50
Scan filtering /dev/sda2
/dev/sda2: using cached size 166772736 sectors
/dev/sda2: Device is a partition, using primary device sda for mpath component detection
/dev/sda2: using cached size 166772736 sectors
filter caching good /dev/sda2
Label checksum incorrect on /dev/sda2 - ignoring
/dev/sda2: No lvm label detected
Scanned devices: read errors 0 process errors 0 failed 0
Found VG info for 0 VGs
Obtaining the complete list of VGs to process
No volume groups found
Unlocking /run/lock/lvm/P_global
_undo_flock /run/lock/lvm/P_global
Dropping VG info
lvmcache has no info for vgname "#orphans_lvm2" with VGID #orphans_lvm2.
lvmcache has no info for vgname "#orphans_lvm2".
lvmcache: Initialised VG #orphans_lvm2.
Completed: vgscan -vvv
The directory /etc/lvm/backup exists and contains:
vg00
The directory /etc/lvm/archive exists and contains:
vg00_00000-1647277590.vg vg00_00001-1228658393.vg
(3) and (5) give me hope - the location seems to be recognised, what would this suggest ?
Specific Steps Before Reboot
In summary, the steps I took before rebooting my system were:
ran fdisk /dev/sda and noted the start and end points of the file systems by entering p.
Deleted the file system map by entering d and then selecting sda2 with 2
Created a new partition map by entering n. Setting the partition type to primary.
I then entered the start and end locations for the new partition, as noted in step (1).
I changed the partition type, by entering t, and selecting the 2nd partition by entering 2.
I specified the partition type to be 'Linux LVM' by entering the HEX code 8e.
Before writing to the disk, I ensured start and end points were correctly listed by entering p. The start point matched that of the original partition. The end point matched that of the disk end point.
I wrote the partition map to disk by entering w.
I reboot the system with reboot.
The result of running lvm p prior to partition map changes was:
At this point I am not sure how to proceed - I have encountered a file system issue before and was troubled at the prospect of loosing all my files. Ultimately, in that case, the files were still present. From that experience I am restraining my assumption all is lost.
Does anyone have any suggestions, or tips to offer in terms of debugging this situation ? Please feel free to ask if you would like extra information regarding my setup.
Update
I have been able to boot into a knoppix CD on my remote server. Here, I have run fdisk -l which outputs:
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/cloop0: 1.83 GiB, 1960312832 bytes, 3828736 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/cloop1: 9.63 GiB, 10335027200 bytes, 20185600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/zram0: 1.45 GiB, 1560817664 bytes, 381059 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x520f1760
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 999424 167772159 166772736 79.5G 8e Linux LVM
I feel the final output lines, displaying the partition map for sda1 and sda2, are of interest. I believe the type of sda2 is correct as 8e (a Linux LVM), and the Start value correctly falls after the End of sda1.
Update II
Before attempting the below steps, I created a snapshot for backing up the system to its current state. I have now returned to this snapshot.
Attempting to restore from the /etc/lvm/backup/vg00 file (initramfs), first I ran pvcreate --restorefile /etc/lvm/backup/vg00 --uuid R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2 /dev/sda2. This returned:
WARNING: Couldn't find device with uuid `R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2.
Failed to clear hint file.
Physical volume "/dev/sda2" successfully created.
Then, I ran vgcfgrestore --file /etc/lvm/backup/vg00 which returned:
No command with matching syntax recognised.
Nearest similar syntax command has syntax:
vgfcgrestore -f:--file String VG
Restore VG metadata from specified file.
There seems to be an issue here.
|
You should examine the LVM VG metadata backup file /etc/lvm/backup/vg00 and find the original PV UUID of /dev/sda2 from there. It is a text file, and the PV UUID should be in a location like this: ([...] indicates some lines omitted for brevity)
[...]
vg00 {
[...]
physical_volumes {
pv0 {
id = "xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx"
device = "/dev/sda2" # Hint only
Once you know the PV UUID, you can use the backup file and the UUID to restore the PV UUID like this: (commands prefixed with lvm for use in initramfs environment; if you have extracted the VG metadata backup file from initramfs and do this in Knoppix, you can omit the lvm prefixes)
lvm pvcreate --restorefile /etc/lvm/backup/vg00 --uuid xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx /dev/sda2
Once the PV UUID is restored, you can restore the rest of VG metadata with:
lvm vgcfgrestore --file /etc/lvm/backup/vg00 vg00
After this, the VG should be good for activation:
lvm vgchange -ay vg00
If the VG activates successfully, and the filesystem within it can be mounted (with e.g. mount /dev/mapper/vg00-lvol1 /mnt), you should now be able to boot normally.
Once the system is running normally, you'll need two commands as root to achieve your original goal:
pvresize /dev/sda2
After this, pvs should indicate the sda2 PV is now successfully resized and vgs should indicate there is now plenty of unallocated space in vg00. To finally make use of it:
lvextend -r -l +100%FREE /dev/mapper/vg00-lvol1
and now df should indicate the root filesystem has plenty of free space again.
There is the command growpart (part of the cloud-guest-utils package in Debian, might be packaged separately as cloud-utils-growpart or just growpart in other distributions) which is specifically made to extend partitions safely and quickly, usually with no rebooting required.
In this specific case, the extension could have been achieved with just three commands:
growpart /dev/sda 2
pvresize /dev/sda2
lvextend -r -l +100%FREE /dev/mapper/vg00-lvol1
| Reboot into `initramfs` after altering partition table |
1,716,883,558,000 |
I am trying to install Debian to a partition on my SSD. Currently I have three partitions on my SSD:
Container disk1 - AFPS container
macOS AFPS Volume Group
Linux - PCI-Express Internal Physical Volume
Bootcamp - PCI-Express Internal Physical Volume
And I have created my installer with the ISO I'd like to use, and I've disabled secure boot. I've been able to boot to the grub installer, but I am not sure how to proceed on the partition step.
It displays the breakdown of my SSD (/dev/nvme0n1) including the fat32 partition for 250gb I created earlier using Disk Utility. But it seems that I need to set individual partitions singly to a journaling file system, a swap area, physical volume, etc.
What is the best way to proceed? Do I need to make additional partitions of variable size first? I do not want to overwrite or ruin my SSD GUID partition map because I want to be able to continue to boot optionally to macOS and Windows as I currently can. If the guided partitioning option will try to create an additional swap parition, then should I simply choose the manual option and attempt to only set the Linux parition to the mount point and manually set the swap partition to a new partition I can create ahead of time via disk utility? Any help would be appreciated- I am using the debian-handbook guide but am unsure of how the guided option will affect existing partitions in the map.
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 1.2 TB disk0s2
3: Microsoft Basic Data LINUX 249.6 GB disk0s3
4: Microsoft Basic Data BOOTCAMP 502.1 GB disk0s4
5: Windows Recovery 687.9 MB disk0s5
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +1.2 TB disk1
Physical Store disk0s2
1: APFS Volume macOS - Data 822.7 GB disk1s1
2: APFS Volume Preboot 2.1 GB disk1s2
3: APFS Volume Recovery 1.2 GB disk1s3
4: APFS Volume VM 3.2 GB disk1s4
5: APFS Volume macOS 9.8 GB disk1s5
6: APFS Snapshot com.apple.os.update-... 9.8 GB disk1s5s1
|
But it seems that I need to set individual partitions singly to a journaling file system, a swap area, physical volume, etc.
Those are just the partition types that are meaningful for Linux: you definitely don't need to have one of everything in the list. See Appendix C: Partitioning for Linux in Debian 12 Installation Guide:
At a bare minimum, GNU/Linux needs one partition for itself. You can have a single partition containing the entire operating system, applications, and your personal files. Most people feel that a separate swap partition is also a necessity, although it's not strictly true. [...]
For recommended partitioning schemes, see chapter C.3 of the same document.
You can technically run Linux without a swap partition, but because it's also used for suspending/hibernating, you will probably want one in a laptop.
Since a Intel Mac is a UEFI-firmware system, you will also need to mount the EFI System Partition (ESP for short, your disk0s1 in MacOS terms, /dev/nvme0n1p1 in Linux) to /boot/efi in Linux, without formatting it since it's already formatted for that and may contain the bootloaders for your other operating systems.
UEFI specification is designed to accommodate multiple OS's bootloaders on the same EFI System Partition, and the UEFI version of GRU and UEFI Windows Boot Manager all comply with the specification. MacOS sort of does its own thing, but in a non-conflicting way, so it's OK too.
The guided partitioning option is not really suited for dual/multi-boot installations: its primary purpose is to get quickly past the partitioning step when you are setting up a new system or VM for use with Linux only.
There would be one way to install Linux with swap and without making changes to the existing partitioning. That would be to use Linux LVM.
You would select manual partitioning, then specify that disk0s1 (nvme0n1p1 in Linux) should be mounted to /boot/efi and not formatted, and disk0s3 (nvme0n1p3 respectively) should be used as a LVM physical volume.
Then you should be able to proceed to the Configure LVM sub-menu, where you will first create a volume group using the single LVM physical volume you designated earlier, then you will able to sub-divide it to logical volumes for swap and a ext4 journaling filesystem for Linux root (/), sort of similar to how APFS sub-divides your disk0s2 to multiple APFS volumes.
The current recommendation for swap size when using hibernation seems to be: the swap space size should equal the amount of RAM plus the square root of the RAM amount.
You could create other logical volumes too, but if you are new to Linux, perhaps you should start with a simple layout first. Using LVM will make it easier to resize the Linux filesystems or the swap area if necessary, and will allow you to easily incorporate additional partitions to the same volume group if you e.g. decide to abandon the use of Windows at some future time.
| Debian GRUB installer partitioning step - Intel MacBook Pro |
1,716,883,558,000 |
First time using a linux, I'm using Debian 12. My notebook arrived with the following partition (512gb SSD), in this order (left to right in the disk viewer):
/boot/efi - 537mb
/root - 20gb
recover (unmounted) - 10gb
Swap - 16gb
/home - 466gb
Since I've started using it, I noticed that everything gets installed in root, so I'm now constantly out of space, even had to search how to clean etc.
My question is: should I rearrange the partitions, allocating more to /root, or start using /home as my 'main' folder? I've seen tutorials on gparted, to accomplish the first option, but I haven't tried it yet. The second option is something that I didn't find much about. That's why I'm asking here first, so I don't do anything that will make more harm than good for my linux experience, which has been positive so far.
Thanks in advance!
|
welcome to the GNU/Linux world! I found a little bit strange that the partition of / so small is. Small comment, /root and / are two different locations in Linux, but as you don't mentioned /, I assumed that you are referring to /, where all packages are actually installed.
Debian and their derivations (Ubuntu e.g) will always by default install every package in /, depending on the package it could be in different folders, but always in the partition of /. Debian uses .deb (imagine something like .exe) to install packages and you cannot change the location of it, because the .deb package says where it should be located.
This can be changed, but as answer in this question Installing packages into local directory?, it is not an easy task for beginners or even intermediate users, because the package are made to find their dependencies in certain folders.
Therefore, I would suggest to increase the size of your main partition, having a 200GB of /home should be enough. If you find problems in this case, I would highly recommend to install the SO from zero, there are plenty tutorials on internet.
Welcome again to the community, have fun!
| New notebook and factory partition |
1,684,561,949,000 |
What am I doing wrong?
I have an image, I added it as a loop device:
losetup -P /dev/loop13 ./my_image.img
gparted screenshot:
Then I try to change the FS size for the partition first:
e2fsck -f /dev/loop13p1
resize2fs /dev/loop13p1 7G
It outputs:
Resizing the filesystem on /dev/loop13p1 to 1835008 (4k) blocks.
The filesystem on /dev/loop13p1 is now 1835008 (4k) blocks long.
Then I shrink the section itself:
parted /dev/loop13p1 resizepart 1 7G
gparted screenshot:
After which I perform:
resize2fs /dev/loop13p1
Output
Resizing the filesystem on /dev/loop13p1 to 3659264 (4k) blocks.
The filesystem on /dev/loop13p1 is now 3659264 (4k) blocks long.
And it rolls back to the original value...
gparted screenshot:
UPD
I tried to reduce the partition via sfdisk and I succeeded, but now I don't understand why even more...
resize2fs -p /dev/loop13p1 7G
echo '2048,7G' | sfdisk /dev/loop13 -N 1
resize2fs /dev/loop13p1
Output:
The filesystem is already 1835008 (4k) blocks long. Nothing to do!
gparted screenshot:
|
In order to use parted correctly, you unfortunately have to do a little math sometimes.
parted /dev/loop13p1 resizepart 1 7G
This command probably does not do what you expect.
parted works with block devices that have partition tables on them. So in the case of /dev/loop13p1 it would be a partition table on a partition. Resizing partition 1 of that would mean you're trying to resize a (fictional) device like /dev/loop13-p1-p1.
You probably want to use /dev/loop13 here.
Then, resizepart 1 7G does not resize partition 1 to 7G of size.
The syntax for resizepart is resizepart NUMBER END. END, not SIZE.
So it moves the end point of partition 1 to the offset 7G. The size of the partition then depends on the start sector of partition 1. If the partition starts at 1MiB it would be 7G minus 1MiB large. Too small for a filesystem of 7G size.
Furthermore, for parted, G means GB (power of 1000) not GiB (power of 1024). So the unit itself can also be an additional source of confusion. If you resize to G when you meant GiB, the partition will be way too small.
Finally for new partition sizes to take, the kernel has to successfully re-read the partition table. Sometimes this fails if the device is in use etc. so always double check with lsblk, blockdev --getsize64, etc. or via head /sys/block/loop13/loop13p1/{start,size} what size the kernel currently believes it to be.
The filesystem on /dev/loop13p1 is now 1835008 (4k) blocks long.
1835008 * 4096 = 7516192768
So the partition must be 7516192768 bytes or larger.
# parted /dev/loop0 unit b print free
Model: Loopback device (loopback)
Disk /dev/loop0: 15032385536B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 1048575B 1047552B Free Space
1 1048576B 15032385535B 15031336960B primary ext2
Trying resizepart:
# parted /dev/loop0 resizepart 1 7G
Warning: Shrinking a partition can cause data loss, are you sure you want to continue?
Yes/No? Yes
# parted /dev/loop0 unit b print free
Model: Loopback device (loopback)
Disk /dev/loop0: 15032385536B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 1048575B 1047552B Free Space
1 1048576B 7000000511B 6998951936B primary ext2
7000000512B 15032385535B 8032385024B Free Space
After resizepart 1 7G the partition ends at (around) 7GB (7000000511B) which is way smaller than the required 7516192768B.
# parted /dev/loop0 resizepart 1 7GiB
Information: You may need to update /etc/fstab.
# parted /dev/loop0 unit b print free
Model: Loopback device (loopback)
Disk /dev/loop0: 15032385536B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 1048575B 1047552B Free Space
1 1048576B 7516192767B 7515144192B primary ext2
7516192768B 15032385535B 7516192768B Free Space
After resizepart 1 7GiB, the partition ends (around) 7GiB (7516192768 Bytes). This is closer but still too small since we have to consider 1 MiB (1048576B) offset.
So there is no easy command to get it right, you just have to do the math yourself.
# parted /dev/loop0 resizepart 1 $((1+7*1024))MiB
Information: You may need to update /etc/fstab.
# parted /dev/loop0 unit b print free
Model: Loopback device (loopback)
Disk /dev/loop0: 15032385536B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1024B 1048575B 1047552B Free Space
1 1048576B 7517241343B 7516192768B primary ext2
7517241344B 15032385535B 7515144192B Free Space
Only then have we reached the desired partition size of 7516192768 Bytes.
| Change the size of the partition using parted |
1,684,561,949,000 |
Long ago I've installed Windows 7 in legacy (BIOS) mode with MBR (why? who knows) and made 4 primary partitions, one for Windows and the others for files. Later I've changed one primary into logical and installed linux dualboot. I use GRUB2 to launch OS. And since then I've also got second HDD which doesn't have any OS on it.
Now I want to install another Linux distro.
The question: should I change another primary into logical and install linux2 in primary or I will be able to install linux2 as logical?
And if I want to install linux2 on second HDD, does it have it's own partition limit even if system is loading from first HDD? I mean if I install another linux on second HDD in primary partition, will it be fith primary partition and mess up everything?
|
Later I've changed one primary into logical and installed linux dualboot.
Primary would have been also good. I always used as many primary partitions as possible and if I needed more partitions, I changed the 4th primary into an extended partition with logical partitions inside.
should I change another primary into logical and install linux2 in primary or I will be able to install linux2 as logical?
Choose what is more convenient for you.
And if I want to install linux2 on second HDD, does it have it's own partition limit even if system is loading from first HDD?
It's the same (MBR) partition limit as for the first HDD. 4 primary partitions max. or 3 primary and one extended partition
with more than enough logical partitions (I honestly don't know the exact number).
I mean if I install another linux on second HDD in primary partition, will it be fith primary partition and mess up everything?
It will be the first primary partition of the second disk. No problem.
| Does BIOS MBR limit linux distros installments? |
1,684,561,949,000 |
I am trying to create a disk image file with an EXT2 partition, however the partition is not found and entire loop device is seen as free/unpartitioned space.
My computer can read Ext2 formatted disks, so that isn't the issue.
Here is my script:
#!/bin/bash
build=build
rm -f $build/disk.img
dd if=/dev/zero of=$build/disk.img bs=1048576 count=$1
driveLoop=$(sudo losetup -f)
sudo losetup $driveLoop $build/disk.img
sudo parted $driveLoop --script -- mklabel gpt
sudo parted $driveLoop --script -- mkpart primary ext2 64s 100%
sudo mkfs.ext2 $driveLoop\p1
sudo losetup -d $driveLoop
sudo chown $USER $build/disk.img
FAT partitions seem to work, but since I'm trying to get EXT partitions to work it's not very helpful.
I've tried using Ext3 and Ext4, but they have the same problem.
Using MBR doesn't seem to fix/change the problem either.
|
It looks like partition discovery is not enabled for loop devices. Set loop.max_part to a non-zero value, see this question.
| EXT partition seen as unpartitioned space in loop device on Ubuntu 22.04.1 |
1,684,561,949,000 |
This is a lsblk output from a live USB with pop_OS used to access to my files, sda and nvme0n1 are the important disks.:
NAME FSTYPE SIZE MOUNTPOINT
loop0 squashfs 2.5G /rofs
sda 232.9G
├─sda1 ntfs 223.1G
├─sda2 vfat 513M
├─sda3 ext4 8.3G
└─sda4 swap 977M [SWAP]
sdb 931.5G
├─sdb1 16M
├─sdb2 ntfs 442.5G
└─sdb3 ntfs 489G
sdc 1.8T
└─sdc1 ntfs 1.8T /media/pop-os/C++
sdd 14.5G
├─sdd1 exfat 14.4G
└─sdd2 iso9660 32M /media/pop-os/Pop_OS 22.04 amd64 Intel
nvme0n1 232.9G
├─nvme0n1p1 vfat 100M
├─nvme0n1p2 16M
└─nvme0n1p3 ntfs 232.8G
I already had windows installed and used it normally on nvme0n1, and I just installed Debian on sda, exactly, I reduced 10GB of sda which in the installation was partitioned into:
513M for /boot
977M for linux-swap
8.3G for /
When Debian installation finished, my Windows booted like nothing
happened and I got no GRUB to choose what OS run. During Debian
installation GRUB was installed, but the installer did not give me the
choice for where to install it.
I suspect this is the problem. My PC is booting from Windows bootloader located in nvme0n1, and not from sda2 where I think GRUB where installed.
Am I right? Is it possible to fix it or even possible to do a dualboot in this way without having to format?? Can I install and use debian on only 10GB??
I have tried to copy the Windows EFI partition to the linux EFI partition created in /dev/sda2 by accessing from a Live USB with pop OS, but I have not been successful :(
I am a complete newbie to linux but I would like to learn and use it regularly, thanks for reading.
|
Your firmware is probably booting the nvme drive. You need to set it to boot sda instead. Many systems give you a one off choice if you press f12 while the boot initiates. Check how to do this in the manual for your motherboard/laptop. It will also show you how to make the change permanent. I have done what you have on my system (copying the Windows boot information) and it works fine. However I am using systemd boot, I doubt it’s necessary with grub.
10GB is the minimum requirement for Debian so it should boot ok. The issue is that depending on what you do with it you may run out of space but it’s fine initially.
| I have Windows installation on NVMe and Installed debian on a SDD partition. PC only booting in Windows, can't use Debian |
1,684,561,949,000 |
Yesterday I shrank a volume, and installed Ubuntu on it because I wanted to dual boot, I'm dual-booting Windows 11 and Ubuntu 22.04 on the same drive.
I have just noticed that I might need more space for my workflow and I want to shrink it further.
I used Windows Disk Management to shrink a volume to be able to install Ubuntu.
I wanted to ask those who have done this, will this give me problems? Will Ubuntu use the new space?
Furthermore, considering that the free space will now be allocated before the OS I'm kinda worried I might break something.
This is the output for parted -l on the drive in which I want to make more space:
Model: ATA WDC WDS500G2B0A (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17,4kB 16,8MB 16,8MB Microsoft reserved partition msftres
2 16,8MB 393GB 393GB ntfs Basic data partition msftdata
3 393GB 393GB 538MB fat32 EFI System Partition boot, esp
4 393GB 500GB 107GB ext4
I want to add some space from the ntfs partition to my system.
|
Since your NTFS (Windows) and your EXT4 (Linux) Partitions don't lie back-to-back on the disk, you won't win anything, unless you first shrink the NTFS partition, move the EFI partition to be right after the end of that partition, then move the EXT4 to right after the end of that, and then extend the ext4 partition into the free space that's then at the end of all this.
That's a hassle. If I'm frank, I'd just backup my data from linux, remove the linux partition, install Ubuntu using the alternative installer (see here) to use LVM as partitioning scheme.
That way, you can just add arbitrarily positioned physical volumes later on to extend your available space on your Linux, without having to worry whether the volumes lie contiguously on disk/SSD, or even on the same device.
| Making more room for Ubuntu |
1,684,561,949,000 |
I have custom LFS installer which contains sfdisk, I am trying to add support for NVME disks on it. When I make partitions with sfdisk on a normal SATA disk, things go as expected but when I do the exact same on a NVME disk, it creates the partitions, but when I am trying to get the size of a partition (with the sfdisk -s /dev/nvme0n1p1 command), it outputs No such device or address while trying to determine filesystem size.
lsblk output:
NAME MAJ:MIN SIZE TYPE
nvme0n1 259:0 1.8T disk
|nvme0n1p1 259:1 200G part
`nvme0n1p2 259:10 1.6T part
sfdisk usage:
,200G,L
,,L
/proc/partitions
major minor #blocks name
259 0 1953514584 nvme0n1
259 2 209715200 nvme0n1p1
259 3 1743798343 nvme0n1p2
They are also listed under /dev as nvme0n1, nvme0n1p1 and nvme0n1p2.
Now if I use sfdisk -s /dev/nvme0n1p1 I get the output: 209715200 and sfdisk -s /dev/nvme0n1p2 gives: No such device or address while trying to determine filesystem size.
Now the strange thing is, if I create the partitions again, and I do sfdisk -s /dev/nvme0n1p1 this now gives: No such device or address while trying to determine filesystem size and sfdisk -s /dev/nvme0n1p2 gives 209715200.
And if I it again over and over, it keeps changing, one partition is usable, other not, it swaps constantly.
Things I tried:
Other SSD (same type), same result;
I am using a pcie adapter for the NVME disk, tried other adapter, same result;
Using the adapter in a running open suze installation, I can execute these comands with no issues;
Normal sata drive, no issues.
[edit] I figured out after a reboot without the partitioning the drive again, it is possible to execute these commands, is this important to a NVME disk, but seems not to normal sata?
I am quite out of ideas now what to try or what the couse of this could be, any help would be appreciated.
|
I managed to find a sollution so I am adding the answer here so it might help others in case they encountered a similar problem.
I used the blockdev --rereadpt /dev/nvme0n1 command. This rereads the partition table, and now I can execute the sfdisk -s /dev/nvme0n1p2 command with no issues without the need of a reboot.
I am still not sure why this is not needed with normal sata drives, so if someone knows why this is not the case, feel free to leave a comment.
| Sfdisk NVME issue, No such device or address |
1,656,237,848,000 |
I used to dual boot Windows and Fedora 35, and decided to just run windows in a vm. I deleted the Windows partitions successfully, but now I have free space in the middle that I can't figure out how to move safely.
Since I don't have a swap partition, this question doesn't help, and since the partitions are on the same disk, I can't use this question.
I don't want to use GParted because it's not installed on my Fedora live usb (and other unrelated reasons), so my options are Gnome Disks and blivet-gui. Is there a way to safely move the free space from the middle of nowhere to my main partition?
Print lsblk
Return mountpoint for fedora_localhost-live (nvme0n1p6).
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 8G 0 disk [SWAP]
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 100M 0 part /boot/efi
├─nvme0n1p5 259:2 0 1G 0 part /boot
└─nvme0n1p6 259:3 0 350.9G 0 part /home
/
Many thanks!!
|
You can't "move" free space. It also doesn't solve anything! You'd still need to tell your / filesystem to use that.
However, your filesystem that you want to extend is btrfs - perfect! You can just add more partitions to the btrfs volume to extend its size, no need to move anything. And since this is an ssd and not a spinning disk, this also has no performance downside at all.
It's quite doable:
Use blivet-gui to add a new partition that uses up your free space. Don't format it!
Note down the name of that position, e.g., nvme0n1p42.
Add the new space to your existing volume: sudo btrfs device add /dev/nvme0n1p42 /
That's it! You can use the new space right away.
| How to move free space from the middle of a disk with Gnome Disks or blivet-gui |
1,656,237,848,000 |
I was using Windows 11 on my laptop but I wanted to install a Linux distro on the side.
Therefore, I've shrunk 30GB of the OS disk and I installed Pop_Os. During the installation process, I've created a EFI and root partitions.
I now wanted to extend the ext4 partition. I was able to shrink even more the original OS disk, but the unallocated space is shown on the left when using gParted and I'm unable to resize the root partition.
Below the gparted screenshots and fdisk outputs:
$ sudo fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 476,94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: WDC PC SN520 SDAPMUW-512G-1101
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 68C5B02D-2F6D-464B-AC15-BC33272E2AD7
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 534527 532480 260M EFI System
/dev/nvme0n1p2 534528 567295 32768 16M Microsoft reserved
/dev/nvme0n1p3 567296 761978879 761411584 363,1G Microsoft basic data
/dev/nvme0n1p4 998166528 1000214527 2048000 1000M Windows recovery environment
/dev/nvme0n1p5 939532288 996937725 57405438 27,4G Microsoft basic data
/dev/nvme0n1p6 996937728 998166525 1228798 600M EFI System
Partition table entries are not in disk order.
Getting a bit out my comfort zone now :)
How should I proceed now to expand the partition?
|
You need to do the resize from a LiveCD -- the nvme0n1p5 partition is currently mounted. Ext4 can be resized when mounted, but only to the right -- resizing it to the left actually means copying/moving the data to the start of the free space and then resizing the partition and that cannot be done with an active (mounted) partition. So boot from a LiveCD (the Pop installation CD has GParted so you can use that) and use the GParted Resize/Move option to resize the partition. Don't forget to make a backup first.
| Extend partition created on laptop with Windows 11 and Pop OS |
1,656,237,848,000 |
I have a laptop that should be running two Debian 9's, one Debian 11 and one Windows 10 from two disks, one hard disk drive, /sda/, and a new solid state drive, /nvme0n1/.
I used gparted to clone and extend /sda1/'s Debian 9 onto the SDD's /nvme0n1p5/.
When I boot Debian 9 (/nvme0n1p5/) using GRUB2, which recognises all four operating systems, it always boots the source partition, /sda1/, on Legacy Boot Mode. The Debian 11 installed on /sda5/ boots just fine as does Windows on /nvme0n1p1/.
The newer SSD /nvme0n1/ is partitioned using GPT whereas the HDD still uses MBR.
After I cloned the source partition I had to reinstall grub2 as grub-efi-amd64 uninstalling grub-pc to accommodate UEFI dual-booting/multi-booting as suggested here.
I haven't yet tried removing the HDD with the source partition from the machine and seeing how GRUB reacts but I shouldn't have to do that.
EDIT 1
I tried giving /nvme0n1p5/ a new UUID and updating GRUB but this did not fix the problem.
Then I tried removing the HDD to see what would happen. The result is in the forth image. Windows on /nvme0n1p1/ is no longer visible. I can't boot into either /sda1/ or /nvme0n1p5/. The first is expected. The second is not.
|
At long last, I found out the problem was an UUID issue on /etc/fstab. Linux on the cloned partition /nvme0n1p5/ would load up the file system targeting the UUID of /sda1/.
I had to replace in my /etc/fstab file the old UUID of the original partition with the new UUID of the destination partition.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=002ae0f2-b6df-4502-8a0c-b9db279142b1 / ext4 errors=remount-ro 0 1
to
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=248b6fec-3f9a-4e48-838f-cdea88cfe933 / ext4 errors=remount-ro 0 1
During my tinkering, I updated grub a number of times a number of ways. I don't believe this second bit is part of the original problem but rather a fix to a second problem I might have created. I include this just in case. The grub menu entry pointed to the wrong partition for retrieving the file system but the right entry for retrieving the Linux kernel.
submenu "Advanced options for Debian GNU/Linux 9 (stretch) (on /dev/nvme0n1p5)"{
menuentry "Debian GNU/Linux (on /dev/nvme0n1p5)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-13-amd64--248b6fec-3f9a-4e48-838f-cdea88cfe933' {
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 002ae0f2-b6df-4502-8a0c-b9db279142b1
else
search --no-floppy --fs-uuid --set=root 002ae0f2-b6df-4502-8a0c-b9db279142b1
fi
linux /boot/vmlinuz-4.9.0-13-amd64 root=UUID=248b6fec-3f9a-4e48-838f-cdea88cfe933 ro efi=runtime quiet
initrd /boot/initrd.img-4.9.0-13-amd64
}
to:
submenu "Advanced options for Debian GNU/Linux 9 (stretch) (on /dev/nvme0n1p5)"{
menuentry "Debian GNU/Linux (on /dev/nvme0n1p5)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-13-amd64--248b6fec-3f9a-4e48-838f-cdea88cfe933' {
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 248b6fec-3f9a-4e48-838f-cdea88cfe933
else
search --no-floppy --fs-uuid --set=root 248b6fec-3f9a-4e48-838f-cdea88cfe933
fi
linux /boot/vmlinuz-4.9.0-13-amd64 root=UUID=248b6fec-3f9a-4e48-838f-cdea88cfe933 ro efi=runtime quiet
initrd /boot/initrd.img-4.9.0-13-amd64
}
This can be done with a GUI using grub-customizer available from Debian 10 or more. Otherwise just mount the EFI system partition and open /grub/grub.cfg. You will have to modify the Advanced Boot options as well as. Remember to copy a backup of the original /grub/grub.cfg in case something goes wrong.
Find your own correct UUID with sudo blkid. The correct UUID is that of the partition you want to boot to.
| After cloning OS, GRUB always boots from the source sda1 partition even when another partition is selected for booting |
1,656,237,848,000 |
I've been struggling for a while now to create more space in my VM, and I believe it's going wrong on the first step. I've increased the size of my physical volume, sda3;
$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 61.9M 1 loop /snap/core20/1405
loop1 7:1 0 61.9M 1 loop /snap/core20/1434
loop2 7:2 0 67.2M 1 loop /snap/lxd/21835
loop3 7:3 0 67.8M 1 loop /snap/lxd/22753
loop4 7:4 0 43.6M 1 loop /snap/snapd/14978
loop5 7:5 0 44.7M 1 loop /snap/snapd/15534
sda 8:0 0 500G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1.5G 0 part /boot
└─sda3 8:3 0 498.5G 0 part
└─ubuntu--vg-ubuntu--lv 253:0 0 48.5G 0 lvm /
As you can see, sda3 is roughly 500GB, but when I run LVExtend, it seems to disagree;
$ sudo lvextend -L +100G /dev/mapper/ubuntu--vg-ubuntu--lv
Insufficient free space: 25600 extents needed, but only 0 available
I already ran it once before and it only found a little space;
$ sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
Size of logical volume ubuntu-vg/ubuntu-lv changed from <24.64 GiB (6307 extents) to <48.50 GiB (12415 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
What am I doing wrong?
Edits:
Output of pvs:
$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <48.50g 0
|
You increased the size of /dev/sda3 but you haven't yet told LVM that the size has increased. Use pvresize /dev/sda3 to resize the Physical Volume. This will automatically grow space availabe in the Volume Group and you can then use lvresize to grow the Logical Volume. After that you'll need to resize the filesystem itself.
Growing the filesystem to 100% of the available LV space seems a little strange though. If that's all you're going to do then there's no point having the overhead of LVM; you might as well have just put the filesystem directly onto /dev/sda3.
| LVExtend can't find space on physical volume |
1,656,237,848,000 |
I am trying to install NixOS on my MacBook following the manual (https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning-formatting) and I am stuck at the partitioning/formatting stage. After creating necessary partitions on the disk I took for NixOS (an MS-DOS partition made via Disk Utility) with parted, I need to initialise them as ext4 partitions and a swap partition. And in order to do that, I need to reference them.
The problem is that my NixOS disk is known as /dev/nvme0n1p3 (p1 and p2 being ESP and OS X drive respectively) and I cannot access the reference names of the partitions I need to initialise; gdisk shows them correctly but lsblk does not count them as devices.
Is there a way to see how to reference these “sub-sub-subpartitions”?
P.S.: I am a complete newbie, this is the first time I install a Linux system so I can make real blunders in terminology etc. I apologise for this in advance.
Edit: the lsblk output
Edit 2: partition table of nvme0n1p3 according to gdisk
Edit 3: so I tried to see what fdisk will show me, and it labels these partitions as nvme0n1p3p1, nvme0n1p3p2 and nvme0n1p3p3. Technically the question is solved, but now I cannot do anything with these partitions since all the commands involving them result in “no such file or directory” error.
|
You should not normally make nested partition tables. You seem to have created a nested partition table on nvme0n1p3, but since neither the firmware nor the Linux kernel normally look for it there, it had no effect (except potentially damaging the beginning & the end of your nvme0n1p3 partition).
Your fdisk/gdisk or any other partitioning commands should be pointed at the whole-disk device of your NVMe disk, which is /dev/nvme0n1 in your case. The n1 part is a namespace identifier which is relevant only with large enterprise NVMe storage systems: essentially all consumer-grade NVMe disks have just one namespace.
Although /dev/nvme0 exists as a device, that will not be a block device: it’s a character device that allows access to the NVMe controller for certain management functions. (Install the nvme command line tool and run man nvme for more details.)
| How do I reference nvmeXnYpZ partitions? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.