From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 991601459F7 for ; Sat, 13 Sep 2025 00:56:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757724988; cv=none; b=AUg+QKkY4dHXO2lvON+xksihY/xphlJP/F5Sza03TOMvvQ8mfthFe+CtnkVWPIoJHh+ELt7Md/Q3FDYRTlYntXtfsaktuPBR5Bku7alj+XUQA3KQWVRFf9meiP+5eY3bQ7OIdQj972xCphAlaIxJkB5zrb3dlzTF8c5pNn4xCb8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757724988; c=relaxed/simple; bh=ds9VwpQCIQQEuVYbVkP08KSVWpcFcJ5JA8drV9AyvVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LMN2btBQLhuVEQYwzR7eAhm/30D1fCjf+Nwhrz+MAfFwK7WJ3MyzcnPP7xxd/YWcZFUoeIhMV2XuwS9jGoGBRj51eJriECFW4Dyr5qmk53oRajdX353eaxhCNAWREwMf6IvkVguIuNJTsV12JOrIYKyQSpZgdEPyPPWhC5RxmIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kITMmj1Y; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kITMmj1Y" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-b0428b537e5so362615866b.3 for ; Fri, 12 Sep 2025 17:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757724984; x=1758329784; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=57Y6Vt+tKEG1ezrQxMY6sE7xxEuIy1GPZf6G9mOPdfs=; b=kITMmj1Y/B2QnsKlt5tKsUTTcv41UNx5oYVTTnnX2a0+eH8cDAZHgFLtk2s+xUMRVd RuiAA0DkH5QNU8zeohoD8bRcDhtAFQssgNrc6YryRcxWH3i2Tgq3TlP0itDjvpwRZm1f P1pCUl4UTVcxi7H9GjdnvwLYC9fiqA/qTn1d3L5kc2SSZ9VGLAZWPesiTfjSBUPMJo1e MZmqeGaELKxAx4md7el3965iMyyXLNJ5+PXrFDtWtiphRzIFyGRDjopnOJfnaYZXKBhb x85Qu3479v1sPSSlrVuqMxMC1hNdH18rlbqzkM9Vn37KnQ/59Ep0cLSIOUvpsg/g0QWU 9zDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757724984; x=1758329784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=57Y6Vt+tKEG1ezrQxMY6sE7xxEuIy1GPZf6G9mOPdfs=; b=lhBaNEtOFKYZiMVg54HkW4H3TZS+RpcFshlNuB/q3y/gHNjp5+mJF1paXxm63+p5SZ ZZsExFwbUEW3Am48Vx2os6VQoPaLGl3Y0MFNmZDCHdKHVez8GGnIX/bfFXni4xezMYPS s2npdU72RhbseMdHNc2odxwyVtCJIUhC6BXzHEMxlRmS+KZqnp6h3j9UpZygouvQrIzC fv2Stxx5XcD0K8iabfA0QB3CpGOvUqper8+xoe3ez0ERtRht5EVvNXL2182HtvJl5F+/ 851Rj8mnoFpObCqQwNqA+VKuqShQ+hIzP5J+60oUfCDqV6UjfV8057VyDNtoDRurFU00 xj4Q== X-Forwarded-Encrypted: i=1; AJvYcCXcR9JRB+BNprHEiJQqD+Efwfk1Ja1G/YnSyNh4KfdL2nNJtxwAZjqtx2QC7qVfV+ab5jAdWVt8@lists.linux.dev X-Gm-Message-State: AOJu0Yyk7e4AahRFrVjMqgqOL4xxW0aCfbjUfV8UaYaz/NtjRRned6wM Mmvjmf3pbjgva2sBPMYwQsTBRZRY3nRk0BSeSR31oe38of/iCqV4uh+h X-Gm-Gg: ASbGncuf93Fnhy9Nd01QWpuxbL5C+x0cV+xBmPmTSnF4+P4vwe57yjcgkVhq8PLJAr8 cQARMBevOsHoFSLL1sDq6KSBbx0OadSwVUoaAEcTSrlffgbRp2Z/1Kk8j+/3xp4k2XhkSscuEuw b4AatwJm65oSbVWjP0Uz4Mfen9IsAttjwNtXRv1bXE+2AcRWLUYjiSuHfsnhGzEpM1UombCh+w7 PXrM52Ib8JYD9SakXEPASdysy3cWPXiCbNmQqyCdREhFqDeRsYm+0BwiAzL3fEC0evjve09+ubA u9Lvy3HiEg47WBTN7vgxIcL0M+W4bITlmQ537a2MVo5QlZcu2yr/Y7rGKkfWUlR1TR0w2iBkNxd 5UUX/PgNvjJHYJNo9nuNQeAiPQ0VxwQ== X-Google-Smtp-Source: AGHT+IG1YYL4kFwbVvTnXfTe3odNA00ZLAAz2mLJaF8vV1UmquQWKJyitdN/Fum9NwuVLBLjujgrow== X-Received: by 2002:a17:907:3fa1:b0:b07:88aa:255b with SMTP id a640c23a62f3a-b07c354ed12mr458973666b.11.1757724983824; Fri, 12 Sep 2025 17:56:23 -0700 (PDT) Received: from localhost ([212.73.77.104]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-b07b33478besm484760966b.99.2025.09.12.17.56.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Sep 2025 17:56:23 -0700 (PDT) From: Askar Safin To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Christian Brauner , Al Viro , Jan Kara , Christoph Hellwig , Jens Axboe , Andy Shevchenko , Aleksa Sarai , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Julian Stecklina , Gao Xiang , Art Nikpal , Andrew Morton , Eric Curtin , Alexander Graf , Rob Landley , Lennart Poettering , linux-arch@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, x86@kernel.org, Ingo Molnar , linux-block@vger.kernel.org, initramfs@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, linux-ext4@vger.kernel.org, "Theodore Y . Ts'o" , linux-acpi@vger.kernel.org, Michal Simek , devicetree@vger.kernel.org, Luis Chamberlain , Kees Cook , Thorsten Blum , Heiko Carstens , patches@lists.linux.dev Subject: [PATCH RESEND 15/62] doc: modernize Documentation/admin-guide/blockdev/ramdisk.rst Date: Sat, 13 Sep 2025 00:37:54 +0000 Message-ID: <20250913003842.41944-16-safinaskar@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250913003842.41944-1-safinaskar@gmail.com> References: <20250913003842.41944-1-safinaskar@gmail.com> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Update it to reflect initrd removal Signed-off-by: Askar Safin --- .../admin-guide/blockdev/ramdisk.rst | 103 ++---------------- 1 file changed, 7 insertions(+), 96 deletions(-) diff --git a/Documentation/admin-guide/blockdev/ramdisk.rst b/Documentation/admin-guide/blockdev/ramdisk.rst index e57c61108dbc..6289e085f18f 100644 --- a/Documentation/admin-guide/blockdev/ramdisk.rst +++ b/Documentation/admin-guide/blockdev/ramdisk.rst @@ -5,18 +5,14 @@ Using the RAM disk block device with Linux .. Contents: 1) Overview - 2) Kernel Command Line Parameters - 3) Using "rdev" - 4) An Example of Creating a Compressed RAM Disk + 2) Module parameters 1) Overview ----------- -The RAM disk driver is a way to use main system memory as a block device. It -is required for initrd, an initial filesystem used if you need to load modules -in order to access the root filesystem (see Documentation/admin-guide/initrd.rst). It can -also be used for a temporary filesystem for crypto work, since the contents +The RAM disk driver is a way to use main system memory as a block device. +It can also be used for a temporary filesystem for crypto work, since the contents are erased on reboot. The RAM disk dynamically grows as more space is required. It does this by using @@ -30,109 +26,24 @@ and (re)build the kernel. To use RAM disk support with your system, run './MAKEDEV ram' from the /dev directory. RAM disks are all major number 1, and start with minor number 0 -for /dev/ram0, etc. If used, modern kernels use /dev/ram0 for an initrd. - -The new RAM disk also has the ability to load compressed RAM disk images, -allowing one to squeeze more programs onto an average installation or -rescue floppy disk. +for /dev/ram0, etc. -2) Parameters ---------------------------------- +2) Module parameters +-------------------- -2a) Kernel Command Line Parameters - - ramdisk_size=N + rd_size=N Size of the ramdisk. This parameter tells the RAM disk driver to set up RAM disks of N k size. The default is 4096 (4 MB). -2b) Module parameters - rd_nr /dev/ramX devices created. max_part Maximum partition number. - rd_size - See ramdisk_size. - -3) Using "rdev" ---------------- - -"rdev" is an obsolete, deprecated, antiquated utility that could be used -to set the boot device in a Linux kernel image. - -Instead of using rdev, just place the boot device information on the -kernel command line and pass it to the kernel from the bootloader. - -You can also pass arguments to the kernel by setting FDARGS in -arch/x86/boot/Makefile and specify in initrd image by setting FDINITRD in -arch/x86/boot/Makefile. - -Some of the kernel command line boot options that may apply here are:: - - ramdisk_size=M - -If you make a boot disk that has LILO, then for the above, you would use:: - - append = "ramdisk_size=M" - -4) An Example of Creating a Compressed RAM Disk ------------------------------------------------ - -To create a RAM disk image, you will need a spare block device to -construct it on. This can be the RAM disk device itself, or an -unused disk partition (such as an unmounted swap partition). For this -example, we will use the RAM disk device, "/dev/ram0". - -Note: This technique should not be done on a machine with less than 8 MB -of RAM. If using a spare disk partition instead of /dev/ram0, then this -restriction does not apply. - -a) Decide on the RAM disk size that you want. Say 2 MB for this example. - Create it by writing to the RAM disk device. (This step is not currently - required, but may be in the future.) It is wise to zero out the - area (esp. for disks) so that maximal compression is achieved for - the unused blocks of the image that you are about to create:: - - dd if=/dev/zero of=/dev/ram0 bs=1k count=2048 - -b) Make a filesystem on it. Say ext2fs for this example:: - - mke2fs -vm0 /dev/ram0 2048 - -c) Mount it, copy the files you want to it (eg: /etc/* /dev/* ...) - and unmount it again. - -d) Compress the contents of the RAM disk. The level of compression - will be approximately 50% of the space used by the files. Unused - space on the RAM disk will compress to almost nothing:: - - dd if=/dev/ram0 bs=1k count=2048 | gzip -v9 > /tmp/ram_image.gz - -e) Put the kernel onto the floppy:: - - dd if=zImage of=/dev/fd0 bs=1k - -f) Put the RAM disk image onto the floppy, after the kernel. Use an offset - that is slightly larger than the kernel, so that you can put another - (possibly larger) kernel onto the same floppy later without overlapping - the RAM disk image. An offset of 400 kB for kernels about 350 kB in - size would be reasonable. Make sure offset+size of ram_image.gz is - not larger than the total space on your floppy (usually 1440 kB):: - - dd if=/tmp/ram_image.gz of=/dev/fd0 bs=1k seek=400 - -g) Make sure that you have already specified the boot information in - FDARGS and FDINITRD or that you use a bootloader to pass kernel - command line boot options to the kernel. - -That is it. You now have your boot/root compressed RAM disk floppy. Some -users may wish to combine steps (d) and (f) by using a pipe. - Paul Gortmaker 12/95 -- 2.47.2