Friday, August 22, 2025

Expand disk

Step 2: Expand the Partition

From your fdisk output, I can see that /dev/sda1 (your root partition) is only using 29.9G of the available 128 GiB disk space. You need to expand this partition:

1.       Check current partition layout:

sudo lsblk

2.      Use growpart to expand the partition:

sudo growpart /dev/sda 1

This command expands partition 1 on /dev/sda to use all available space.[1]

3.      If growpart is not installed, install it first:

# For Ubuntu/Debian:
sudo apt update && sudo apt install cloud-guest-utils

# For CentOS/RHEL:
sudo yum install cloud-utils-growpart

Step 3: Resize the Filesystem

After expanding the partition, you need to resize the filesystem to use the new space:

1.       For ext4 filesystem (most common):

sudo resize2fs /dev/sda1

2.      For XFS filesystem:

sudo xfs_growfs /

Step 4: Verify the Changes

Check that the filesystem now shows the expanded size:

df -h


Wednesday, August 20, 2025

disable onedrive personal sync

 New-Item -Path "HKCU:\Software\Policies\Microsoft" -Name "OneDrive" -Force

Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\OneDrive" -Name "DisablePersonalSync" -Value 0 -Type DWord -Force


organize your files based on creation time

 # PowerShell script to organize files into date-based folders

# Creates folders in format: YYYY-MM-DD


# Set the source directory (current directory by default)

$sourceDirectory = Get-Location


# Get all files in the source directory

$files = Get-ChildItem -Path $sourceDirectory -File


Write-Host "Starting file organization..." -ForegroundColor Green

Write-Host "Source directory: $sourceDirectory" -ForegroundColor Yellow


foreach ($file in $files) {

    try {

        # Get the file's creation date and format it as YYYY-MM-DD

        #$fileDate = $file.CreationTime

        $fileDate = $file.LastWriteTime

        $folderName = $fileDate.ToString("yyyy-MM-dd")

        

        # Create the target folder path

        $targetFolder = Join-Path -Path $sourceDirectory -ChildPath $folderName

        

        # Create the folder if it doesn't exist

        if (-not (Test-Path -Path $targetFolder)) {

            New-Item -Path $targetFolder -ItemType Directory -Force | Out-Null

            Write-Host "Created folder: $folderName" -ForegroundColor Cyan

        }

        

        # Move the file to the target folder

        $targetPath = Join-Path -Path $targetFolder -ChildPath $file.Name

        

        # Check if file already exists in target location

        if (Test-Path -Path $targetPath) {

            Write-Host "File already exists in target: $($file.Name) -> $folderName" -ForegroundColor Yellow

        } else {

            Move-Item -Path $file.FullName -Destination $targetPath

            Write-Host "Moved: $($file.Name) -> $folderName" -ForegroundColor Green

        }

        

    } catch {

        Write-Host "Error processing file $($file.Name): $($_.Exception.Message)" -ForegroundColor Red

    }

}


Write-Host "File organization complete!" -ForegroundColor Green


# Display summary of created folders

$createdFolders = Get-ChildItem -Path $sourceDirectory -Directory | Sort-Object Name

Write-Host "`nCreated folders:" -ForegroundColor Yellow

foreach ($folder in $createdFolders) {

    $fileCount = (Get-ChildItem -Path $folder.FullName -File).Count

    Write-Host "  $($folder.Name) ($fileCount files)" -ForegroundColor White

}