I am planning to use GParted live USB to reduce the size of one of my partitions and add another one and I would like to know if is there a chance my OS could get corrupted. I use Fedora 38 (gnome). Unless I don’t resize my partition either from the left or resize it to less than the already present content or delete the partition, I should be fine, right? Also, what are the precautions that I would need to follow while resizing my partitions? I’m ok with my files getting corrupted, I can use a backup to restore them but I don’t think I can do that for the OS.
Hello @zatan16 ,
First, welcome to !
What partition are you contemplating resizing? Why I am asking is that if it is a btrfs partition, there may be no need for resizing.
I want to make space to create a new partition in order to make a swap partition for hibernate to work. And how do I check whether it is a btrfs partition or not?
First you could do the partitioning from within fedora. If you open disks (gparted is okay too) you will see how your current partitioning is done. If you are creating a swap partition, you will have to resize the btrfs partition at the end of the disk (likely the one that is mounted as /home
). Btrfs doesn’t actually allocate all of it partitioned size until it is required, so resizing is more convenient than say ext4. You will need to unmount the particular partition you are resizing in order to work on it. This too can be done inside gparted/disks
When using gparted it will tell you the partition type for the selected partition.
Also the command lsblk -f
will list all block devices with the file system type shown.
Thanks for the information, can you provide me a reference which I can use to resize a btrfs file system that I can use to resize easily(the partition I want to resize is btrfs)
This depends on what your current layout is. Could you do either a small screen shot of the disk layout in gparted or disks or textually represent your using the command @computersavvy notes for block devices, then add comments about what you are trying to accomplish? From my experiences with this the documentation is spread across a few projects and thus a bit of a “journey” of discovery. In order to point you in the correct direction or give you some detailed instructions here, which would likely be best.
So this is not an actually installed on a system as a normal Fedora installation (fedora_localhost_live)?
Could you select the Partition3 and show the subvolume layout Please?
Just to be thorough on my part. The btrfs partition volume will (should) have three subvolumes that are the physical devices that get mounted at /
, /var
, and /home
. Since they are all on the same master volume (partition 3) they will be sharing the same pool of available space. Are you running out of space on one of those subvolumes?
And yes, I think I installed this one as a minimal Fedora installation. I have no games preinstalled, maybe you can tell from that this is a normal or a minimal installation. I don’t think I am running out of space on any of those. Just to be sure, how do I check it? (I’m new to Linux, used Ubuntu for just below a month before switching to Fedora)
So the Fedora official docs for the filesystem layout are at Disk Configuration :: Fedora Docs. The commands du
and df
work with btrfs but there are also btrfs specific utilities that you can use as well to see usage.
Using `df on my home produces this output with no options …
[jakfrost ~]$ df /home
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc1 976760848 233176888 743365224 24% /home
I doubt you’re running out of space yet especially if you haven’t installed much beyond a minimal install. (There is an actual minimal install available from the “everything” iso) Minimal has no gui as default just a terminal to login to.
Nah, I’m not running low on space, df /home
gives this output for me:
[xxxxxx@xxxxxx ~]$ df /home
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 498443264 15711708 481553892 4% /home
And this is just df
:
[xxxxxx@xxxxxx ~]$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 4096 0 4096 0% /dev
tmpfs 1944488 78448 1866040 5% /dev/shm
tmpfs 777796 3664 774132 1% /run
/dev/sda3 498443264 15711992 481553704 4% /
tmpfs 1944488 7608 1936880 1% /tmp
/dev/sda2 996780 245732 682236 27% /boot
/dev/sda1 613160 17780 595380 3% /boot/efi
/dev/sda3 498443264 15711992 481553704 4% /home
tmpfs 388896 196 388700 1% /run/user/1000
/dev/loop0 41856 41856 0 100% /var/lib/snapd/snap/snapd/20092
/dev/loop1 57088 57088 0 100% /var/lib/snapd/snap/core18/2790
/dev/loop2 128 128 0 100% /var/lib/snapd/snap/bare/5
/dev/loop4 93952 93952 0 100% /var/lib/snapd/snap/gtk-common-themes/1535
/dev/loop5 168832 168832 0 100% /var/lib/snapd/snap/gnome-3-28-1804/198
This looks like a standard Fedora Workstation installation with btrfs. Here:
% df -lhT / /home
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdc3 btrfs 118G 52G 63G 46% /
/dev/sdc3 btrfs 118G 52G 63G 46% /home
(old iMac with failed internal sdb and internal sda that is slower than USB3 SSD sdc).
As for chances of OS corruption – a storage system that is ready to fail can be pushed over the edge by heavy IO, you should assume that failure is possible and have a recovery plan. A power hit during a resize operation may leave the system unrecoverable, so if the system is line-powered, it is nice to have a UPS. For me, a recovery plan that means backups of my own files, documentation of the changes made after the initial install of Fedora so I don’t have to figure out what drivers from rpmfusion-nonfree are needed, and tested USB Fedora installation media.
Ok, that’s great. But I have a problem, I have only one USB to download Gparted and Fedora on. How will I be able to redownload Fedora if an OS corruption takes place? Can I download both, Fedora and Gparted on the same USB live? I actually have another one, but that one is for backing up my personal files.
With only one usb device you have 2 different options.
First you may put the fedora image on the usb so you have a live media install device, then boot that image and install gparted on the live media that is booted so it can be used.
The second option is to use something like ventoy installed on the usb device. Then you may copy the iso images of both gparted live and fedora onto the ventoy device so ventoy is able to boot either image as needed.
I have a ventoy device with several different iso images on it so I can select what I wish to boot at any time.
I already have Fedora installed on my laptop, is there something that is meant here by “…then boot that image…”. Also, I need to install Fedora in case of corruption happens while using Gparted. I don’t have access to another computer, so re-burning the USB with Fedora is not possible. I think I need to go with the ventoy option instead.
That means to boot the image from the usb device after writing it there.
Actually one can easily use fedora to write the iso image to a usb device. This option is very possible, though I like the ventoy option better since it leaves more possibilities on the table.
Actually one can easily use fedora to write the iso image to a usb device.
What I meant was that if I install just the Gparted image onto the USB stick, then in case of OS corruption, I can’t use my laptop to format the USB again with Fedora to install it.
I tried using ventoy, but I am getting the following error:
[root@xxxxxx ~]# sh Ventoy2Disk.sh -I /dev/sdb
sh: Ventoy2Disk.sh: No such file or directory
I’ve verified, the USB is called /dev/sdb
This is a common problem for users coming from Windows. You may find an good introduction to the linux command-line, such as Linux Command helpful.
Linux doesn’t normally execute programs that aren’t in a directory listed in the PATH
variable unless you prefix the name of the program or script with path information. If Ventoy2Disk.sh
is in the current directory, you just need to use sh ./Ventoy2Disk.sh ...
.
If you search the web, you may find bad advice, including: 1) add the current working directory to the PATH
, and 2) chmod -R 777 /
.
Years ago my boss was in a high-level meeting that included US military brass. At the end of the meeting, a USB key was passed around to share the meeting report. My boss had a brand new Apple laptop which reported malware in copy.exe
on the USB key. Most of the participants were using Windows, so if they used a terminal to copy the report after changing the working directory to the USB key, the malware would have installed itself. These days, some enterprises don’t allow employees to take their daily driver to such meetings. Instead, they are issued travel laptops (often from a pool of end-of-life machines that won’t be missed if they are shredded after use).
Well, turns out that wasn’t the case here. I signed in as the root and the problem was I was not in the correct folder where the sh file was, so I just needed to log out as root and go back to the correct folder. Then it worked without the need of ./
before Ventoy2Disk.sh
.