Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
5
votes
1
answers
266
views
How to create partitions on a volume with the root filesystem mounted on the enitre disk
I have a server with the root filesystem `/` mounted on `/dev/sda`, i.e., the entire disk, which has no partitions. This situation makes me uncomfortable, and I would like to partition the disk and put the root filesystem on `/dev/sda1`. I'm not sure if this is possible though, without losing my ent...
I have a server with the root filesystem
/
mounted on /dev/sda
, i.e., the entire disk, which has no partitions. This situation makes me uncomfortable, and I would like to partition the disk and put the root filesystem on /dev/sda1
.
I'm not sure if this is possible though, without losing my entire server, since this is the root filesystem. If I run fdisk /dev/sda
, it lets me create the partition /dev/sda1
over the entire disk, but I'm afraid that this will wipe the disk, so I haven't proceeded with that.
Is there a way to move /
from /dev/sda
to /dev/sda1
without losing everything?
Here's fdisk -l
, edited to remove loop devices:
Disk /dev/sda: 117.19 GiB, 125829120000 bytes, 245760000 sectors
Disk model: QEMU HARDDISK
Disk /dev/sdb: 1000 MiB, 1048576000 bytes, 2048000 sectors
Disk model: QEMU HARDDISK
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 2047999 2045952 999M 82 Linux swap / Solaris
Disk /dev/sdc: 160 GiB, 171798691840 bytes, 335544320 sectors
Disk model: Volume
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 335544319 335542272 160G 83 Linux
Dave_G
(61 rep)
Aug 3, 2025, 10:17 PM
• Last activity: Aug 4, 2025, 02:33 AM
2
votes
1
answers
10156
views
Creating a bootable iso image from my current installation
We have an old physical machine with *Ubuntu distro 20.04* and that physical machine has a total of ```103GB /root partition``` and ```10GB as swap memory```. We have currently utilized up to 45GB. We want to create a bootable ISO image from that current installation. Also, we tried to create an ima...
We have an old physical machine with *Ubuntu distro 20.04* and that physical machine has a total of
/root partition
and as swap memory
. We have currently utilized up to 45GB. We want to create a bootable ISO image from that current installation.
Also, we tried to create an image using the below packages. While running these packages, we are facing an error -- “filesystem.squashfs size exceeds more than 4GB”. Then we verified that the filesystem file consumes more than 8GB. So that, we cannot able to create an image file. Is there any other package/tool to create an image from the current installation? Thanks!
1.remastersys – respin - https://itectec.com/ubuntu/ubuntu-build-the-own-ubuntu-iso/
2.distroshare image builder - https://github.com/Distroshare/distroshare-ubuntu-imager
BSivakumar
(21 rep)
Nov 19, 2021, 08:40 AM
• Last activity: Jul 29, 2025, 11:01 AM
3
votes
2
answers
373
views
How can I use lsblk to display all devices except my root/main "sda" device where my root filesystem is "/"?
I use LUKS (so my system is encrypted) and LVM. I don’t want sda displayed because that’s where my root filesystem lives, and it’s my root device. The solution should also work for systems without LUKS or LVM, meaning it must handle all scenarios. I'm on a Debian 12.x and I want to display all main...
I use LUKS (so my system is encrypted) and LVM.
I don’t want sda displayed because that’s where my root filesystem lives, and it’s my root device. The solution should also work for systems without LUKS or LVM, meaning it must handle all scenarios.
I'm on a Debian 12.x and I want to display all main devices in a one row command, if possible, ***except my root device***, regardless of whether it's an LVM, LUKS or not, etc.
The command should be flexible, and I don’t want to use fixed specifications
*--vg-root
, etc., if possible.
> **@bertieb comment:**
From the added output, it seems the root mountpoint is in a volume group in an encrypted volume on the device is presenting itself as sda -- OP wants that entire device and all associated block 'devices' elided ? i.e. remove root vg AND swap, crypt, containing partition (sda3) plus other partitions, and finally the device (sda)
And that should be my result, ***so all main devices without*** sda
because that’s my root device where my root filesystem is /
, and without me having to specify details, so I can use it on other **devices/systems** as well, whether LVM, LUKS, etc., without needing to know what root is called, or what the UUID is, etc.
I don't want to see the partitions too, only the main devices without root device, like in this command lsblk -d -o NAME,SIZE --sort SIZE
.
This is the output I need:
- No sda (since it's the root device containing my root filesystem /)
- Only main devices displayed (regardless of how many exist)
- No partitions included from the other devices
##### RESULT I NEED :
NAME SIZE
nvme0n1 238.5G
**My Setup:**
$ lsblk -d -o NAME,SIZE --sort SIZE
NAME SIZE
sda 57,3G
nvme0n1 238,5G
$ lsblk -fs -o NAME
# ROOT DEVICE
sda1
`-sda
sda2
`-sda
desktop--vg-root
`-sdb3_crypt
`-sda3
`-sda
...
...
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 57,3G 0 disk
├─sda1 8:1 1 512M 0 part /boot/efi
├─sda2 8:2 1 488M 0 part /boot
└─sda3 8:3 1 56,3G 0 part
└─sdb3_crypt 254:0 0 56,3G 0 crypt
├─desktop--vg-root 254:1 0 55,3G 0 lvm /
└─desktop--vg-swap_1 254:2 0 980M 0 lvm [SWAP]
nvme0n1 259:0 0 238,5G 0 disk
└─nvme0n1p1 259:1 0 238,5G 0 part /user/backup
I don't want that, for example /dev/mapper/desktop--vg-root
,sdb3_crypt
, sda3
no sda
.
But rather this here from the example sda
, this is the root device, so I don't need this device in the output.
#### MY DEVICES, MY SETUP:
NAME SIZE
sda 57.3G
|-sda1 512M
|-sda2 488M
`-sda3 56.3G
`-sdb3_crypt 56.3G
`-desktop--vg-swap_1980M
nvme0n1 238.5G
`-nvme0n1p1 238.5G
**RESULT I NEED:**
NAME SIZE
nvme0n1 238.5G
##### System setup Debian, lsblk and other information:
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.1.0-22-amd64
Architecture: x86-64
lsblk from util-linux 2.38.1
$ apt-get install --only-upgrade util-linux
util-linux is already the newest version (2.38.1-5+deb12u3)
##### From @terdon RESULT:
(){ lsblk -o NAME,SIZE,MOUNTPOINT | awk '$NF!="/"{printf "%-15s%-10s\n", $1,$2}'; }
NAME SIZE
sda 57.3G
|-sda1 512M
|-sda2 488M
`-sda3 56.3G
`-sdb3_crypt 56.3G
`-desktop--vg-swap_1980M
nvme0n1 238.5G
`-nvme0n1p1 238.5G
$ lsblk -o NAME,SIZE,MOUNTPOINT
NAME SIZE MOUNTPOINT
sda 57.3G
|-sda1 512M /boot/efi
|-sda2 488M /boot
`-sda3 56.3G
`-sdb3_crypt 56.3G
|-desktop--vg-root 55.3G /
`-desktop--vg-swap_1 980M [SWAP]
nvme0n1 238.5G
$ lsblk -o NAME,SIZE,MOUNTPOINT | awk '$NF!="/"{printf "%-15s%-10s\n", $1,$2}';
NAME SIZE
sda 57.3G
|-sda1 512M
|-sda2 488M
`-sda3 56.3G
`-sdb3_crypt 56.3G
`-desktop--vg-swap_1980M
nvme0n1 238.5G
$ lsblk -o NAME,SIZE,MOUNTPOINT | awk '$NF=="/"'
|-desktop--vg-root 55.3G /
##### From Chris Davies RESULT:
Root partition: mapper/desktop--vg-root
Root device:
NAME SIZE
sda 57.3G
nvme0n1 238.5G
##### From @muru:
lsblk -d $(findmnt -no source /)
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
desktop--vg-root 254:1 0 55,3G 0 lvm /
ReflectYourCharacter
(8185 rep)
Mar 27, 2025, 01:50 PM
• Last activity: Jun 29, 2025, 01:15 PM
0
votes
0
answers
234
views
How to enable bluetooth in beaglebone black
I bringup beaglebone black successfully with my own rootfs. After bringup beaglebone black how to enable peripherals like gpio,bluetooth and wifi from scratch please suggest me
I bringup beaglebone black successfully with my own rootfs.
After bringup beaglebone black how to enable peripherals like gpio,bluetooth and wifi from scratch
please suggest me
Prashanth
(101 rep)
Jun 25, 2020, 03:18 PM
• Last activity: Jun 9, 2025, 11:30 AM
0
votes
1
answers
1980
views
Read-only filesystem - Considerations and Loss of Functionality
I'm creating an embedded system using Buildroot. Currently, my Buildroot configuration ensures the rootfs is remounted as read/write during startup. However I would like to remove this feature and keep my rootfs as read-only. I have a few questions regarding this: ---------- How do I change a user's...
I'm creating an embedded system using Buildroot. Currently, my Buildroot configuration ensures the rootfs is remounted as read/write during startup. However I would like to remove this feature and keep my rootfs as read-only.
I have a few questions regarding this:
----------
How do I change a user's password? This would require changing /etc/passwd & /etc/shadow.
How do I change the timezone? This would require changing /etc/localtime.
How do I create ssh keys for sshd? ssh-keygen creates the keys in /etc/ssh/
According to the Filesystem Hierarchy Standard, a Linux system is required to function with a read-only /etc/ directory, but it seems I'm finding a distinct loss of functionality as described above.
----------
Secondly, after specifying that the rootfs is to remain read-only in my Buildroot configuration, it elects to mount /var/ as a tmpfs (in RAM, so it is writable)
But, this is volatile, how can I ensure runtime files (which I need to save) aren't lost on reboot or unexpected power-loss?
I'm using UBIFS, in my embedded system. Am I required to create a read/write UBI volume which I use as persistent storage? Is this the standard in embedded systems?
----------
And finally, should I re-evaluate my idea to use a read-only rootfs at all? Given I am using UBI, and as wear-levelling is implemented across all the UBI volumes (the exist on the same device, of course), will I receive any benefit in making my rootfs read-only?
Mattmatician
(1 rep)
Apr 29, 2018, 01:47 PM
• Last activity: Jun 9, 2025, 07:05 AM
2
votes
1
answers
468
views
Zfs file system with two roots that can be selected at boot
I have Ubuntu 20.10 on zfs root pool (upgraded from 20.04). I tried to restore 20.04 using `zsys` features at boot, which was unsuccessful. I have a backup (created using `syncoid`). Using `zfs send/receive`, I created a new pool in a separate disk called spool. It has restored 20.04 before the upgr...
I have Ubuntu 20.10 on zfs root pool (upgraded from 20.04).
I tried to restore 20.04 using
zsys
features at boot, which was unsuccessful.
I have a backup (created using syncoid
). Using zfs send/receive
, I created a new pool in a separate disk called spool. It has restored 20.04 before the upgrade.
I'd like to be able to choose at boot time between the two pools. How do I set it up with grub
.
user63726
(121 rep)
Oct 24, 2020, 11:21 PM
• Last activity: May 18, 2025, 04:06 PM
6
votes
1
answers
2267
views
Can I use a read-write root filesystem disk image as an OverlayFS upperdir?
Is it possible to union-mount an existing disk image containing a root filesystem to the `upperdir` of an `overlayfs` mount for read-write access? I'm trying to union-mount some old disk images to a `/tmp/` directory on an Ubuntu 16.04 machine using pre-existing scripts (originally written on Ubuntu...
Is it possible to union-mount an existing disk image containing a root filesystem to the
upperdir
of an overlayfs
mount for read-write access?
I'm trying to union-mount some old disk images to a /tmp/
directory on an Ubuntu 16.04 machine using pre-existing scripts (originally written on Ubuntu 12.04 and ported to 14.04).
The old automation scripts used overlayfs
to create and union-mount writable ext2/3
disk images on top of squashfs
images — something like this:
cd /tmp
mkdir lower upper union
losetup /dev/loop1 /tmp/image.sfs
losetup /dev/loop2 /tmp/image.ext2
mount -t squashfs -o ro /dev/loop1 /tmp/lower
mount -t ext2 -o rw /dev/loop2 /tmp/upper
mount -t overlayfs -o rw,lowerdir=/tmp/lower,upperdir=/tmp/upper overlayfs /tmp/union
They were last used on an 3.x kernel (likely pre-3.18), and that method doesn't seem to work anymore. Overlay now requires a workdir
option—e.g.:
mount -t overlay -o rw,lowerdir=/tmp/lower,upperdir=/tmp/upper,workdir=/tmp/work overlay /tmp/union
**Q:** Is it possible to tweak the automation scripts to mount and use the existing images in a writable state on a 4.x kernel? Can I avoid reformulating them to contain something like root
and work
directories? In some cases that may break their use elsewhere.
Per the documentation, the workdir
has to be an empty directory on the same filesystem as the upperdir
to allow for atomic writes. That sounds to me like it is impossible to union-mount root filesystem images as read-write. The workdir
would have to exist within the images (separate from their data directory) which isn't possible in a root filesystem image.
I've considered loading up stock Ubuntu 14.04 in a VM for a couple one-offs, but it's not a long term solution.
---
**Best Attempt So Far:**
The only solution I've come up with that avoids double-writing the same data to disk is to mount both images as lowerdir
values, with upperdir
and workdir
directories sitting on a tmpfs
mount. Then I can use rsync
to copy the changes from the tmpfs
location to the mounted ext2/3
image after the automated writes are complete and the overlay union has been unmounted—i.e.:
mount -t overlay -o rw,lowerdir=/tmp/upper:/tmp/lower,upperdir=/tmp/tmpfs/root,workdir=/tmp/tmpfs/work overlay /tmp/union
...perform automated reads/writes...
umount /tmp/union
...rsync contents from /tmp/tmpfs/root to /tmp/upper...
It's strictly limited to available RAM, though, and it's an ugly hack to add to all of the automation scripts.
codewithmichael
(456 rep)
Sep 10, 2016, 01:28 AM
• Last activity: May 17, 2025, 05:00 PM
2
votes
1
answers
4180
views
How to increase size of root?
Here is information regarding my disk space consumption. Command (m for help): p Disk /dev/sda: 465.8 GiB, 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 Disklabel typ...
Here is information regarding my disk space consumption.
Command (m for help): p
Disk /dev/sda: 465.8 GiB, 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
Disklabel type: dos
Disk identifier: 0x360c373e
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 17577983 17575936 8.4G 83 Linux
/dev/sda2 17580030 976771071 959191042 457.4G 5 Extended
/dev/sda5 17580032 23437311 5857280 2.8G 83 Linux
/dev/sda6 23439360 47773695 24334336 11.6G 82 Linux swap / Solaris
/dev/sda7 47775744 48553983 778240 380M 83 Linux
/dev/sda8 48556032 976771071 928215040 442.6G 83 Linux
But Gparted is not able to change (shrink) the size of home!
My tmp was full and my root is low on space. I used
sudo apt-get clean
In fact, I transferred the docs from root to home as a workaround.
What are the alternatives? I want to end this by increasing root size but can't able to do it. This is what Gparted shows me:

Love Grover
(401 rep)
Jan 12, 2017, 06:36 PM
• Last activity: May 6, 2025, 09:10 PM
4
votes
1
answers
3358
views
Updating root filesystem remotely in-place
Let's say one has only remote access (SSH) to an embedded Linux device and the goal is to upgrade the OS to a new version. The device has only one partition, but there's easily more than 50% unused space and the device has about 256 MB of RAM to work with. How would one go about doing that? I'm thin...
Let's say one has only remote access (SSH) to an embedded Linux device and the goal is to upgrade the OS to a new version. The device has only one partition, but there's easily more than 50% unused space and the device has about 256 MB of RAM to work with. How would one go about doing that? I'm thinking the solution would probably involve tempfs and pivot_root.
Here's my vague idea for how to do this:
1. upload new rootfs structure to a directory on the device
2. mount a tempfs in RAM and copy over required system resources to keep the system running while the rootfs is being worked on
3. change root to the tempfs using pivot_root or chroot or both, not quite sure
4. copy the rootfs structure from the uploaded directory to replace the old
5. reboot to the new version of the OS
Now, I'm thinking this sounds too simple to actually work. Can you please poke holes in my plan and tell me what I missed or better yet give me pointers to how to do it right? Does anybody have experience in doing something like this?
Janne Oksanen
(141 rep)
Feb 5, 2018, 02:37 PM
• Last activity: May 1, 2025, 03:03 AM
2
votes
2
answers
2241
views
Export (via NFS) root (/) FS
I have 3 embedded CPU system running Linux 2.6.37, which are connected via Ethernet. Each CPU has its own NAND flash memory. One of them is "main" CPU number 0, while 2 others are his companions. I want all three to run from the same root file system residing on the CPU0 to avoid tripling of possibl...
I have 3 embedded CPU system running Linux 2.6.37, which are connected via Ethernet. Each CPU has its own NAND flash memory. One of them is "main" CPU number 0, while 2 others are his companions.
I want all three to run from the same root file system residing on the CPU0 to avoid tripling of possible updates/changes in RootFS files.
For this I wanted to export the '/' (root file system) via NFS on CPU0, while CPU1 & CPU2 will boot up from CPU0 via NFS (nfsroot).
But this seems to not work - any attempt to export the '/' fails with the message :
exportfs: / does not support NFS export
Are there any principle limitations on exporting '/'?
If yes, any ideas what can be done to reach the goal?
Thanks a lot ahead.
Addition/Update:
1. Each CPU knows its number, the boot loader (u-boot) will put correct parameters into Linux command line to boot from NAND(CPU0) or from NFS(CPU1-2). The same way CPU0 will start the NFS server, while CPU1-2 will not.
2. There is no need in "private" files, as in any case the root file system is mounted read-only also today. Just each CPUx has its own private NAND, while I want to eliminate this.
3. This is not the same as "diskless" case, because in diskless case some SUBDIRECTORY is exported as root FS, while in my case all the root FS must be exported.
4. I should note that exporting of any subdirectory from NAND works fine (I at least tried several). Just exporting '/' fails.
leonp
(111 rep)
Apr 20, 2017, 11:41 AM
• Last activity: Apr 24, 2025, 10:03 PM
3
votes
2
answers
3797
views
Recommended scheme for partitioning root file system into subvolumes following the Filesystem Hierarchy Standard
The [Filesystem Hierarchy Standard][1] (FHS) is the formal codification for root file tree on Linux installations, as inherited from earlier iterations of Unix and POSIX, and subsequently adapted. It standardizes the exact uses of the familiar `/home`, `/etc`, `/usr`, `/var`, and so on, from various...
The Filesystem Hierarchy Standard (FHS) is the formal codification for root file tree on Linux installations, as inherited from earlier iterations of Unix and POSIX, and subsequently adapted. It standardizes the exact uses of the familiar
/home
, /etc
, /usr
, /var
, and so on, from various historic differences of convention, and resolves where application-specific and site-specific file names may be added, or not.
Basic Linux installations historically have placed the entire tree on a single file system, though some variations have utilized a separate partition for /home
, presumably to facilitate backup and migration.
More recently, Btrfs has gained increasing adoption, which allows a single partition to host various subvolumes. Subvolumes are appealing because they may be captured in snapshots, and require no pre-allocation of space.
The mapping of subvolumes to nodes on the FSH appears to vary widely.
Sensible standards and policies respecting such matters are important, for supporting optimal management of files on the system with respect to snaphots and related concerns.
Following are some observations:
- Debian appears to place the entire tree on a single subvolume beneath root.
- Ubuntu appears to allocate a subvolume for /home
, and another for the remainder of the root tree.
- Arch Linux appears to extend the separation adopted by Debian by placing /var/log
and /var/cache
each in a separate subvolume.
- openSUSE has a single subvolume for /var
, and one each for /home
, /root
, /usr/local
, /opt
, and /srv
, as well as one for the remainder of the root tree, a further one for each installed grub architecture.
Have any standards emerged that have attempted to resolve the various design considerations, and to unify the approaches adopted by various operating systems? Has any agreement emerged concerning how to reconcile the functions of the various file tree nodes with policies concerning snapshots?
brainchild
(340 rep)
Nov 8, 2022, 02:11 PM
• Last activity: Apr 11, 2025, 05:07 AM
0
votes
0
answers
71
views
How can I set chown and chmod permanently, also for new files?
I installed `texlive` as usual in `/usr/local/texlive/2025`. When installing I typed `umask 0027` prior to each command (`./configure`, `make`...), hoping that the resulting files would have `root` as `owner` and `me` as `group` with the same rights to access, read and change the files. Nevertheless...
I installed
texlive
as usual in /usr/local/texlive/2025
. When installing I typed umask 0027
prior to each command (./configure
, make
...), hoping that the resulting files would have root
as owner
and me
as group
with the same rights to access, read and change the files.
Nevertheless, when updating texlive
(sudo tlmgr --self --all --no-auto-remove update
), the owner becomes root
, the group
becomes root
instead of ME
, and I neither can use commands like luatex
nor the .sty
files etc., as they're owned by root.
So, each time I update texlive
via tlmgr
I have to change owner
and group
manually for all files in \textlive\2025
.
What can I do to set owner=root
and user=ME
for all files newly created and changed with sudo tlmgr ...
in the future?
Alexander Wittmann
(101 rep)
Mar 13, 2025, 10:23 PM
1
votes
1
answers
718
views
A process called "Opera" (the browser is not installed) constantly uses 100% of my CPU. Does anyone know what this is?
I have a server box I use to host various web applications and game servers for friends. I recently connected to it to check how it was running, and discovered a program "Opera" trying to use over 3000% of my CPU according to `top`. I tried to kill it with `pkill Opera` and `pkill ` then used `killa...
I have a server box I use to host various web applications and game servers for friends. I recently connected to it to check how it was running, and discovered a program "Opera" trying to use over 3000% of my CPU according to
/var/tmp/Documents folder without the Opera executable" class="img-fluid rounded" style="max-width: 100%; height: auto; margin: 10px 0;" loading="lazy">
Deleting the executable seems to have fixed the problem, but I still have no idea what it was caused by or what the Opera executable is, what it was doing, and why it was executing from the
top
.
I tried to kill it with pkill Opera
and pkill
then used killall
to do the same, which worked initially, but the Opera program came back within a minute or so. I checked through all of my system services and cron jobs and can't find any mention of "Opera" anywhere, and trying to run the command manually ("Opera", not "opera" like the browser) just prompts me to install the opera browser from snap. top
only informed me that opera was somehow located at ./Opera
. I eventually tracked down the executable by following the symlink in /proc/
and found it in /var/tmp
inside a "Documents" folder with some other odd files (a config.json, and several hidden files with strange names and no extensions) the picture I've included does not have the Opera file, as I deleted it.

/var/tmp
folder. I mainly want to know if this is a known virus or trojen, and whether I should purge the user it's executing from.
Editing this because I forgot to add my system info.
My operating system is Ubuntu 22.04.4 LTS and I use bash as my kernel. my kernel version is Linux 5.15.0-116-generic
Any help is appreciated, thanks!
Isaakfire
(13 rep)
Jul 25, 2024, 10:00 PM
• Last activity: Jan 26, 2025, 04:00 PM
2
votes
1
answers
456
views
How to overlay root (/) of a running server with my set of directories?
I would appreciate if you could help me with the following problem. I am developing a set of utilities with different configurations and thus I need to debug them. My own notebook serves as a base for different services like DNS, DHCP and stuff, so I can't reboot it quite often, preferably not at al...
I would appreciate if you could help me with the following problem.
I am developing a set of utilities with different configurations and thus I need to debug them. My own notebook serves as a base for different services like DNS, DHCP and stuff, so I can't reboot it quite often, preferably not at all.
My utilities are organized in a tree that mimics FHS and are packed into .tar.gz file. So it has /etc, /opt, /usr and stuff inside.
What I need is to mount the unpacked tar.gz file and unite it with existing root fs so it looked like I installed them. After my tests I need to unmount them without any traces.
I stumbled into several problems as I have chosen overlay fs as a base for my experiments with that task:
1. If I choose real root (/) tree as a lowerdir= for overlay fs, the system hangs - the problem is that lowerdir cannot be modified (but root fs is obviously does that quite often).
2. If I mount overlay for each of directories from my tar.gz - it works but still no luck with modifications, especially /etc and /var - I need to store data there and if I mount lowerdir=/var - I constantly get errors. Also and most annoying - I can't unmount overlay without 'Filesystem busy' error - that happens with /usr.
3. I tried a bunch of different approaches like symlinks for lowerdir (stupid but it did not work), different --bind mounts and stuff - no luck.
So I have these questions and would appreciate your help:
1. Is it really so hard to alter the lowerdir= in overlayfs? Are there any approaches? I just need to add files transparently to existing filesystem and then later remove them, storing all modifications into lowerdir. Is it really a severe problem for overlay fs?
2. Why does /usr fs always hangs and fails to unmount even though lsof shows no holding processes? I have no problem with /opt, /etc, even /bin unmounting it they were mounted as overlays, but /usr is always a problem and it 100% leads to reboot.
3. Are there any suggestions for a pretty simple problem: place a set of files into existing running file system, provide access and modifications possibilities and then remove all installed files? Of course, KVM is an answer, but I think that it is too much.
Thank you.
Mirimat
(33 rep)
May 9, 2024, 10:43 PM
• Last activity: Jan 23, 2025, 04:55 AM
-4
votes
1
answers
74751
views
What does ' sudo rm -rf /* ' do?
I ran this command on `Fedora`, which I anyway wanted to uninstall, so I decided to check out this command: `sudo rm -rf /*` just for fun. As soon as I ran this command, the GUI stopped working and patches of black started appearing, I thought the work was done, and did a forced shutdown. [By the wa...
I ran this command on
Fedora
, which I anyway wanted to uninstall, so I decided to check out this command: sudo rm -rf /*
just for fun. As soon as I ran this command, the GUI stopped working and patches of black started appearing, I thought the work was done, and did a forced shutdown.
[By the way, I was multibooting Windows 10, Linux Mint, Garuda Linux & Fedora]
When I rebooted, I was expecting Garuda Linux's Grub to show up, but nothing happened and DELL's Support Assist showed up. Then I learned from the BIOS, that the EFI partition was completely erased, which makes sense as it was the /boot/efi
directory in Fedora.
Then I had to go through the all the recovery stuff to get my OSs booting again.
I was worried that, like the EFI partition, which was mounted to Fedora was completely erased, all my Data partitions would also be erased with the command.
But when I checked out after getting every thing right, every thing was saved. And even the Fedora partition had some space used.
I then formatted the Fedora partition from g-parted of Garuda Linux.
Now I wonder what exactly does the command: sudo rm -rf /*
really does, just to check I didn't lose any other data.
Austin Rojers
(31 rep)
Jun 29, 2021, 05:39 AM
• Last activity: Jan 10, 2025, 02:26 AM
5
votes
2
answers
5159
views
Are Linux drivers part of the kernel or the rootfs
I have been working on a board with an embedded ARM processor. To get it to boot I have to add a bootloader, a Linux kernel and a disk image containing the root file system. This disk image is available on the internet for the target board (ZedBoard). After compiling the kernel with all necessary dr...
I have been working on a board with an embedded ARM processor. To get it to boot I have to add a bootloader, a Linux kernel and a disk image containing the root file system. This disk image is available on the internet for the target board (ZedBoard).
After compiling the kernel with all necessary drivers activated, I have found out that many drivers are available in
/lib/modules/kernel_version
folder.
I am a little bit confused as to how this whole thing works. Are drivers loaded by the kernel ? if so why are they already a part of the rootfs ? or does the kernel overwrite them with the ones compiled in it ?
devhallo
(53 rep)
Nov 12, 2014, 04:53 PM
• Last activity: Dec 23, 2024, 03:04 AM
0
votes
1
answers
69
views
Failed to umount oldroot after `pivot_root` and `chroot` in Linux
I am working on an embedded Linux system (kernel-5.10.24), and `busybox` as `init`. I created 2 rootfs partitions in system, I want to use `pivot_root` and `chroot` to change rootfs between them. When the system firstly bootup, the `mount` showed. ``` # mount ubi0:rootfs on / type ubifs (rw,relatime...
I am working on an embedded Linux system (kernel-5.10.24), and
busybox
as init
. I created 2 rootfs partitions in system, I want to use pivot_root
and chroot
to change rootfs between them.
When the system firstly bootup, the mount
showed.
# mount
ubi0:rootfs on / type ubifs (rw,relatime,assert=read-only,ubi=0,vol=0)
devtmpfs on /dev type devtmpfs (rw,relatime,size=42008k,nr_inodes=10502,mode=755)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime)
Now, I mounted 2nd rootfs into /mnt, then I run pivot_root
and chroot
.
# mount -t ubifs /dev/ubi1_0 /mnt/
# cd /mnt
# pivot_root . oldroot
# chroot . sh
# umount /oldroot
umount: can't unmount /oldroot: Device or resource busy
I mount proc
after pivot_root
and chroot
, and mount
showed.
# mount -t proc proc /proc
# mount
ubi0:rootfs on /oldroot type ubifs (rw,relatime,assert=read-only,ubi=0,vol=0)
devtmpfs on /oldroot/dev type devtmpfs (rw,relatime,size=42008k,nr_inodes=10502,mode=755)
proc on /oldroot/proc type proc (rw,relatime)
tmpfs on /oldroot/tmp type tmpfs (rw,relatime)
tmpfs on /oldroot/run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs on /oldroot/sys type sysfs (rw,relatime)
devpts on /oldroot/dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
tmpfs on /oldroot/dev/shm type tmpfs (rw,relatime)
/dev/ubi1_0 on / type ubifs (rw,relatime,assert=read-only,ubi=1,vol=0)
proc on /proc type proc (rw,relatime)
I checked the comments and answer of https://unix.stackexchange.com/questions/306406/unable-to-umount-after-pivot-root
and tried the script, but I still failed with the same error.
What should I do to umount /oldroot
after pivot_root
and chroot
?
## Updated.
I found umount -l /oldroot
can umount the oldroot. But how can I relaunch the init
in the new_root
and go through the /etc/inittab
??
wangt13
(631 rep)
Dec 21, 2024, 09:02 AM
• Last activity: Dec 21, 2024, 01:57 PM
-1
votes
1
answers
341
views
What is /mnt used for, and how does it differ from /media?
Linux newbie here. Was reading about the Linux filesystem and came across the directories `/mnt` and `/media`. AFAIK, they're both used for mounting, and I heard `/media` was the "new" one and it was where all hot-swappable devices (e.g USB sticks) go. So, I decided to experiment... I plugged in my...
Linux newbie here.
Was reading about the Linux filesystem and came across the directories
/mnt
and /media
. AFAIK, they're both used for mounting, and I heard /media
was the "new" one and it was where all hot-swappable devices (e.g USB sticks) go. So, I decided to experiment...
I plugged in my USB stick then executed ls /media
and found that Linux had made a directory named after my username! How sweet. So I executed ls /media/foo
(with foo being my username) and found my USB stick's name there. 'SanDisk 12.8.0 amd64 n'
. No idea what that means.
Out of curiosity, I decided to ls /mnt
, but found nothing!
Sooo... what is /mnt
used for again?
blockchain200
(1 rep)
Dec 14, 2024, 09:45 AM
• Last activity: Dec 15, 2024, 01:12 PM
0
votes
0
answers
67
views
Safe to delete snapshot parent?
Can I safely delete the `/root` snapshot and replace it with its child? Or does the parent snapshot need to be kept around? Default structure from Fedora, emphasis mine: $ sudo btrfs subvolume list / ID 256 gen 1000272 top level 5 path home ID **257** gen 1000272 top level 5 path root ID 258 gen 100...
Can I safely delete the
/root
snapshot and replace it with its child? Or does the parent snapshot need to be kept around?
Default structure from Fedora, emphasis mine:
$ sudo btrfs subvolume list /
ID 256 gen 1000272 top level 5 path home
ID **257** gen 1000272 top level 5 path root
ID 258 gen 1000243 top level 257 path var/lib/machines
ID 259 gen 476 top level **257** path snapshots/BACKUP_ROOT
ID 260 gen 477 top level 257 path snapshots/BACKUP_HOME
I know I can mount any other snapshot as root. What worries me is the parent/child structure (dependency?). What happens to a snapshot whose parent got deleted?
Or should I just rsync from the snapshot to /root
?
Jakub Fojtik
(130 rep)
Nov 4, 2024, 10:45 AM
0
votes
2
answers
2214
views
/root partition is filled up
Recently, my EndeavourOS install has been sending me a notification saying that my root filesystem was filled up, with 0 MiB remaining. What could be done to clean up the root system? Output of `sudo du -h --max-depth=1`: ``` 9,8G ./usr 125M ./boot 50M ./root 0 ./dev du: cannot access './proc/3667/t...
Recently, my EndeavourOS install has been sending me a notification saying that my root filesystem was filled up, with 0 MiB remaining. What could be done to clean up the root system?
Output of
sudo du -h --max-depth=1
:
9,8G ./usr
125M ./boot
50M ./root
0 ./dev
du: cannot access './proc/3667/task/3667/fd/4': No such file or directory
du: cannot access './proc/3667/task/3667/fdinfo/4': No such file or directory
du: cannot access './proc/3667/fd/3': No such file or directory
du: cannot access './proc/3667/fdinfo/3': No such file or directory
0 ./proc
16K ./lost+found
24K ./tmp
229G ./home
0 ./sys
293M ./opt
27M ./etc
8,0G ./var
12G ./run
12K ./srv
4,0K ./mnt
259G .
Output of df -h
:
Filesystem Size Used Avail Use% Mounted on
dev 7,6G 0 7,6G 0% /dev
run 7,6G 1,7M 7,6G 1% /run
/dev/nvme0n1p2 20G 19G 0 100% /
tmpfs 7,6G 71M 7,5G 1% /dev/shm
tmpfs 7,6G 1,5M 7,6G 1% /tmp
/dev/nvme0n1p4 500M 324K 499M 1% /boot/efi
/dev/nvme0n1p3 259G 229G 17G 94% /home
tmpfs 1,6G 92K 1,6G 1% /run/user/1000
/dev/mmcblk0p1 15G 12G 3,4G 78% /run/media/dion/_________
/dev/nvme0n1p1 17G 24K 16G 1% /run/media/dion/71f8f1fe-5a7d-433f-aa03-84b679c7e2d9
Dion
(113 rep)
Sep 10, 2021, 10:35 AM
• Last activity: Oct 30, 2024, 10:56 AM
Showing page 1 of 20 total questions